| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 void StubCode::Init(Isolate* isolate) { } | 75 void StubCode::Init(Isolate* isolate) { } |
| 76 | 76 |
| 77 | 77 |
| 78 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 78 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 bool StubCode::HasBeenInitialized() { | |
| 83 // Use JumpToExceptionHandler and InvokeDart as canaries. | |
| 84 const StubEntry* entry_1 = StubCode::JumpToExceptionHandler_entry(); | |
| 85 const StubEntry* entry_2 = StubCode::InvokeDartCode_entry(); | |
| 86 return (entry_1 != NULL) && (entry_2 != NULL); | |
| 87 } | |
| 88 | |
| 89 | |
| 90 bool StubCode::InInvocationStub(uword pc) { | 82 bool StubCode::InInvocationStub(uword pc) { |
| 91 ASSERT(HasBeenInitialized()); | |
| 92 uword entry = StubCode::InvokeDartCode_entry()->EntryPoint(); | 83 uword entry = StubCode::InvokeDartCode_entry()->EntryPoint(); |
| 93 uword size = StubCode::InvokeDartCodeSize(); | 84 uword size = StubCode::InvokeDartCodeSize(); |
| 94 return (pc >= entry) && (pc < (entry + size)); | 85 return (pc >= entry) && (pc < (entry + size)); |
| 95 } | 86 } |
| 96 | 87 |
| 97 | 88 |
| 98 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { | 89 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { |
| 99 ASSERT(HasBeenInitialized()); | |
| 100 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint(); | 90 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint(); |
| 101 uword size = StubCode::JumpToExceptionHandlerSize(); | 91 uword size = StubCode::JumpToExceptionHandlerSize(); |
| 102 return (pc >= entry) && (pc < (entry + size)); | 92 return (pc >= entry) && (pc < (entry + size)); |
| 103 } | 93 } |
| 104 | 94 |
| 105 | 95 |
| 106 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 96 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
| 107 Thread* thread = Thread::Current(); | 97 Thread* thread = Thread::Current(); |
| 108 Zone* zone = thread->zone(); | 98 Zone* zone = thread->zone(); |
| 109 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread)); | 99 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if ((name##_entry() != NULL) && \ | 162 if ((name##_entry() != NULL) && \ |
| 173 (entry_point == name##_entry()->EntryPoint())) { \ | 163 (entry_point == name##_entry()->EntryPoint())) { \ |
| 174 return ""#name; \ | 164 return ""#name; \ |
| 175 } | 165 } |
| 176 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); | 166 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
| 177 #undef VM_STUB_CODE_TESTER | 167 #undef VM_STUB_CODE_TESTER |
| 178 return NULL; | 168 return NULL; |
| 179 } | 169 } |
| 180 | 170 |
| 181 } // namespace dart | 171 } // namespace dart |
| OLD | NEW |