| 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 StubCode::GenerateAllocationStubForClass(&assembler, cls); | 121 uword patch_code_offset = |
| 122 StubCode::GenerateAllocationStubForClass(&assembler, cls); |
| 122 stub ^= Code::FinalizeCode(name, &assembler); | 123 stub ^= Code::FinalizeCode(name, &assembler); |
| 123 stub.set_owner(cls); | 124 stub.set_owner(cls); |
| 124 cls.set_allocation_stub(stub); | 125 cls.set_allocation_stub(stub); |
| 125 if (FLAG_disassemble_stubs) { | 126 if (FLAG_disassemble_stubs) { |
| 126 OS::Print("Code for allocation stub '%s': {\n", name); | 127 OS::Print("Code for allocation stub '%s': {\n", name); |
| 127 DisassembleToStdout formatter; | 128 DisassembleToStdout formatter; |
| 128 stub.Disassemble(&formatter); | 129 stub.Disassemble(&formatter); |
| 129 OS::Print("}\n"); | 130 OS::Print("}\n"); |
| 130 } | 131 } |
| 132 stub.set_entry_patch_pc_offset(0); |
| 133 stub.set_patch_code_pc_offset(patch_code_offset); |
| 131 } | 134 } |
| 132 return stub.raw(); | 135 return stub.raw(); |
| 133 } | 136 } |
| 134 | 137 |
| 135 | 138 |
| 136 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { | 139 uword StubCode::UnoptimizedStaticCallEntryPoint(intptr_t num_args_tested) { |
| 137 switch (num_args_tested) { | 140 switch (num_args_tested) { |
| 138 case 0: | 141 case 0: |
| 139 return ZeroArgsUnoptimizedStaticCallEntryPoint(); | 142 return ZeroArgsUnoptimizedStaticCallEntryPoint(); |
| 140 case 1: | 143 case 1: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 Isolate* isolate = Isolate::Current(); | 181 Isolate* isolate = Isolate::Current(); |
| 179 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 182 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 180 STUB_CODE_LIST(STUB_CODE_TESTER); | 183 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 181 } | 184 } |
| 182 #undef VM_STUB_CODE_TESTER | 185 #undef VM_STUB_CODE_TESTER |
| 183 #undef STUB_CODE_TESTER | 186 #undef STUB_CODE_TESTER |
| 184 return NULL; | 187 return NULL; |
| 185 } | 188 } |
| 186 | 189 |
| 187 } // namespace dart | 190 } // namespace dart |
| OLD | NEW |