Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/frames.cc

Issue 1712003003: Add WasmFrame, backtraces reflect wasm's presence (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | src/isolate.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
140 void VisibleFrameIterator::Advance() {
141 do {
142 iterator_.Advance();
143 } while (!iterator_.done() && !iterator_.frame()->is_visible());
144 }
140 145
141 JavaScriptFrameIterator::JavaScriptFrameIterator( 146 // -------------------------------------------------------------------------
142 Isolate* isolate, StackFrame::Id id) 147
143 : iterator_(isolate) { 148 JavaScriptFrameIterator::JavaScriptFrameIterator(Isolate* isolate,
149 StackFrame::Id id)
150 : VisibleFrameIterator(isolate) {
144 while (!done()) { 151 while (!done()) {
145 Advance(); 152 Advance();
146 if (frame()->id() == id) return; 153 if (frame()->id() == id) return;
147 } 154 }
148 } 155 }
149 156
150 157
151 void JavaScriptFrameIterator::Advance() { 158 void JavaScriptFrameIterator::Advance() {
152 do { 159 do {
153 iterator_.Advance(); 160 iterator_.Advance();
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 446
440 Object* marker = 447 Object* marker =
441 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset); 448 Memory::Object_at(state->fp + StandardFrameConstants::kMarkerOffset);
442 if (code_obj != nullptr) { 449 if (code_obj != nullptr) {
443 switch (code_obj->kind()) { 450 switch (code_obj->kind()) {
444 case Code::FUNCTION: 451 case Code::FUNCTION:
445 return JAVA_SCRIPT; 452 return JAVA_SCRIPT;
446 case Code::OPTIMIZED_FUNCTION: 453 case Code::OPTIMIZED_FUNCTION:
447 return OPTIMIZED; 454 return OPTIMIZED;
448 case Code::WASM_FUNCTION: 455 case Code::WASM_FUNCTION:
449 return STUB; 456 return WASM;
450 case Code::BUILTIN: 457 case Code::BUILTIN:
451 if (!marker->IsSmi()) { 458 if (!marker->IsSmi()) {
452 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { 459 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
453 // An adapter frame has a special SMI constant for the context and 460 // An adapter frame has a special SMI constant for the context and
454 // is not distinguished through the marker. 461 // is not distinguished through the marker.
455 return ARGUMENTS_ADAPTOR; 462 return ARGUMENTS_ADAPTOR;
456 } else { 463 } else {
457 // The interpreter entry trampoline has a non-SMI marker. 464 // The interpreter entry trampoline has a non-SMI marker.
458 DCHECK(code_obj->is_interpreter_entry_trampoline() || 465 DCHECK(code_obj->is_interpreter_entry_trampoline() ||
459 code_obj->is_interpreter_enter_bytecode_dispatch()); 466 code_obj->is_interpreter_enter_bytecode_dispatch());
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 return reinterpret_cast<Code*>(code); 1222 return reinterpret_cast<Code*>(code);
1216 } 1223 }
1217 1224
1218 1225
1219 void StackFrame::PrintIndex(StringStream* accumulator, 1226 void StackFrame::PrintIndex(StringStream* accumulator,
1220 PrintMode mode, 1227 PrintMode mode,
1221 int index) { 1228 int index) {
1222 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index); 1229 accumulator->Add((mode == OVERVIEW) ? "%5d: " : "[%d]: ", index);
1223 } 1230 }
1224 1231
1232 void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
1233 int index) const {}
1234
1235 Code* WasmFrame::unchecked_code() const {
1236 return static_cast<Code*>(isolate()->FindCodeObject(pc()));
1237 }
1238
1239 void WasmFrame::Iterate(ObjectVisitor* v) const { IterateCompiledFrame(v); }
1240
1241 void WasmFrame::Summarize(List<FrameSummary>* frames) {
1242 DCHECK(frames->length() == 0);
1243 // TODO(jfb) Do something useful.
1244 Object* object = Object::cast(*Handle<Object>::null());
1245 JSFunction* jsfunction = JSFunction::cast(*Handle<JSFunction>::null());
1246 Code* code = LookupCode();
1247 DCHECK(code->is_wasm_code());
1248 unsigned code_offset = 0;
1249 bool is_constructor = false;
1250 FrameSummary summary(object, jsfunction, AbstractCode::cast(code),
1251 code_offset, is_constructor);
1252 frames->Add(summary);
1253 }
1254
1255 Address WasmFrame::GetCallerStackPointer() const {
1256 return fp() + ExitFrameConstants::kCallerSPDisplacement;
1257 }
1225 1258
1226 namespace { 1259 namespace {
1227 1260
1228 1261
1229 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, 1262 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared,
1230 Code* code) { 1263 Code* code) {
1231 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { 1264 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
1232 std::ostringstream os; 1265 std::ostringstream os;
1233 os << "--------- s o u r c e c o d e ---------\n" 1266 os << "--------- s o u r c e c o d e ---------\n"
1234 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) 1267 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1679 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1647 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1680 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1648 list.Add(frame, zone); 1681 list.Add(frame, zone);
1649 } 1682 }
1650 return list.ToVector(); 1683 return list.ToVector();
1651 } 1684 }
1652 1685
1653 1686
1654 } // namespace internal 1687 } // namespace internal
1655 } // namespace v8 1688 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698