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 | 84 |
85 | 85 |
86 void StubCode::Init(Isolate* isolate) {} | 86 void StubCode::Init(Isolate* isolate) {} |
87 | 87 |
88 | 88 |
89 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {} | 89 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {} |
90 | 90 |
91 | 91 |
92 bool StubCode::HasBeenInitialized() { | 92 bool StubCode::HasBeenInitialized() { |
93 #if !defined(TARGET_ARCH_DBC) | 93 #if !defined(TARGET_ARCH_DBC) |
94 // Use JumpToHandler and InvokeDart as canaries. | 94 // Use JumpToExceptionHandler and InvokeDart as canaries. |
95 const StubEntry* entry_1 = StubCode::JumpToFrame_entry(); | 95 const StubEntry* entry_1 = StubCode::JumpToExceptionHandler_entry(); |
96 const StubEntry* entry_2 = StubCode::InvokeDartCode_entry(); | 96 const StubEntry* entry_2 = StubCode::InvokeDartCode_entry(); |
97 return (entry_1 != NULL) && (entry_2 != NULL); | 97 return (entry_1 != NULL) && (entry_2 != NULL); |
98 #else | 98 #else |
99 return true; | 99 return true; |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 bool StubCode::InInvocationStub(uword pc) { | 104 bool StubCode::InInvocationStub(uword pc) { |
105 #if !defined(TARGET_ARCH_DBC) | 105 #if !defined(TARGET_ARCH_DBC) |
106 ASSERT(HasBeenInitialized()); | 106 ASSERT(HasBeenInitialized()); |
107 uword entry = StubCode::InvokeDartCode_entry()->EntryPoint(); | 107 uword entry = StubCode::InvokeDartCode_entry()->EntryPoint(); |
108 uword size = StubCode::InvokeDartCodeSize(); | 108 uword size = StubCode::InvokeDartCodeSize(); |
109 return (pc >= entry) && (pc < (entry + size)); | 109 return (pc >= entry) && (pc < (entry + size)); |
110 #else | 110 #else |
111 // On DBC we use a special marker PC to signify entry frame because there is | 111 // On DBC we use a special marker PC to signify entry frame because there is |
112 // no such thing as invocation stub. | 112 // no such thing as invocation stub. |
113 return (pc & 2) != 0; | 113 return (pc & 2) != 0; |
114 #endif | 114 #endif |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 bool StubCode::InJumpToFrameStub(uword pc) { | 118 bool StubCode::InJumpToExceptionHandlerStub(uword pc) { |
119 #if !defined(TARGET_ARCH_DBC) | 119 #if !defined(TARGET_ARCH_DBC) |
120 ASSERT(HasBeenInitialized()); | 120 ASSERT(HasBeenInitialized()); |
121 uword entry = StubCode::JumpToFrame_entry()->EntryPoint(); | 121 uword entry = StubCode::JumpToExceptionHandler_entry()->EntryPoint(); |
122 uword size = StubCode::JumpToFrameSize(); | 122 uword size = StubCode::JumpToExceptionHandlerSize(); |
123 return (pc >= entry) && (pc < (entry + size)); | 123 return (pc >= entry) && (pc < (entry + size)); |
124 #else | 124 #else |
125 // This stub does not exist on DBC. | 125 // This stub does not exist on DBC. |
126 return false; | 126 return false; |
127 #endif | 127 #endif |
128 } | 128 } |
129 | 129 |
130 | 130 |
131 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { | 131 RawCode* StubCode::GetAllocationStubForClass(const Class& cls) { |
132 // These stubs are not used by DBC. | 132 // These stubs are not used by DBC. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if ((name##_entry() != NULL) && \ | 244 if ((name##_entry() != NULL) && \ |
245 (entry_point == name##_entry()->EntryPoint())) { \ | 245 (entry_point == name##_entry()->EntryPoint())) { \ |
246 return "" #name; \ | 246 return "" #name; \ |
247 } | 247 } |
248 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); | 248 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); |
249 #undef VM_STUB_CODE_TESTER | 249 #undef VM_STUB_CODE_TESTER |
250 return NULL; | 250 return NULL; |
251 } | 251 } |
252 | 252 |
253 } // namespace dart | 253 } // namespace dart |
OLD | NEW |