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