Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: vm/object.h

Issue 9721006: Second set of changes for implementation of stack map support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
11 #include "vm/bitmap.h" 11 #include "vm/bitmap.h"
12 #include "vm/dart.h" 12 #include "vm/dart.h"
13 #include "vm/globals.h" 13 #include "vm/globals.h"
14 #include "vm/handles.h" 14 #include "vm/handles.h"
15 #include "vm/heap.h" 15 #include "vm/heap.h"
16 #include "vm/isolate.h" 16 #include "vm/isolate.h"
17 #include "vm/os.h" 17 #include "vm/os.h"
18 #include "vm/raw_object.h" 18 #include "vm/raw_object.h"
19 #include "vm/scanner.h" 19 #include "vm/scanner.h"
20 20
21 namespace dart { 21 namespace dart {
22 22
23 // Forward declarations. 23 // Forward declarations.
24 #define DEFINE_FORWARD_DECLARATION(clazz) \ 24 #define DEFINE_FORWARD_DECLARATION(clazz) \
25 class clazz; 25 class clazz;
26 CLASS_LIST(DEFINE_FORWARD_DECLARATION) 26 CLASS_LIST(DEFINE_FORWARD_DECLARATION)
27 #undef DEFINE_FORWARD_DECLARATION 27 #undef DEFINE_FORWARD_DECLARATION
28 class Assembler; 28 class Assembler;
29 class Code;
29 class LocalScope; 30 class LocalScope;
30 31
31 #define OBJECT_IMPLEMENTATION(object, super) \ 32 #define OBJECT_IMPLEMENTATION(object, super) \
32 public: /* NOLINT */ \ 33 public: /* NOLINT */ \
33 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ 34 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \
34 void operator=(Raw##object* value) { \ 35 void operator=(Raw##object* value) { \
35 initializeHandle(this, value); \ 36 initializeHandle(this, value); \
36 } \ 37 } \
37 bool Is##object() const { return true; } \ 38 bool Is##object() const { return true; } \
38 void operator^=(RawObject* value) { \ 39 void operator^=(RawObject* value) { \
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 1990
1990 1991
1991 class Stackmap : public Object { 1992 class Stackmap : public Object {
1992 public: 1993 public:
1993 static const intptr_t kNoMaximum = -1; 1994 static const intptr_t kNoMaximum = -1;
1994 static const intptr_t kNoMinimum = -1; 1995 static const intptr_t kNoMinimum = -1;
1995 1996
1996 bool IsObject(intptr_t offset) const { 1997 bool IsObject(intptr_t offset) const {
1997 return InRange(offset) && GetBit(offset); 1998 return InRange(offset) && GetBit(offset);
1998 } 1999 }
1999 uword pc() const { return raw_ptr()->pc_; } 2000 uword PC() const { return raw_ptr()->pc_; }
2001 void SetPC(uword value) const { raw_ptr()->pc_ = value; }
2002
2003 RawCode* GetCode() const { return raw_ptr()->code_; }
2004 void SetCode(const Code& code) const;
2005
2006 // Return the offset of the highest stack slot that has an object.
2007 intptr_t Maximum() const;
2008
2009 // Return the offset of the lowest stack slot that has an object.
2010 intptr_t Minimum() const;
2000 2011
2001 static intptr_t InstanceSize() { 2012 static intptr_t InstanceSize() {
2002 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); 2013 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_));
2003 return 0; 2014 return 0;
2004 } 2015 }
2005 static intptr_t InstanceSize(intptr_t size) { 2016 static intptr_t InstanceSize(intptr_t size) {
2006 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize)); 2017 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize));
2007 } 2018 }
2008 static RawStackmap* New(uword pc, const Code& code, BitmapBuilder* bmap); 2019 static RawStackmap* New(uword pc, const Code& code, BitmapBuilder* bmap);
2009 2020
2010 private: 2021 private:
2011 inline intptr_t SizeInBits() const; 2022 inline intptr_t SizeInBits() const;
2012 2023
2013 bool InRange(intptr_t offset) const { return offset < SizeInBits(); } 2024 bool InRange(intptr_t offset) const { return offset < SizeInBits(); }
2014 2025
2015 bool GetBit(intptr_t bit_offset) const; 2026 bool GetBit(intptr_t bit_offset) const;
2016 void SetBit(intptr_t bit_offset, bool value) const; 2027 void SetBit(intptr_t bit_offset, bool value) const;
2017 2028
2018 // Return the offset of the highest stack slot that has an object.
2019 intptr_t Maximum() const;
2020
2021 // Return the offset of the lowest stack slot that has an object.
2022 intptr_t Minimum() const;
2023
2024 void set_bitmap_size_in_bytes(intptr_t value) const; 2029 void set_bitmap_size_in_bytes(intptr_t value) const;
2025 void set_pc(uword value) const; 2030 void set_pc(uword value) const;
2026 void set_code(const Code& code) const; 2031 void set_code(const Code& code) const;
2027 2032
2028 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 2033 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2029 friend class Class; 2034 friend class Class;
2030 friend class BitmapBuilder; 2035 friend class BitmapBuilder;
2031 }; 2036 };
2032 2037
2033 2038
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 return instr.size(); 2113 return instr.size();
2109 } 2114 }
2110 2115
2111 RawPcDescriptors* pc_descriptors() const { 2116 RawPcDescriptors* pc_descriptors() const {
2112 return raw_ptr()->pc_descriptors_; 2117 return raw_ptr()->pc_descriptors_;
2113 } 2118 }
2114 void set_pc_descriptors(const PcDescriptors& descriptors) const { 2119 void set_pc_descriptors(const PcDescriptors& descriptors) const {
2115 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); 2120 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw());
2116 } 2121 }
2117 2122
2123 RawArray* stackmaps() const {
2124 return raw_ptr()->stackmaps_;
2125 }
2126 void set_stackmaps(const Array& maps) const;
2127
2118 RawLocalVarDescriptors* var_descriptors() const { 2128 RawLocalVarDescriptors* var_descriptors() const {
2119 return raw_ptr()->var_descriptors_; 2129 return raw_ptr()->var_descriptors_;
2120 } 2130 }
2121 void set_var_descriptors(const LocalVarDescriptors& value) const { 2131 void set_var_descriptors(const LocalVarDescriptors& value) const {
2122 StorePointer(&raw_ptr()->var_descriptors_, value.raw()); 2132 StorePointer(&raw_ptr()->var_descriptors_, value.raw());
2123 } 2133 }
2124 2134
2125 RawExceptionHandlers* exception_handlers() const { 2135 RawExceptionHandlers* exception_handlers() const {
2126 return raw_ptr()->exception_handlers_; 2136 return raw_ptr()->exception_handlers_;
2127 } 2137 }
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
3882 } 3892 }
3883 3893
3884 3894
3885 intptr_t Stackmap::SizeInBits() const { 3895 intptr_t Stackmap::SizeInBits() const {
3886 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 3896 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
3887 } 3897 }
3888 3898
3889 } // namespace dart 3899 } // namespace dart
3890 3900
3891 #endif // VM_OBJECT_H_ 3901 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698