| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 if (entry != NULL) { \ | 84 if (entry != NULL) { \ |
| 85 entry->VisitObjectPointers(visitor); \ | 85 entry->VisitObjectPointers(visitor); \ |
| 86 } | 86 } |
| 87 | 87 |
| 88 STUB_CODE_LIST(STUB_CODE_VISIT_OBJECT_POINTER); | 88 STUB_CODE_LIST(STUB_CODE_VISIT_OBJECT_POINTER); |
| 89 #undef STUB_CODE_VISIT_OBJECT_POINTER | 89 #undef STUB_CODE_VISIT_OBJECT_POINTER |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 bool StubCode::InInvocationStub(uword pc) { | 93 bool StubCode::InInvocationStub(uword pc) { |
| 94 return ((pc >= InvokeDartCodeEntryPoint()) && | 94 return InInvocationStubForIsolate(Isolate::Current(), pc); |
| 95 (pc < (InvokeDartCodeEntryPoint() + InvokeDartCodeSize()))); | |
| 96 } | 95 } |
| 97 | 96 |
| 98 | 97 |
| 98 bool StubCode::InInvocationStubForIsolate(Isolate* isolate, uword pc) { |
| 99 uword entry = isolate->stub_code()->InvokeDartCodeEntryPoint(); |
| 100 uword size = isolate->stub_code()->InvokeDartCodeSize(); |
| 101 return (pc >= entry) && (pc < (entry + size)); |
| 102 } |
| 103 |
| 104 |
| 99 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 105 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
| 100 Isolate* isolate = Isolate::Current(); | 106 Isolate* isolate = Isolate::Current(); |
| 101 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); | 107 const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate)); |
| 102 ASSERT(error.IsNull()); | 108 ASSERT(error.IsNull()); |
| 103 Code& stub = Code::Handle(isolate, cls.allocation_stub()); | 109 Code& stub = Code::Handle(isolate, cls.allocation_stub()); |
| 104 if (stub.IsNull()) { | 110 if (stub.IsNull()) { |
| 105 Assembler assembler; | 111 Assembler assembler; |
| 106 const char* name = cls.ToCString(); | 112 const char* name = cls.ToCString(); |
| 107 StubCode::GenerateAllocationStubForClass(&assembler, cls); | 113 StubCode::GenerateAllocationStubForClass(&assembler, cls); |
| 108 stub ^= Code::FinalizeCode(name, &assembler); | 114 stub ^= Code::FinalizeCode(name, &assembler); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 VM_STUB_CODE_LIST(STUB_CODE_TESTER); | 149 VM_STUB_CODE_LIST(STUB_CODE_TESTER); |
| 144 Isolate* isolate = Isolate::Current(); | 150 Isolate* isolate = Isolate::Current(); |
| 145 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { | 151 if ((isolate != NULL) && (isolate->stub_code() != NULL)) { |
| 146 STUB_CODE_LIST(STUB_CODE_TESTER); | 152 STUB_CODE_LIST(STUB_CODE_TESTER); |
| 147 } | 153 } |
| 148 #undef STUB_CODE_TESTER | 154 #undef STUB_CODE_TESTER |
| 149 return NULL; | 155 return NULL; |
| 150 } | 156 } |
| 151 | 157 |
| 152 } // namespace dart | 158 } // namespace dart |
| OLD | NEW |