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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 stub ^= Code::FinalizeCode(name, &assembler); | 150 stub ^= Code::FinalizeCode(name, &assembler); |
151 stub.set_owner(cls); | 151 stub.set_owner(cls); |
152 cls.set_allocation_stub(stub); | 152 cls.set_allocation_stub(stub); |
153 if (FLAG_disassemble_stubs) { | 153 if (FLAG_disassemble_stubs) { |
154 LogBlock lb(Isolate::Current()); | 154 LogBlock lb(Isolate::Current()); |
155 ISL_Print("Code for allocation stub '%s': {\n", name); | 155 ISL_Print("Code for allocation stub '%s': {\n", name); |
156 DisassembleToStdout formatter; | 156 DisassembleToStdout formatter; |
157 stub.Disassemble(&formatter); | 157 stub.Disassemble(&formatter); |
158 ISL_Print("}\n"); | 158 ISL_Print("}\n"); |
| 159 const ObjectPool& object_pool = ObjectPool::Handle( |
| 160 Instructions::Handle(stub.instructions()).object_pool()); |
| 161 object_pool.DebugPrint(); |
159 } | 162 } |
160 stub.set_entry_patch_pc_offset(entry_patch_offset); | 163 stub.set_entry_patch_pc_offset(entry_patch_offset); |
161 stub.set_patch_code_pc_offset(patch_code_offset); | 164 stub.set_patch_code_pc_offset(patch_code_offset); |
162 } | 165 } |
163 return stub.raw(); | 166 return stub.raw(); |
164 } | 167 } |
165 | 168 |
166 | 169 |
167 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { | 170 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { |
168 switch (num_args_tested) { | 171 switch (num_args_tested) { |
(...skipping 14 matching lines...) Expand all Loading... |
183 void (*GenerateStub)(Assembler* assembler)) { | 186 void (*GenerateStub)(Assembler* assembler)) { |
184 Assembler assembler; | 187 Assembler assembler; |
185 GenerateStub(&assembler); | 188 GenerateStub(&assembler); |
186 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); | 189 const Code& code = Code::Handle(Code::FinalizeCode(name, &assembler)); |
187 if (FLAG_disassemble_stubs) { | 190 if (FLAG_disassemble_stubs) { |
188 LogBlock lb(Isolate::Current()); | 191 LogBlock lb(Isolate::Current()); |
189 ISL_Print("Code for stub '%s': {\n", name); | 192 ISL_Print("Code for stub '%s': {\n", name); |
190 DisassembleToStdout formatter; | 193 DisassembleToStdout formatter; |
191 code.Disassemble(&formatter); | 194 code.Disassemble(&formatter); |
192 ISL_Print("}\n"); | 195 ISL_Print("}\n"); |
| 196 const ObjectPool& object_pool = ObjectPool::Handle( |
| 197 Instructions::Handle(code.instructions()).object_pool()); |
| 198 object_pool.DebugPrint(); |
193 } | 199 } |
194 return code.raw(); | 200 return code.raw(); |
195 } | 201 } |
196 | 202 |
197 | 203 |
198 const char* StubCode::NameOfStub(uword entry_point) { | 204 const char* StubCode::NameOfStub(uword entry_point) { |
199 #define VM_STUB_CODE_TESTER(name) \ | 205 #define VM_STUB_CODE_TESTER(name) \ |
200 if ((name##_entry() != NULL) && (entry_point == name##EntryPoint())) { \ | 206 if ((name##_entry() != NULL) && (entry_point == name##EntryPoint())) { \ |
201 return ""#name; \ | 207 return ""#name; \ |
202 } | 208 } |
203 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); | 209 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
204 | 210 |
205 #define STUB_CODE_TESTER(name) \ | 211 #define STUB_CODE_TESTER(name) \ |
206 if ((isolate->stub_code()->name##_entry() != NULL) && \ | 212 if ((isolate->stub_code()->name##_entry() != NULL) && \ |
207 (entry_point == isolate->stub_code()->name##EntryPoint())) { \ | 213 (entry_point == isolate->stub_code()->name##EntryPoint())) { \ |
208 return ""#name; \ | 214 return ""#name; \ |
209 } | 215 } |
210 Isolate* isolate = Isolate::Current(); | 216 Isolate* isolate = Isolate::Current(); |
211 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 217 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
212 STUB_CODE_LIST(STUB_CODE_TESTER); | 218 STUB_CODE_LIST(STUB_CODE_TESTER); |
213 } | 219 } |
214 #undef VM_STUB_CODE_TESTER | 220 #undef VM_STUB_CODE_TESTER |
215 #undef STUB_CODE_TESTER | 221 #undef STUB_CODE_TESTER |
216 return NULL; | 222 return NULL; |
217 } | 223 } |
218 | 224 |
219 } // namespace dart | 225 } // namespace dart |
OLD | NEW |