| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 | 112 |
| 113 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 113 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
| 114 Isolate* isolate = Isolate::Current(); | 114 Isolate* isolate = Isolate::Current(); |
| 115 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); | 115 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); |
| 116 ASSERT(error.IsNull()); | 116 ASSERT(error.IsNull()); |
| 117 Code& stub = Code::Handle(isolate, cls.allocation_stub()); | 117 Code& stub = Code::Handle(isolate, cls.allocation_stub()); |
| 118 if (stub.IsNull()) { | 118 if (stub.IsNull()) { |
| 119 Assembler assembler; | 119 Assembler assembler; |
| 120 const char* name = cls.ToCString(); | 120 const char* name = cls.ToCString(); |
| 121 uword patch_code_offset = | 121 uword patch_code_offset = 0; |
| 122 StubCode::GenerateAllocationStubForClass(&assembler, cls); | 122 uword entry_patch_offset = 0; |
| 123 StubCode::GenerateAllocationStubForClass( |
| 124 &assembler, cls, &entry_patch_offset, &patch_code_offset); |
| 123 stub ^= Code::FinalizeCode(name, &assembler); | 125 stub ^= Code::FinalizeCode(name, &assembler); |
| 124 stub.set_owner(cls); | 126 stub.set_owner(cls); |
| 125 cls.set_allocation_stub(stub); | 127 cls.set_allocation_stub(stub); |
| 126 if (FLAG_disassemble_stubs) { | 128 if (FLAG_disassemble_stubs) { |
| 127 OS::Print("Code for allocation stub '%s': {\n", name); | 129 OS::Print("Code for allocation stub '%s': {\n", name); |
| 128 DisassembleToStdout formatter; | 130 DisassembleToStdout formatter; |
| 129 stub.Disassemble(&formatter); | 131 stub.Disassemble(&formatter); |
| 130 OS::Print("}\n"); | 132 OS::Print("}\n"); |
| 131 } | 133 } |
| 132 stub.set_entry_patch_pc_offset(0); | 134 stub.set_entry_patch_pc_offset(entry_patch_offset); |
| 133 stub.set_patch_code_pc_offset(patch_code_offset); | 135 stub.set_patch_code_pc_offset(patch_code_offset); |
| 134 } | 136 } |
| 135 return stub.raw(); | 137 return stub.raw(); |
| 136 } | 138 } |
| 137 | 139 |
| 138 | 140 |
| 139 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { | 141 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { |
| 140 switch (num_args_tested) { | 142 switch (num_args_tested) { |
| 141 case 0: | 143 case 0: |
| 142 return ZeroArgsUnoptimizedStaticCallEntryPoint(); | 144 return ZeroArgsUnoptimizedStaticCallEntryPoint(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 Isolate* isolate = Isolate::Current(); | 183 Isolate* isolate = Isolate::Current(); |
| 182 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 184 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 183 STUB_CODE_LIST(STUB_CODE_TESTER); | 185 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 184 } | 186 } |
| 185 #undef VM_STUB_CODE_TESTER | 187 #undef VM_STUB_CODE_TESTER |
| 186 #undef STUB_CODE_TESTER | 188 #undef STUB_CODE_TESTER |
| 187 return NULL; | 189 return NULL; |
| 188 } | 190 } |
| 189 | 191 |
| 190 } // namespace dart | 192 } // namespace dart |
| OLD | NEW |