Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 #ifndef VM_STACK_FRAME_DBC_H_ | |
| 6 #define VM_STACK_FRAME_DBC_H_ | |
| 7 | |
| 8 namespace dart { | |
| 9 | |
| 10 /* DBC Frame Layout | |
| 11 | |
| 12 IMPORTANT: On DBC stack is growing upwards which is different from all other | |
| 13 architectures. This enables effecient addressing for locals via unsigned index. | |
| 14 | |
| 15 | | <- TOS | |
| 16 Callee frame | ... | | |
| 17 | saved FP | (FP of current frame) | |
| 18 | saved PC | (PC of current frame) | |
| 19 | code object | | |
| 20 | function object | | |
| 21 +--------------------+ | |
| 22 Current frame | ... T| <- SP of current frame | |
| 23 | ... T| | |
| 24 | first local T| <- FP of current frame | |
| 25 | caller's FP *| | |
| 26 | caller's PC *| | |
| 27 | code object T| (current frame's code object) | |
| 28 | function object T| (current frame's function object) | |
| 29 +--------------------+ | |
| 30 Caller frame | last parameter | <- SP of caller frame | |
| 31 | ... | | |
| 32 | |
| 33 T against a slot indicates it needs to be traversed during GC. | |
| 34 * against a slot indicates that is can be traversed during GC | |
|
zra
2016/04/08 22:37:35
that *it* can be
Vyacheslav Egorov (Google)
2016/04/11 10:49:11
Done.
| |
| 35 because it will look like a smi to the visitor. | |
| 36 */ | |
| 37 | |
| 38 static const int kDartFrameFixedSize = 4; // Function, Code, PC, FP | |
| 39 static const int kSavedPcSlotFromSp = 3; | |
| 40 | |
| 41 static const int kFirstObjectSlotFromFp = -4; // Used by GC to traverse stack. | |
| 42 | |
| 43 static const int kSavedCallerFpSlotFromFp = -1; | |
| 44 static const int kSavedCallerPpSlotFromFp = kSavedCallerFpSlotFromFp; | |
| 45 static const int kSavedCallerPcSlotFromFp = -2; | |
| 46 static const int kCallerSpSlotFromFp = -kDartFrameFixedSize-1; | |
| 47 static const int kPcMarkerSlotFromFp = -3; | |
| 48 static const int kFunctionSlotFromFp = -4; | |
| 49 | |
| 50 // Note: These constants don't match actual DBC behavior. This is done because | |
| 51 // setting kFirstLocalSlotFromFp to 0 breaks assumptions spread across the code. | |
| 52 // Instead for the purposes of local variable allocation we pretend that DBC | |
| 53 // behaves as other architectures (stack growing downwards) and later fix | |
| 54 // this indices during code generate in the backend. | |
|
zra
2016/04/08 22:37:35
these ... generation
Vyacheslav Egorov (Google)
2016/04/11 10:49:11
Done.
| |
| 55 static const int kParamEndSlotFromFp = 4; // One slot past last parameter. | |
| 56 static const int kFirstLocalSlotFromFp = -1; | |
| 57 | |
| 58 | |
| 59 DART_FORCE_INLINE static uword LocalVarAddress(uword fp, intptr_t index) { | |
| 60 ASSERT(index != 0); | |
| 61 if (index > 0) { | |
| 62 return fp - index * kWordSize; | |
| 63 } else { | |
| 64 return fp - (index + 1) * kWordSize; | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 DART_FORCE_INLINE static uword ParamAddress(uword fp, intptr_t reverse_index) { | |
| 69 return fp - (kDartFrameFixedSize + reverse_index) * kWordSize; | |
| 70 } | |
| 71 | |
| 72 DART_FORCE_INLINE static bool IsCalleeFrameOf(uword fp, uword other_fp) { | |
| 73 return other_fp > fp; | |
| 74 } | |
| 75 | |
| 76 static const int kExitLinkSlotFromEntryFp = 0; | |
| 77 | |
| 78 } // namespace dart | |
| 79 | |
| 80 #endif // VM_STACK_FRAME_DBC_H_ | |
| OLD | NEW |