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/stack_frame.h" | 5 #include "vm/stack_frame.h" |
6 | 6 |
7 #include "platform/memory_sanitizer.h" | 7 #include "platform/memory_sanitizer.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/deopt_instructions.h" | 9 #include "vm/deopt_instructions.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 | 22 |
23 bool StackFrame::IsStubFrame() const { | 23 bool StackFrame::IsStubFrame() const { |
24 ASSERT(!(IsEntryFrame() || IsExitFrame())); | 24 ASSERT(!(IsEntryFrame() || IsExitFrame())); |
25 #if !defined(TARGET_OS_WINDOWS) | 25 #if !defined(TARGET_OS_WINDOWS) |
26 // On Windows, the profiler calls this from a separate thread where | 26 // On Windows, the profiler calls this from a separate thread where |
27 // Thread::Current() is NULL, so we cannot create a NoSafepointScope. | 27 // Thread::Current() is NULL, so we cannot create a NoSafepointScope. |
28 NoSafepointScope no_safepoint; | 28 NoSafepointScope no_safepoint; |
29 #endif | 29 #endif |
30 RawCode* code = GetCodeObject(); | 30 RawCode* code = GetCodeObject(); |
| 31 ASSERT(code != Object::null()); |
31 const intptr_t cid = code->ptr()->owner_->GetClassId(); | 32 const intptr_t cid = code->ptr()->owner_->GetClassId(); |
32 ASSERT(cid == kNullCid || cid == kClassCid || cid == kFunctionCid); | 33 ASSERT(cid == kNullCid || cid == kClassCid || cid == kFunctionCid); |
33 return cid == kNullCid || cid == kClassCid; | 34 return cid == kNullCid || cid == kClassCid; |
34 } | 35 } |
35 | 36 |
36 | 37 |
37 const char* StackFrame::ToCString() const { | 38 const char* StackFrame::ToCString() const { |
38 ASSERT(thread_ == Thread::Current()); | 39 ASSERT(thread_ == Thread::Current()); |
39 Zone* zone = Thread::Current()->zone(); | 40 Zone* zone = Thread::Current()->zone(); |
40 if (IsDartFrame()) { | 41 if (IsDartFrame()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 if (!code.IsNull()) { | 94 if (!code.IsNull()) { |
94 // Visit the code object. | 95 // Visit the code object. |
95 RawObject* raw_code = code.raw(); | 96 RawObject* raw_code = code.raw(); |
96 visitor->VisitPointer(&raw_code); | 97 visitor->VisitPointer(&raw_code); |
97 | 98 |
98 // Optimized frames have a stack map. We need to visit the frame based | 99 // Optimized frames have a stack map. We need to visit the frame based |
99 // on the stack map. | 100 // on the stack map. |
100 Array maps; | 101 Array maps; |
101 maps = Array::null(); | 102 maps = Array::null(); |
102 Stackmap map; | 103 Stackmap map; |
103 const uword entry = reinterpret_cast<uword>(code.instructions()->ptr()) + | 104 const uword entry = code.EntryPoint(); |
104 Instructions::HeaderSize(); | |
105 map = code.GetStackmap(pc() - entry, &maps, &map); | 105 map = code.GetStackmap(pc() - entry, &maps, &map); |
106 if (!map.IsNull()) { | 106 if (!map.IsNull()) { |
107 RawObject** first = reinterpret_cast<RawObject**>(sp()); | 107 RawObject** first = reinterpret_cast<RawObject**>(sp()); |
108 RawObject** last = reinterpret_cast<RawObject**>( | 108 RawObject** last = reinterpret_cast<RawObject**>( |
109 fp() + (kFirstLocalSlotFromFp * kWordSize)); | 109 fp() + (kFirstLocalSlotFromFp * kWordSize)); |
110 | 110 |
111 // A stack map is present in the code object, use the stack map to | 111 // A stack map is present in the code object, use the stack map to |
112 // visit frame slots which are marked as having objects. | 112 // visit frame slots which are marked as having objects. |
113 // | 113 // |
114 // The layout of the frame is (lower addresses to the right): | 114 // The layout of the frame is (lower addresses to the right): |
(...skipping 28 matching lines...) Expand all Loading... |
143 visitor->VisitPointers(first, last); | 143 visitor->VisitPointers(first, last); |
144 | 144 |
145 // Now visit other slots which might be part of the calling convention. | 145 // Now visit other slots which might be part of the calling convention. |
146 first = reinterpret_cast<RawObject**>( | 146 first = reinterpret_cast<RawObject**>( |
147 fp() + ((kFirstLocalSlotFromFp + 1) * kWordSize)); | 147 fp() + ((kFirstLocalSlotFromFp + 1) * kWordSize)); |
148 last = reinterpret_cast<RawObject**>( | 148 last = reinterpret_cast<RawObject**>( |
149 fp() + (kFirstObjectSlotFromFp * kWordSize)); | 149 fp() + (kFirstObjectSlotFromFp * kWordSize)); |
150 visitor->VisitPointers(first, last); | 150 visitor->VisitPointers(first, last); |
151 return; | 151 return; |
152 } | 152 } |
| 153 |
| 154 // No stack map, fall through. |
153 } | 155 } |
154 // For normal unoptimized Dart frames and Stub frames each slot | 156 // For normal unoptimized Dart frames and Stub frames each slot |
155 // between the first and last included are tagged objects. | 157 // between the first and last included are tagged objects. |
156 RawObject** first = reinterpret_cast<RawObject**>(sp()); | 158 RawObject** first = reinterpret_cast<RawObject**>(sp()); |
157 RawObject** last = reinterpret_cast<RawObject**>( | 159 RawObject** last = reinterpret_cast<RawObject**>( |
158 fp() + (kFirstObjectSlotFromFp * kWordSize)); | 160 fp() + (kFirstObjectSlotFromFp * kWordSize)); |
159 visitor->VisitPointers(first, last); | 161 visitor->VisitPointers(first, last); |
160 } | 162 } |
161 | 163 |
162 | 164 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 492 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
491 return (index - num_materializations_); | 493 return (index - num_materializations_); |
492 } | 494 } |
493 } | 495 } |
494 UNREACHABLE(); | 496 UNREACHABLE(); |
495 return 0; | 497 return 0; |
496 } | 498 } |
497 | 499 |
498 | 500 |
499 } // namespace dart | 501 } // namespace dart |
OLD | NEW |