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 VM_STACK_FRAME_H_ | 5 #ifndef VM_STACK_FRAME_H_ |
6 #define VM_STACK_FRAME_H_ | 6 #define VM_STACK_FRAME_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/stub_code.h" | 10 #include "vm/stub_code.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // The pool pointer is not implemented on all architectures. | 45 // The pool pointer is not implemented on all architectures. |
46 static int SavedCallerPpSlotFromFp() { | 46 static int SavedCallerPpSlotFromFp() { |
47 if (kSavedCallerPpSlotFromFp != kSavedCallerFpSlotFromFp) { | 47 if (kSavedCallerPpSlotFromFp != kSavedCallerFpSlotFromFp) { |
48 return kSavedCallerPpSlotFromFp; | 48 return kSavedCallerPpSlotFromFp; |
49 } | 49 } |
50 UNREACHABLE(); | 50 UNREACHABLE(); |
51 return 0; | 51 return 0; |
52 } | 52 } |
53 | 53 |
| 54 uword IsMarkedForLazyDeopt() const { |
| 55 uword raw_pc = *reinterpret_cast<uword*>( |
| 56 sp() + (kSavedPcSlotFromSp * kWordSize)); |
| 57 return raw_pc == StubCode::DeoptimizeLazyFromReturn_entry()->EntryPoint(); |
| 58 } |
| 59 void MarkForLazyDeopt() { |
| 60 set_pc(StubCode::DeoptimizeLazyFromReturn_entry()->EntryPoint()); |
| 61 } |
| 62 void UnmarkForLazyDeopt() { |
| 63 // If this frame was marked for lazy deopt, pc_ was computed to be the |
| 64 // original return address using the pending deopts table in GetCallerPc. |
| 65 // Write this value back into the frame. |
| 66 uword original_pc = pc(); |
| 67 ASSERT(original_pc != |
| 68 StubCode::DeoptimizeLazyFromReturn_entry()->EntryPoint()); |
| 69 set_pc(original_pc); |
| 70 } |
| 71 |
54 void set_pc(uword value) { | 72 void set_pc(uword value) { |
55 *reinterpret_cast<uword*>(sp() + (kSavedPcSlotFromSp * kWordSize)) = value; | 73 *reinterpret_cast<uword*>(sp() + (kSavedPcSlotFromSp * kWordSize)) = value; |
56 pc_ = value; | 74 pc_ = value; |
57 } | 75 } |
58 | 76 |
59 void set_pc_marker(RawCode* code) { | 77 void set_pc_marker(RawCode* code) { |
60 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = | 78 *reinterpret_cast<RawCode**>(fp() + (kPcMarkerSlotFromFp * kWordSize)) = |
61 code; | 79 code; |
62 } | 80 } |
63 | 81 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 TypedData& deopt_info_; | 373 TypedData& deopt_info_; |
356 Function& function_; | 374 Function& function_; |
357 uword pc_; | 375 uword pc_; |
358 GrowableArray<DeoptInstr*> deopt_instructions_; | 376 GrowableArray<DeoptInstr*> deopt_instructions_; |
359 ObjectPool& object_table_; | 377 ObjectPool& object_table_; |
360 | 378 |
361 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator); | 379 DISALLOW_COPY_AND_ASSIGN(InlinedFunctionsIterator); |
362 }; | 380 }; |
363 | 381 |
364 | 382 |
| 383 #if defined(DEBUG) |
| 384 void ValidateFrames(); |
| 385 #endif |
| 386 |
| 387 |
365 #if !defined(TARGET_ARCH_DBC) | 388 #if !defined(TARGET_ARCH_DBC) |
366 DART_FORCE_INLINE static intptr_t LocalVarIndex(intptr_t fp_offset, | 389 DART_FORCE_INLINE static intptr_t LocalVarIndex(intptr_t fp_offset, |
367 intptr_t var_index) { | 390 intptr_t var_index) { |
368 return fp_offset + var_index; | 391 return fp_offset + var_index; |
369 } | 392 } |
370 | 393 |
371 | 394 |
372 DART_FORCE_INLINE static uword ParamAddress(uword fp, intptr_t reverse_index) { | 395 DART_FORCE_INLINE static uword ParamAddress(uword fp, intptr_t reverse_index) { |
373 return fp + (kParamEndSlotFromFp * kWordSize) + (reverse_index * kWordSize); | 396 return fp + (kParamEndSlotFromFp * kWordSize) + (reverse_index * kWordSize); |
374 } | 397 } |
(...skipping 11 matching lines...) Expand all Loading... |
386 | 409 |
387 | 410 |
388 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { | 411 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { |
389 return fp + LocalVarIndex(0, index) * kWordSize; | 412 return fp + LocalVarIndex(0, index) * kWordSize; |
390 } | 413 } |
391 | 414 |
392 | 415 |
393 } // namespace dart | 416 } // namespace dart |
394 | 417 |
395 #endif // VM_STACK_FRAME_H_ | 418 #endif // VM_STACK_FRAME_H_ |
OLD | NEW |