| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef RUNTIME_VM_STUB_CODE_H_ | 5 #ifndef RUNTIME_VM_STUB_CODE_H_ |
| 6 #define RUNTIME_VM_STUB_CODE_H_ | 6 #define RUNTIME_VM_STUB_CODE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // Forward declarations. | 13 // Forward declarations. |
| 14 class Code; | 14 class Code; |
| 15 class Isolate; | 15 class Isolate; |
| 16 class ObjectPointerVisitor; | 16 class ObjectPointerVisitor; |
| 17 class RawCode; | 17 class RawCode; |
| 18 class SnapshotReader; | 18 class SnapshotReader; |
| 19 class SnapshotWriter; | 19 class SnapshotWriter; |
| 20 class Serializer; | 20 class Serializer; |
| 21 class Deserializer; | 21 class Deserializer; |
| 22 | 22 |
| 23 // List of stubs created in the VM isolate, these stubs are shared by different | 23 // List of stubs created in the VM isolate, these stubs are shared by different |
| 24 // isolates running in this dart process. | 24 // isolates running in this dart process. |
| 25 #if !defined(TARGET_ARCH_DBC) | 25 #if !defined(TARGET_ARCH_DBC) |
| 26 #define VM_STUB_CODE_LIST(V) \ | 26 #define VM_STUB_CODE_LIST(V) \ |
| 27 V(GetStackPointer) \ | 27 V(GetStackPointer) \ |
| 28 V(JumpToFrame) \ | 28 V(JumpToExceptionHandler) \ |
| 29 V(RunExceptionHandler) \ | |
| 30 V(UpdateStoreBuffer) \ | 29 V(UpdateStoreBuffer) \ |
| 31 V(PrintStopMessage) \ | 30 V(PrintStopMessage) \ |
| 32 V(CallToRuntime) \ | 31 V(CallToRuntime) \ |
| 33 V(LazyCompile) \ | 32 V(LazyCompile) \ |
| 34 V(CallBootstrapCFunction) \ | 33 V(CallBootstrapCFunction) \ |
| 35 V(CallNativeCFunction) \ | 34 V(CallNativeCFunction) \ |
| 36 V(FixCallersTarget) \ | 35 V(FixCallersTarget) \ |
| 37 V(CallStaticFunction) \ | 36 V(CallStaticFunction) \ |
| 38 V(OptimizeFunction) \ | 37 V(OptimizeFunction) \ |
| 39 V(InvokeDartCode) \ | 38 V(InvokeDartCode) \ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 V(Subtype1TestCache) \ | 66 V(Subtype1TestCache) \ |
| 68 V(Subtype2TestCache) \ | 67 V(Subtype2TestCache) \ |
| 69 V(Subtype3TestCache) \ | 68 V(Subtype3TestCache) \ |
| 70 V(CallClosureNoSuchMethod) \ | 69 V(CallClosureNoSuchMethod) \ |
| 71 V(FrameAwaitingMaterialization) | 70 V(FrameAwaitingMaterialization) |
| 72 | 71 |
| 73 #else | 72 #else |
| 74 #define VM_STUB_CODE_LIST(V) \ | 73 #define VM_STUB_CODE_LIST(V) \ |
| 75 V(LazyCompile) \ | 74 V(LazyCompile) \ |
| 76 V(OptimizeFunction) \ | 75 V(OptimizeFunction) \ |
| 77 V(RunExceptionHandler) \ | |
| 78 V(FixCallersTarget) \ | 76 V(FixCallersTarget) \ |
| 79 V(Deoptimize) \ | 77 V(Deoptimize) \ |
| 80 V(DeoptimizeLazyFromReturn) \ | 78 V(DeoptimizeLazyFromReturn) \ |
| 81 V(DeoptimizeLazyFromThrow) \ | 79 V(DeoptimizeLazyFromThrow) \ |
| 82 V(FrameAwaitingMaterialization) | 80 V(FrameAwaitingMaterialization) |
| 83 | 81 |
| 84 #endif // !defined(TARGET_ARCH_DBC) | 82 #endif // !defined(TARGET_ARCH_DBC) |
| 85 | 83 |
| 86 // Is it permitted for the stubs above to refer to Object::null(), which is | 84 // Is it permitted for the stubs above to refer to Object::null(), which is |
| 87 // allocated in the VM isolate and shared across all isolates. | 85 // allocated in the VM isolate and shared across all isolates. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 131 |
| 134 static void VisitObjectPointers(ObjectPointerVisitor* visitor); | 132 static void VisitObjectPointers(ObjectPointerVisitor* visitor); |
| 135 | 133 |
| 136 // Returns true if stub code has been initialized. | 134 // Returns true if stub code has been initialized. |
| 137 static bool HasBeenInitialized(); | 135 static bool HasBeenInitialized(); |
| 138 | 136 |
| 139 // Check if specified pc is in the dart invocation stub used for | 137 // Check if specified pc is in the dart invocation stub used for |
| 140 // transitioning into dart code. | 138 // transitioning into dart code. |
| 141 static bool InInvocationStub(uword pc); | 139 static bool InInvocationStub(uword pc); |
| 142 | 140 |
| 143 // Check if the specified pc is in the jump to frame stub. | 141 // Check if the specified pc is in the jump to exception handler stub. |
| 144 static bool InJumpToFrameStub(uword pc); | 142 static bool InJumpToExceptionHandlerStub(uword pc); |
| 145 | 143 |
| 146 // Returns NULL if no stub found. | 144 // Returns NULL if no stub found. |
| 147 static const char* NameOfStub(uword entry_point); | 145 static const char* NameOfStub(uword entry_point); |
| 148 | 146 |
| 149 // Define the shared stub code accessors. | 147 // Define the shared stub code accessors. |
| 150 #define STUB_CODE_ACCESSOR(name) \ | 148 #define STUB_CODE_ACCESSOR(name) \ |
| 151 static const StubEntry* name##_entry() { return name##_entry_; } \ | 149 static const StubEntry* name##_entry() { return name##_entry_; } \ |
| 152 static intptr_t name##Size() { return name##_entry()->Size(); } | 150 static intptr_t name##Size() { return name##_entry()->Size(); } |
| 153 VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR); | 151 VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR); |
| 154 #undef STUB_CODE_ACCESSOR | 152 #undef STUB_CODE_ACCESSOR |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 Register temp_reg); | 189 Register temp_reg); |
| 192 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); | 190 static void GenerateOptimizedUsageCounterIncrement(Assembler* assembler); |
| 193 }; | 191 }; |
| 194 | 192 |
| 195 | 193 |
| 196 enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt }; | 194 enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt }; |
| 197 | 195 |
| 198 } // namespace dart | 196 } // namespace dart |
| 199 | 197 |
| 200 #endif // RUNTIME_VM_STUB_CODE_H_ | 198 #endif // RUNTIME_VM_STUB_CODE_H_ |
| OLD | NEW |