OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 switch (type) { | 127 switch (type) { |
128 case StackFrame::NONE: return NULL; | 128 case StackFrame::NONE: return NULL; |
129 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) | 129 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE) |
130 default: break; | 130 default: break; |
131 } | 131 } |
132 return NULL; | 132 return NULL; |
133 | 133 |
134 #undef FRAME_TYPE_CASE | 134 #undef FRAME_TYPE_CASE |
135 } | 135 } |
136 | 136 |
| 137 |
137 // ------------------------------------------------------------------------- | 138 // ------------------------------------------------------------------------- |
138 | 139 |
139 JavaScriptFrameIterator::JavaScriptFrameIterator(Isolate* isolate, | 140 |
140 StackFrame::Id id) | 141 JavaScriptFrameIterator::JavaScriptFrameIterator( |
| 142 Isolate* isolate, StackFrame::Id id) |
141 : iterator_(isolate) { | 143 : iterator_(isolate) { |
142 while (!done()) { | 144 while (!done()) { |
143 Advance(); | 145 Advance(); |
144 if (frame()->id() == id) return; | 146 if (frame()->id() == id) return; |
145 } | 147 } |
146 } | 148 } |
147 | 149 |
148 | 150 |
149 void JavaScriptFrameIterator::Advance() { | 151 void JavaScriptFrameIterator::Advance() { |
150 do { | 152 do { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 439 |
438 Object* marker = | 440 Object* marker = |
439 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); | 441 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); |
440 if (code_obj != nullptr) { | 442 if (code_obj != nullptr) { |
441 switch (code_obj->kind()) { | 443 switch (code_obj->kind()) { |
442 case Code::FUNCTION: | 444 case Code::FUNCTION: |
443 return JAVA_SCRIPT; | 445 return JAVA_SCRIPT; |
444 case Code::OPTIMIZED_FUNCTION: | 446 case Code::OPTIMIZED_FUNCTION: |
445 return OPTIMIZED; | 447 return OPTIMIZED; |
446 case Code::WASM_FUNCTION: | 448 case Code::WASM_FUNCTION: |
447 return WASM; | 449 return STUB; |
448 case Code::BUILTIN: | 450 case Code::BUILTIN: |
449 if (!marker->IsSmi()) { | 451 if (!marker->IsSmi()) { |
450 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { | 452 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { |
451 // An adapter frame has a special SMI constant for the context and | 453 // An adapter frame has a special SMI constant for the context and |
452 // is not distinguished through the marker. | 454 // is not distinguished through the marker. |
453 return ARGUMENTS_ADAPTOR; | 455 return ARGUMENTS_ADAPTOR; |
454 } else { | 456 } else { |
455 // The interpreter entry trampoline has a non-SMI marker. | 457 // The interpreter entry trampoline has a non-SMI marker. |
456 DCHECK(code_obj->is_interpreter_entry_trampoline() || | 458 DCHECK(code_obj->is_interpreter_entry_trampoline() || |
457 code_obj->is_interpreter_enter_bytecode_dispatch()); | 459 code_obj->is_interpreter_enter_bytecode_dispatch()); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 return reinterpret_cast<Code*>(code); | 1215 return reinterpret_cast<Code*>(code); |
1214 } | 1216 } |
1215 | 1217 |
1216 | 1218 |
1217 void StackFrame::PrintIndex(StringStream* accumulator, | 1219 void StackFrame::PrintIndex(StringStream* accumulator, |
1218 PrintMode mode, | 1220 PrintMode mode, |
1219 int index) { | 1221 int index) { |
1220 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); | 1222 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); |
1221 } | 1223 } |
1222 | 1224 |
1223 void WasmFrame::Print(StringStream* accumulator, PrintMode mode, | |
1224 int index) const { | |
1225 accumulator->Add("wasm frame"); | |
1226 } | |
1227 | |
1228 Code* WasmFrame::unchecked_code() const { | |
1229 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | |
1230 } | |
1231 | |
1232 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | |
1233 | |
1234 Address WasmFrame::GetCallerStackPointer() const { | |
1235 return fp() + ExitFrameConstants::kCallerSPDisplacement; | |
1236 } | |
1237 | 1225 |
1238 namespace { | 1226 namespace { |
1239 | 1227 |
1240 | 1228 |
1241 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, | 1229 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
1242 Code* code) { | 1230 Code* code) { |
1243 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { | 1231 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
1244 std::ostringstream os; | 1232 std::ostringstream os; |
1245 os << "--------- s o u r c e c o d e ---------\n" | 1233 os << "--------- s o u r c e c o d e ---------\n" |
1246 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) | 1234 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1646 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1659 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1647 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1660 list.Add(frame, zone); | 1648 list.Add(frame, zone); |
1661 } | 1649 } |
1662 return list.ToVector(); | 1650 return list.ToVector(); |
1663 } | 1651 } |
1664 | 1652 |
1665 | 1653 |
1666 } // namespace internal | 1654 } // namespace internal |
1667 } // namespace v8 | 1655 } // namespace v8 |
OLD | NEW |