| 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 "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/disassembler.h" | 9 #include "vm/disassembler.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 98 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
| 99 Isolate* isolate = Isolate::Current(); | 99 Isolate* isolate = Isolate::Current(); |
| 100 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); | 100 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); |
| 101 ASSERT(error.IsNull()); | 101 ASSERT(error.IsNull()); |
| 102 Code& stub = Code::Handle(isolate, cls.allocation_stub()); | 102 Code& stub = Code::Handle(isolate, cls.allocation_stub()); |
| 103 if (stub.IsNull()) { | 103 if (stub.IsNull()) { |
| 104 Assembler assembler; | 104 Assembler assembler; |
| 105 const char* name = cls.ToCString(); | 105 const char* name = cls.ToCString(); |
| 106 StubCode::GenerateAllocationStubForClass(&assembler, cls); | 106 StubCode::GenerateAllocationStubForClass(&assembler, cls); |
| 107 stub ^= Code::FinalizeCode(name, &assembler); | 107 stub ^= Code::FinalizeCode(name, &assembler); |
| 108 stub.set_owner(cls); |
| 108 cls.set_allocation_stub(stub); | 109 cls.set_allocation_stub(stub); |
| 109 if (FLAG_disassemble_stubs) { | 110 if (FLAG_disassemble_stubs) { |
| 110 OS::Print("Code for allocation stub '%s': {\n", name); | 111 OS::Print("Code for allocation stub '%s': {\n", name); |
| 111 Disassembler::Disassemble(stub.EntryPoint(), | 112 Disassembler::Disassemble(stub.EntryPoint(), |
| 112 stub.EntryPoint() + assembler.CodeSize()); | 113 stub.EntryPoint() + assembler.CodeSize()); |
| 113 OS::Print("}\n"); | 114 OS::Print("}\n"); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 return stub.raw(); | 117 return stub.raw(); |
| 117 } | 118 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 141 VM_STUB_CODE_LIST(STUB_CODE_TESTER); | 142 VM_STUB_CODE_LIST(STUB_CODE_TESTER); |
| 142 Isolate* isolate = Isolate::Current(); | 143 Isolate* isolate = Isolate::Current(); |
| 143 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 144 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 144 STUB_CODE_LIST(STUB_CODE_TESTER); | 145 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 145 } | 146 } |
| 146 #undef STUB_CODE_TESTER | 147 #undef STUB_CODE_TESTER |
| 147 return NULL; | 148 return NULL; |
| 148 } | 149 } |
| 149 | 150 |
| 150 } // namespace dart | 151 } // namespace dart |
| OLD | NEW |