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

Side by Side Diff: src/isolate.cc

Issue 2493943002: [wasm] Make reported "lines" on stack frames 1-based (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | « no previous file | test/cctest/wasm/test-wasm-stack.cc » ('j') | no next file with comments »
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/isolate.h" 5 #include "src/isolate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <fstream> // NOLINT(readability/streams) 9 #include <fstream> // NOLINT(readability/streams)
10 #include <sstream> 10 #include <sstream>
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { 699 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) {
700 Handle<JSObject> stack_frame = 700 Handle<JSObject> stack_frame =
701 factory()->NewJSObject(isolate_->object_function()); 701 factory()->NewJSObject(isolate_->object_function());
702 702
703 if (!function_key_.is_null()) { 703 if (!function_key_.is_null()) {
704 Handle<String> name = wasm::GetWasmFunctionName( 704 Handle<String> name = wasm::GetWasmFunctionName(
705 isolate_, handle(frame->wasm_instance(), isolate_), 705 isolate_, handle(frame->wasm_instance(), isolate_),
706 frame->function_index()); 706 frame->function_index());
707 JSObject::AddProperty(stack_frame, function_key_, name, NONE); 707 JSObject::AddProperty(stack_frame, function_key_, name, NONE);
708 } 708 }
709 // Encode the function index as line number. 709 // Encode the function index as line number (1-based).
710 if (!line_key_.is_null()) { 710 if (!line_key_.is_null()) {
711 JSObject::AddProperty( 711 JSObject::AddProperty(
712 stack_frame, line_key_, 712 stack_frame, line_key_,
713 isolate_->factory()->NewNumberFromInt(frame->function_index()), NONE); 713 isolate_->factory()->NewNumberFromInt(frame->function_index() + 1),
714 NONE);
714 } 715 }
715 // Encode the byte offset as column. 716 // Encode the byte offset as column (1-based).
716 if (!column_key_.is_null()) { 717 if (!column_key_.is_null()) {
717 Code* code = frame->LookupCode(); 718 Code* code = frame->LookupCode();
718 int offset = static_cast<int>(frame->pc() - code->instruction_start()); 719 int offset = static_cast<int>(frame->pc() - code->instruction_start());
719 int position = AbstractCode::cast(code)->SourcePosition(offset); 720 int position = AbstractCode::cast(code)->SourcePosition(offset);
720 // Make position 1-based. 721 // Make position 1-based.
721 if (position >= 0) ++position; 722 if (position >= 0) ++position;
722 JSObject::AddProperty(stack_frame, column_key_, 723 JSObject::AddProperty(stack_frame, column_key_,
723 isolate_->factory()->NewNumberFromInt(position), 724 isolate_->factory()->NewNumberFromInt(position),
724 NONE); 725 NONE);
725 } 726 }
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 // Then check whether this scope intercepts. 3489 // Then check whether this scope intercepts.
3489 if ((flag & intercept_mask_)) { 3490 if ((flag & intercept_mask_)) {
3490 intercepted_flags_ |= flag; 3491 intercepted_flags_ |= flag;
3491 return true; 3492 return true;
3492 } 3493 }
3493 return false; 3494 return false;
3494 } 3495 }
3495 3496
3496 } // namespace internal 3497 } // namespace internal
3497 } // namespace v8 3498 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/wasm/test-wasm-stack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698