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

Side by Side Diff: runtime/vm/stub_code.h

Issue 668193002: Remove isolate pointer from context objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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 | « runtime/vm/runtime_entry_x64.cc ('k') | runtime/vm/stub_code.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) 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
11 namespace dart { 11 namespace dart {
12 12
13 // Forward declarations. 13 // Forward declarations.
14 class Code; 14 class Code;
15 class Isolate; 15 class Isolate;
16 class ObjectPointerVisitor; 16 class ObjectPointerVisitor;
17 class RawCode; 17 class RawCode;
18 18
19 19
20 // List of stubs created in the VM isolate, these stubs are shared by different 20 // List of stubs created in the VM isolate, these stubs are shared by different
21 // isolates running in this dart process. 21 // isolates running in this dart process.
22 #define VM_STUB_CODE_LIST(V) \ 22 #define VM_STUB_CODE_LIST(V) \
23 V(PrintStopMessage) \ 23 V(PrintStopMessage) \
24 V(CallToRuntime) \
25 V(LazyCompile) \
26 V(CallBootstrapCFunction) \
27 V(CallNativeCFunction) \
28 V(CallStaticFunction) \
29 V(FixCallersTarget) \
30 V(FixAllocationStubTarget) \
31 V(FixAllocateArrayStubTarget) \
32 V(Deoptimize) \
33 V(DeoptimizeLazy) \
34 V(ICCallBreakpoint) \
35 V(ClosureCallBreakpoint) \
36 V(RuntimeCallBreakpoint) \
37 V(DebugStepCheck) \
38 V(GetStackPointer) \ 24 V(GetStackPointer) \
39 V(JumpToExceptionHandler) \ 25 V(JumpToExceptionHandler) \
40 V(UnoptimizedIdenticalWithNumberCheck) \
41 V(OptimizedIdenticalWithNumberCheck) \
42 26
43 // Is it permitted for the stubs above to refer to Object::null(), which is 27 // Is it permitted for the stubs above to refer to Object::null(), which is
44 // allocated in the VM isolate and shared across all isolates. 28 // allocated in the VM isolate and shared across all isolates.
45 // However, in cases where a simple GC-safe placeholder is needed on the stack, 29 // However, in cases where a simple GC-safe placeholder is needed on the stack,
46 // using Smi 0 instead of Object::null() is slightly more efficient, since a Smi 30 // using Smi 0 instead of Object::null() is slightly more efficient, since a Smi
47 // does not require relocation. 31 // does not require relocation.
48 32
49 // List of stubs created per isolate, these stubs could potentially contain 33 // List of stubs created per isolate, these stubs could potentially contain
50 // embedded objects and hence cannot be shared across isolates. 34 // embedded objects and hence cannot be shared across isolates.
51 #define STUB_CODE_LIST(V) \ 35 // The initial stubs are needed for loading bootstrapping scripts and have to
36 // be generated before Object::Init is called.
37 #define BOOTSTRAP_STUB_CODE_LIST(V) \
38 V(CallToRuntime) \
39 V(LazyCompile) \
40
41 #define REST_STUB_CODE_LIST(V) \
42 V(CallBootstrapCFunction) \
43 V(CallNativeCFunction) \
44 V(FixCallersTarget) \
45 V(CallStaticFunction) \
46 V(FixAllocationStubTarget) \
47 V(FixAllocateArrayStubTarget) \
52 V(CallClosureNoSuchMethod) \ 48 V(CallClosureNoSuchMethod) \
53 V(AllocateContext) \ 49 V(AllocateContext) \
54 V(UpdateStoreBuffer) \ 50 V(UpdateStoreBuffer) \
55 V(OneArgCheckInlineCache) \ 51 V(OneArgCheckInlineCache) \
56 V(TwoArgsCheckInlineCache) \ 52 V(TwoArgsCheckInlineCache) \
57 V(ThreeArgsCheckInlineCache) \ 53 V(ThreeArgsCheckInlineCache) \
58 V(SmiAddInlineCache) \ 54 V(SmiAddInlineCache) \
59 V(SmiSubInlineCache) \ 55 V(SmiSubInlineCache) \
60 V(SmiEqualInlineCache) \ 56 V(SmiEqualInlineCache) \
61 V(OneArgOptimizedCheckInlineCache) \ 57 V(OneArgOptimizedCheckInlineCache) \
62 V(TwoArgsOptimizedCheckInlineCache) \ 58 V(TwoArgsOptimizedCheckInlineCache) \
63 V(ThreeArgsOptimizedCheckInlineCache) \ 59 V(ThreeArgsOptimizedCheckInlineCache) \
64 V(ZeroArgsUnoptimizedStaticCall) \ 60 V(ZeroArgsUnoptimizedStaticCall) \
65 V(OneArgUnoptimizedStaticCall) \ 61 V(OneArgUnoptimizedStaticCall) \
66 V(TwoArgsUnoptimizedStaticCall) \ 62 V(TwoArgsUnoptimizedStaticCall) \
67 V(OptimizeFunction) \ 63 V(OptimizeFunction) \
68 V(InvokeDartCode) \ 64 V(InvokeDartCode) \
69 V(Subtype1TestCache) \ 65 V(Subtype1TestCache) \
70 V(Subtype2TestCache) \ 66 V(Subtype2TestCache) \
71 V(Subtype3TestCache) \ 67 V(Subtype3TestCache) \
68 V(Deoptimize) \
69 V(DeoptimizeLazy) \
70 V(ICCallBreakpoint) \
71 V(ClosureCallBreakpoint) \
72 V(RuntimeCallBreakpoint) \
73 V(UnoptimizedIdenticalWithNumberCheck) \
74 V(OptimizedIdenticalWithNumberCheck) \
75 V(DebugStepCheck) \
76
77 #define STUB_CODE_LIST(V) \
78 BOOTSTRAP_STUB_CODE_LIST(V) \
79 REST_STUB_CODE_LIST(V)
72 80
73 // class StubEntry is used to describe stub methods generated in dart to 81 // class StubEntry is used to describe stub methods generated in dart to
74 // abstract out common code executed from generated dart code. 82 // abstract out common code executed from generated dart code.
75 class StubEntry { 83 class StubEntry {
76 public: 84 public:
77 explicit StubEntry(const Code& code); 85 explicit StubEntry(const Code& code);
78 ~StubEntry() {} 86 ~StubEntry() {}
79 87
80 const ExternalLabel& label() const { return label_; } 88 const ExternalLabel& label() const { return label_; }
81 uword EntryPoint() const { return entry_point_; } 89 uword EntryPoint() const { return entry_point_; }
(...skipping 17 matching lines...) Expand all
99 class StubCode { 107 class StubCode {
100 public: 108 public:
101 explicit StubCode(Isolate* isolate) 109 explicit StubCode(Isolate* isolate)
102 : 110 :
103 #define STUB_CODE_INITIALIZER(name) \ 111 #define STUB_CODE_INITIALIZER(name) \
104 name##_entry_(NULL), 112 name##_entry_(NULL),
105 STUB_CODE_LIST(STUB_CODE_INITIALIZER) 113 STUB_CODE_LIST(STUB_CODE_INITIALIZER)
106 isolate_(isolate) {} 114 isolate_(isolate) {}
107 ~StubCode(); 115 ~StubCode();
108 116
109 void GenerateFor(Isolate* isolate);
110 117
111 // Generate all stubs which are shared across all isolates, this is done 118 // Generate all stubs which are shared across all isolates, this is done
112 // only once and the stub code resides in the vm_isolate heap. 119 // only once and the stub code resides in the vm_isolate heap.
113 static void InitOnce(); 120 static void InitOnce();
114 121
115 // Generate all stubs which are generated on a per isolate basis as they 122 // Generate all stubs which are generated on a per isolate basis as they
116 // have embedded objects which are isolate specific. 123 // have embedded objects which are isolate specific.
124 // Bootstrap stubs are needed before Object::Init to compile the bootstrap
125 // scripts.
126 static void InitBootstrapStubs(Isolate* isolate);
117 static void Init(Isolate* isolate); 127 static void Init(Isolate* isolate);
118 128
119 static void VisitObjectPointers(ObjectPointerVisitor* visitor); 129 static void VisitObjectPointers(ObjectPointerVisitor* visitor);
120 130
121 // Check if specified pc is in the dart invocation stub used for 131 // Check if specified pc is in the dart invocation stub used for
122 // transitioning into dart code. 132 // transitioning into dart code.
123 static bool InInvocationStub(uword pc); 133 static bool InInvocationStub(uword pc);
124 134
125 static bool InInvocationStubForIsolate(Isolate* isolate, uword pc); 135 static bool InInvocationStubForIsolate(Isolate* isolate, uword pc);
126 136
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 #undef STUB_CODE_ACCESSOR 175 #undef STUB_CODE_ACCESSOR
166 176
167 static RawCode* GetAllocationStubForClass(const Class& cls); 177 static RawCode* GetAllocationStubForClass(const Class& cls);
168 RawCode* GetAllocateArrayStub(); 178 RawCode* GetAllocateArrayStub();
169 179
170 uword UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested); 180 uword UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested);
171 181
172 static const intptr_t kNoInstantiator = 0; 182 static const intptr_t kNoInstantiator = 0;
173 183
174 private: 184 private:
185 void GenerateBootstrapStubsFor(Isolate* isolate);
186 void GenerateStubsFor(Isolate* isolate);
187
175 friend class MegamorphicCacheTable; 188 friend class MegamorphicCacheTable;
176 189
177 static const intptr_t kStubCodeSize = 4 * KB; 190 static const intptr_t kStubCodeSize = 4 * KB;
178 191
179 #define STUB_CODE_GENERATE(name) \ 192 #define STUB_CODE_GENERATE(name) \
180 static void Generate##name##Stub(Assembler* assembler); 193 static void Generate##name##Stub(Assembler* assembler);
181 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); 194 VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
182 STUB_CODE_LIST(STUB_CODE_GENERATE); 195 STUB_CODE_LIST(STUB_CODE_GENERATE);
183 #undef STUB_CODE_GENERATE 196 #undef STUB_CODE_GENERATE
184 197
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 Assembler* assembler, 230 Assembler* assembler,
218 const Register left, 231 const Register left,
219 const Register right, 232 const Register right,
220 const Register temp1 = kNoRegister, 233 const Register temp1 = kNoRegister,
221 const Register temp2 = kNoRegister); 234 const Register temp2 = kNoRegister);
222 }; 235 };
223 236
224 } // namespace dart 237 } // namespace dart
225 238
226 #endif // VM_STUB_CODE_H_ 239 #endif // VM_STUB_CODE_H_
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry_x64.cc ('k') | runtime/vm/stub_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698