| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { | 89 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { |
| 90 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint(); | 90 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint(); |
| 91 uword size = StubCode::JumpToExceptionHandlerSize(); | 91 uword size = StubCode::JumpToExceptionHandlerSize(); |
| 92 return (pc >= entry) && (pc < (entry + size)); | 92 return (pc >= entry) && (pc < (entry + size)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 96 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
| 97 Thread* thread = Thread::Current(); | 97 Thread* thread = Thread::Current(); |
| 98 Isolate* isolate = thread->isolate(); | 98 Zone* zone = thread->zone(); |
| 99 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(thread)); | 99 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread)); |
| 100 ASSERT(error.IsNull()); | 100 ASSERT(error.IsNull()); |
| 101 if (cls.id() == kArrayCid) { | 101 if (cls.id() == kArrayCid) { |
| 102 return AllocateArray_entry()->code(); | 102 return AllocateArray_entry()->code(); |
| 103 } | 103 } |
| 104 Code& stub = Code::Handle(isolate, cls.allocation_stub()); | 104 Code& stub = Code::Handle(zone, cls.allocation_stub()); |
| 105 if (stub.IsNull()) { | 105 if (stub.IsNull()) { |
| 106 Assembler assembler; | 106 Assembler assembler; |
| 107 const char* name = cls.ToCString(); | 107 const char* name = cls.ToCString(); |
| 108 StubCode::GenerateAllocationStubForClass(&assembler, cls); | 108 StubCode::GenerateAllocationStubForClass(&assembler, cls); |
| 109 stub ^= Code::FinalizeCode(name, &assembler); | 109 stub ^= Code::FinalizeCode(name, &assembler); |
| 110 stub.set_owner(cls); | 110 stub.set_owner(cls); |
| 111 cls.set_allocation_stub(stub); | 111 cls.set_allocation_stub(stub); |
| 112 if (FLAG_disassemble_stubs) { | 112 if (FLAG_disassemble_stubs) { |
| 113 LogBlock lb; | 113 LogBlock lb; |
| 114 THR_Print("Code for allocation stub '%s': {\n", name); | 114 THR_Print("Code for allocation stub '%s': {\n", name); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if ((name##_entry() != NULL) && \ | 162 if ((name##_entry() != NULL) && \ |
| 163 (entry_point == name##_entry()->EntryPoint())) { \ | 163 (entry_point == name##_entry()->EntryPoint())) { \ |
| 164 return ""#name; \ | 164 return ""#name; \ |
| 165 } | 165 } |
| 166 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); | 166 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
| 167 #undef VM_STUB_CODE_TESTER | 167 #undef VM_STUB_CODE_TESTER |
| 168 return NULL; | 168 return NULL; |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace dart | 171 } // namespace dart |
| OLD | NEW |