OLD | NEW |
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 #include "vm/stub_code.h" | 5 #include "vm/stub_code.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/disassembler.h" | 10 #include "vm/disassembler.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 #undef STUB_CODE_VISIT_OBJECT_POINTER | 89 #undef STUB_CODE_VISIT_OBJECT_POINTER |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 bool StubCode::InInvocationStub(uword pc) { | 93 bool StubCode::InInvocationStub(uword pc) { |
94 return InInvocationStubForIsolate(Isolate::Current(), pc); | 94 return InInvocationStubForIsolate(Isolate::Current(), pc); |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 bool StubCode::InInvocationStubForIsolate(Isolate* isolate, uword pc) { | 98 bool StubCode::InInvocationStubForIsolate(Isolate* isolate, uword pc) { |
99 StubEntry* invoke_dart_entry = isolate->stub_code()->InvokeDartCode_entry_; | 99 StubCode* stub_code = isolate->stub_code(); |
100 uword entry = invoke_dart_entry->EntryPoint(); | 100 uword entry = stub_code->InvokeDartCodeEntryPoint(); |
101 uword size = invoke_dart_entry->Size(); | 101 uword size = stub_code->InvokeDartCodeSize(); |
102 return (pc >= entry) && (pc < (entry + size)); | 102 return (pc >= entry) && (pc < (entry + size)); |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 106 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
107 Isolate* isolate = Isolate::Current(); | 107 Isolate* isolate = Isolate::Current(); |
108 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); | 108 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); |
109 ASSERT(error.IsNull()); | 109 ASSERT(error.IsNull()); |
110 Code& stub = Code::Handle(isolate, cls.allocation_stub()); | 110 Code& stub = Code::Handle(isolate, cls.allocation_stub()); |
111 if (stub.IsNull()) { | 111 if (stub.IsNull()) { |
(...skipping 23 matching lines...) Expand all Loading... |
135 OS::Print("Code for stub '%s': {\n", name); | 135 OS::Print("Code for stub '%s': {\n", name); |
136 DisassembleToStdout formatter; | 136 DisassembleToStdout formatter; |
137 code.Disassemble(&formatter); | 137 code.Disassemble(&formatter); |
138 OS::Print("}\n"); | 138 OS::Print("}\n"); |
139 } | 139 } |
140 return code.raw(); | 140 return code.raw(); |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 const char* StubCode::NameOfStub(uword entry_point) { | 144 const char* StubCode::NameOfStub(uword entry_point) { |
145 #define STUB_CODE_TESTER(name) \ | 145 #define VM_STUB_CODE_TESTER(name) \ |
146 if ((name##_entry() != NULL) && (entry_point == name##EntryPoint())) { \ | 146 if ((name##_entry() != NULL) && (entry_point == name##EntryPoint())) { \ |
147 return ""#name; \ | 147 return ""#name; \ |
148 } | 148 } |
| 149 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
149 | 150 |
150 VM_STUB_CODE_LIST(STUB_CODE_TESTER); | 151 #define STUB_CODE_TESTER(name) \ |
| 152 if ((isolate->stub_code()->name##_entry() != NULL) && \ |
| 153 (entry_point == isolate->stub_code()->name##EntryPoint())) { \ |
| 154 return ""#name; \ |
| 155 } |
151 Isolate* isolate = Isolate::Current(); | 156 Isolate* isolate = Isolate::Current(); |
152 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 157 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
153 STUB_CODE_LIST(STUB_CODE_TESTER); | 158 STUB_CODE_LIST(STUB_CODE_TESTER); |
154 } | 159 } |
| 160 #undef VM_STUB_CODE_TESTER |
155 #undef STUB_CODE_TESTER | 161 #undef STUB_CODE_TESTER |
156 return NULL; | 162 return NULL; |
157 } | 163 } |
158 | 164 |
159 } // namespace dart | 165 } // namespace dart |
OLD | NEW |