| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 NoHeapGrowthControlScope no_growth_control; | 176 NoHeapGrowthControlScope no_growth_control; |
| 177 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */); | 177 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */); |
| 178 stub.set_owner(cls); | 178 stub.set_owner(cls); |
| 179 cls.set_allocation_stub(stub); | 179 cls.set_allocation_stub(stub); |
| 180 } | 180 } |
| 181 Isolate* isolate = thread->isolate(); | 181 Isolate* isolate = thread->isolate(); |
| 182 if (isolate->heap()->NeedsGarbageCollection()) { | 182 if (isolate->heap()->NeedsGarbageCollection()) { |
| 183 isolate->heap()->CollectAllGarbage(); | 183 isolate->heap()->CollectAllGarbage(); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 #ifndef PRODUCT |
| 186 if (FLAG_support_disassembler && FLAG_disassemble_stubs) { | 187 if (FLAG_support_disassembler && FLAG_disassemble_stubs) { |
| 187 LogBlock lb; | 188 LogBlock lb; |
| 188 THR_Print("Code for allocation stub '%s': {\n", name); | 189 THR_Print("Code for allocation stub '%s': {\n", name); |
| 189 #ifndef PRODUCT | |
| 190 DisassembleToStdout formatter; | 190 DisassembleToStdout formatter; |
| 191 stub.Disassemble(&formatter); | 191 stub.Disassemble(&formatter); |
| 192 #endif | |
| 193 THR_Print("}\n"); | 192 THR_Print("}\n"); |
| 194 const ObjectPool& object_pool = ObjectPool::Handle(stub.object_pool()); | 193 const ObjectPool& object_pool = ObjectPool::Handle(stub.object_pool()); |
| 195 object_pool.DebugPrint(); | 194 object_pool.DebugPrint(); |
| 196 } | 195 } |
| 196 #endif // !PRODUCT |
| 197 } | 197 } |
| 198 return stub.raw(); | 198 return stub.raw(); |
| 199 #endif | 199 #endif // !DBC |
| 200 UNIMPLEMENTED(); | 200 UNIMPLEMENTED(); |
| 201 return Code::null(); | 201 return Code::null(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 | 204 |
| 205 const StubEntry* StubCode::UnoptimizedStaticCallEntry( | 205 const StubEntry* StubCode::UnoptimizedStaticCallEntry( |
| 206 intptr_t num_args_tested) { | 206 intptr_t num_args_tested) { |
| 207 // These stubs are not used by DBC. | 207 // These stubs are not used by DBC. |
| 208 #if !defined(TARGET_ARCH_DBC) | 208 #if !defined(TARGET_ARCH_DBC) |
| 209 switch (num_args_tested) { | 209 switch (num_args_tested) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 222 #endif | 222 #endif |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 RawCode* StubCode::Generate(const char* name, | 226 RawCode* StubCode::Generate(const char* name, |
| 227 void (*GenerateStub)(Assembler* assembler)) { | 227 void (*GenerateStub)(Assembler* assembler)) { |
| 228 Assembler assembler; | 228 Assembler assembler; |
| 229 GenerateStub(&assembler); | 229 GenerateStub(&assembler); |
| 230 const Code& code = Code::Handle( | 230 const Code& code = Code::Handle( |
| 231 Code::FinalizeCode(name, &assembler, false /* optimized */)); | 231 Code::FinalizeCode(name, &assembler, false /* optimized */)); |
| 232 #ifndef PRODUCT |
| 232 if (FLAG_support_disassembler && FLAG_disassemble_stubs) { | 233 if (FLAG_support_disassembler && FLAG_disassemble_stubs) { |
| 233 LogBlock lb; | 234 LogBlock lb; |
| 234 THR_Print("Code for stub '%s': {\n", name); | 235 THR_Print("Code for stub '%s': {\n", name); |
| 235 DisassembleToStdout formatter; | 236 DisassembleToStdout formatter; |
| 236 code.Disassemble(&formatter); | 237 code.Disassemble(&formatter); |
| 237 THR_Print("}\n"); | 238 THR_Print("}\n"); |
| 238 const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool()); | 239 const ObjectPool& object_pool = ObjectPool::Handle(code.object_pool()); |
| 239 object_pool.DebugPrint(); | 240 object_pool.DebugPrint(); |
| 240 } | 241 } |
| 242 #endif // !PRODUCT |
| 241 return code.raw(); | 243 return code.raw(); |
| 242 } | 244 } |
| 243 | 245 |
| 244 | 246 |
| 245 const char* StubCode::NameOfStub(uword entry_point) { | 247 const char* StubCode::NameOfStub(uword entry_point) { |
| 246 #define VM_STUB_CODE_TESTER(name) \ | 248 #define VM_STUB_CODE_TESTER(name) \ |
| 247 if ((name##_entry() != NULL) && \ | 249 if ((name##_entry() != NULL) && \ |
| 248 (entry_point == name##_entry()->EntryPoint())) { \ | 250 (entry_point == name##_entry()->EntryPoint())) { \ |
| 249 return ""#name; \ | 251 return ""#name; \ |
| 250 } | 252 } |
| 251 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); | 253 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
| 252 #undef VM_STUB_CODE_TESTER | 254 #undef VM_STUB_CODE_TESTER |
| 253 return NULL; | 255 return NULL; |
| 254 } | 256 } |
| 255 | 257 |
| 256 } // namespace dart | 258 } // namespace dart |
| OLD | NEW |