OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_STUB_CODE_H_ | 5 #ifndef VM_STUB_CODE_H_ |
6 #define VM_STUB_CODE_H_ | 6 #define VM_STUB_CODE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 V(CallNativeCFunction) \ | 25 V(CallNativeCFunction) \ |
26 V(AllocateArray) \ | 26 V(AllocateArray) \ |
27 V(CallNoSuchMethodFunction) \ | 27 V(CallNoSuchMethodFunction) \ |
28 V(MegamorphicLookup) \ | 28 V(MegamorphicLookup) \ |
29 V(CallStaticFunction) \ | 29 V(CallStaticFunction) \ |
30 V(CallClosureFunction) \ | 30 V(CallClosureFunction) \ |
31 V(StackOverflow) \ | 31 V(StackOverflow) \ |
32 V(OptimizeInvokedFunction) \ | 32 V(OptimizeInvokedFunction) \ |
33 V(FixCallersTarget) \ | 33 V(FixCallersTarget) \ |
34 V(Deoptimize) \ | 34 V(Deoptimize) \ |
| 35 V(BreakpointStatic) \ |
| 36 |
35 | 37 |
36 // Is it permitted for the stubs above to refer to Object::null(), which is | 38 // Is it permitted for the stubs above to refer to Object::null(), which is |
37 // allocated in the VM isolate and shared across all isolates. | 39 // allocated in the VM isolate and shared across all isolates. |
38 // However, in cases where a simple GC-safe placeholder is needed on the stack, | 40 // However, in cases where a simple GC-safe placeholder is needed on the stack, |
39 // using Smi 0 instead of Object::null() is slightly more efficient, since a Smi | 41 // using Smi 0 instead of Object::null() is slightly more efficient, since a Smi |
40 // does not require relocation. | 42 // does not require relocation. |
41 | 43 |
42 // List of stubs created per isolate, these stubs could potentially contain | 44 // List of stubs created per isolate, these stubs could potentially contain |
43 // embedded objects and hence cannot be shared across isolates. | 45 // embedded objects and hence cannot be shared across isolates. |
44 #define STUB_CODE_LIST(V) \ | 46 #define STUB_CODE_LIST(V) \ |
45 V(InvokeDartCode) \ | 47 V(InvokeDartCode) \ |
46 V(AllocateContext) \ | 48 V(AllocateContext) \ |
47 V(InlineCache) \ | 49 V(InlineCache) \ |
| 50 V(BreakpointDynamic) \ |
48 | 51 |
49 | 52 |
50 // class StubEntry is used to describe stub methods generated in dart to | 53 // class StubEntry is used to describe stub methods generated in dart to |
51 // abstract out common code executed from generated dart code. | 54 // abstract out common code executed from generated dart code. |
52 class StubEntry { | 55 class StubEntry { |
53 public: | 56 public: |
54 StubEntry(const char* name, const Code& code); | 57 StubEntry(const char* name, const Code& code); |
55 ~StubEntry() {} | 58 ~StubEntry() {} |
56 | 59 |
57 const ExternalLabel& label() const { return label_; } | 60 const ExternalLabel& label() const { return label_; } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return name##_entry()->Size(); \ | 121 return name##_entry()->Size(); \ |
119 } | 122 } |
120 VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR); | 123 VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR); |
121 #undef STUB_CODE_ACCESSOR | 124 #undef STUB_CODE_ACCESSOR |
122 | 125 |
123 // Define the per-isolate stub code accessors. | 126 // Define the per-isolate stub code accessors. |
124 #define STUB_CODE_ACCESSOR(name) \ | 127 #define STUB_CODE_ACCESSOR(name) \ |
125 static StubEntry* name##_entry() { \ | 128 static StubEntry* name##_entry() { \ |
126 return Isolate::Current()->stub_code()->name##_entry_; \ | 129 return Isolate::Current()->stub_code()->name##_entry_; \ |
127 } \ | 130 } \ |
| 131 static const ExternalLabel& name##Label() { \ |
| 132 return name##_entry()->label(); \ |
| 133 } \ |
128 static uword name##EntryPoint() { \ | 134 static uword name##EntryPoint() { \ |
129 return name##_entry()->EntryPoint(); \ | 135 return name##_entry()->EntryPoint(); \ |
130 } \ | 136 } \ |
131 static intptr_t name##Size() { \ | 137 static intptr_t name##Size() { \ |
132 return name##_entry()->Size(); \ | 138 return name##_entry()->Size(); \ |
133 } | 139 } |
134 STUB_CODE_LIST(STUB_CODE_ACCESSOR); | 140 STUB_CODE_LIST(STUB_CODE_ACCESSOR); |
135 #undef STUB_CODE_ACCESSOR | 141 #undef STUB_CODE_ACCESSOR |
136 | 142 |
137 static RawCode* GetAllocationStubForClass(const Class& cls); | 143 static RawCode* GetAllocationStubForClass(const Class& cls); |
(...skipping 27 matching lines...) Expand all Loading... |
165 | 171 |
166 static void GenerateAllocationStubForClass(Assembler* assembler, | 172 static void GenerateAllocationStubForClass(Assembler* assembler, |
167 const Class& cls); | 173 const Class& cls); |
168 static void GenerateAllocationStubForClosure(Assembler* assembler, | 174 static void GenerateAllocationStubForClosure(Assembler* assembler, |
169 const Function& func); | 175 const Function& func); |
170 }; | 176 }; |
171 | 177 |
172 } // namespace dart | 178 } // namespace dart |
173 | 179 |
174 #endif // VM_STUB_CODE_H_ | 180 #endif // VM_STUB_CODE_H_ |
OLD | NEW |