Chromium Code Reviews| 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 JavaScriptFrameIterator::JavaScriptFrameIterator(Isolate* isolate, |
| 138 // ------------------------------------------------------------------------- | 138 StackFrame::Id id) |
|
Michael Starzinger
2016/02/23 09:36:25
nit: Please bring back the separator comment.
JF
2016/02/23 16:00:53
Done.
| |
| 139 | |
| 140 | |
| 141 JavaScriptFrameIterator::JavaScriptFrameIterator( | |
| 142 Isolate* isolate, StackFrame::Id id) | |
| 143 : iterator_(isolate) { | 139 : iterator_(isolate) { |
| 144 while (!done()) { | 140 while (!done()) { |
| 145 Advance(); | 141 Advance(); |
| 146 if (frame()->id() == id) return; | 142 if (frame()->id() == id) return; |
| 147 } | 143 } |
| 148 } | 144 } |
| 149 | 145 |
| 150 | 146 |
| 151 void JavaScriptFrameIterator::Advance() { | 147 void JavaScriptFrameIterator::Advance() { |
| 152 do { | 148 do { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 | 435 |
| 440 Object* marker = | 436 Object* marker = |
| 441 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); | 437 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); |
| 442 if (code_obj != nullptr) { | 438 if (code_obj != nullptr) { |
| 443 switch (code_obj->kind()) { | 439 switch (code_obj->kind()) { |
| 444 case Code::FUNCTION: | 440 case Code::FUNCTION: |
| 445 return JAVA_SCRIPT; | 441 return JAVA_SCRIPT; |
| 446 case Code::OPTIMIZED_FUNCTION: | 442 case Code::OPTIMIZED_FUNCTION: |
| 447 return OPTIMIZED; | 443 return OPTIMIZED; |
| 448 case Code::WASM_FUNCTION: | 444 case Code::WASM_FUNCTION: |
| 449 return STUB; | 445 return WASM; |
| 450 case Code::BUILTIN: | 446 case Code::BUILTIN: |
| 451 if (!marker->IsSmi()) { | 447 if (!marker->IsSmi()) { |
| 452 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { | 448 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { |
| 453 // An adapter frame has a special SMI constant for the context and | 449 // An adapter frame has a special SMI constant for the context and |
| 454 // is not distinguished through the marker. | 450 // is not distinguished through the marker. |
| 455 return ARGUMENTS_ADAPTOR; | 451 return ARGUMENTS_ADAPTOR; |
| 456 } else { | 452 } else { |
| 457 // The interpreter entry trampoline has a non-SMI marker. | 453 // The interpreter entry trampoline has a non-SMI marker. |
| 458 DCHECK(code_obj->is_interpreter_entry_trampoline() || | 454 DCHECK(code_obj->is_interpreter_entry_trampoline() || |
| 459 code_obj->is_interpreter_enter_bytecode_dispatch()); | 455 code_obj->is_interpreter_enter_bytecode_dispatch()); |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1215 return reinterpret_cast<Code*>(code); | 1211 return reinterpret_cast<Code*>(code); |
| 1216 } | 1212 } |
| 1217 | 1213 |
| 1218 | 1214 |
| 1219 void StackFrame::PrintIndex(StringStream* accumulator, | 1215 void StackFrame::PrintIndex(StringStream* accumulator, |
| 1220 PrintMode mode, | 1216 PrintMode mode, |
| 1221 int index) { | 1217 int index) { |
| 1222 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); | 1218 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); |
| 1223 } | 1219 } |
| 1224 | 1220 |
| 1221 void WasmFrame::Print(StringStream* accumulator, PrintMode mode, | |
| 1222 int index) const {} | |
|
Michael Starzinger
2016/02/23 09:36:25
nit: Can we print something here? Just one single
JF
2016/02/23 16:00:53
Done.
| |
| 1223 | |
| 1224 Code* WasmFrame::unchecked_code() const { | |
| 1225 return static_cast<Code*>(isolate()->FindCodeObject(pc())); | |
| 1226 } | |
| 1227 | |
| 1228 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); } | |
| 1229 | |
| 1230 Address WasmFrame::GetCallerStackPointer() const { | |
| 1231 return fp() + ExitFrameConstants::kCallerSPDisplacement; | |
| 1232 } | |
| 1225 | 1233 |
| 1226 namespace { | 1234 namespace { |
| 1227 | 1235 |
| 1228 | 1236 |
| 1229 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, | 1237 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
| 1230 Code* code) { | 1238 Code* code) { |
| 1231 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { | 1239 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
| 1232 std::ostringstream os; | 1240 std::ostringstream os; |
| 1233 os << "--------- s o u r c e c o d e ---------\n" | 1241 os << "--------- s o u r c e c o d e ---------\n" |
| 1234 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) | 1242 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1646 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1654 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1647 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1655 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1648 list.Add(frame, zone); | 1656 list.Add(frame, zone); |
| 1649 } | 1657 } |
| 1650 return list.ToVector(); | 1658 return list.ToVector(); |
| 1651 } | 1659 } |
| 1652 | 1660 |
| 1653 | 1661 |
| 1654 } // namespace internal | 1662 } // namespace internal |
| 1655 } // namespace v8 | 1663 } // namespace v8 |
| OLD | NEW |