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

Side by Side Diff: src/isolate.cc

Issue 1865553004: [wasm] Do also output WASM frames on detailed stack traces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@improve-asserts
Patch Set: Fix gcmole reported issue Created 4 years, 8 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.cc ('k') | no next file » | 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 constructor_key_ = factory()->InternalizeOneByteString( 540 constructor_key_ = factory()->InternalizeOneByteString(
541 STATIC_CHAR_VECTOR("isConstructor")); 541 STATIC_CHAR_VECTOR("isConstructor"));
542 } 542 }
543 } 543 }
544 544
545 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position, 545 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position,
546 bool is_constructor) { 546 bool is_constructor) {
547 Handle<JSObject> stack_frame = 547 Handle<JSObject> stack_frame =
548 factory()->NewJSObject(isolate_->object_function()); 548 factory()->NewJSObject(isolate_->object_function());
549 549
550 Handle<Script> script(Script::cast(fun->shared()->script())); 550 // TODO(clemensh): this can be changed to a DCHECK once also WASM frames
551 // define a script
552 if (!fun->shared()->script()->IsUndefined()) {
553 Handle<Script> script(Script::cast(fun->shared()->script()));
551 554
552 if (!line_key_.is_null()) { 555 if (!line_key_.is_null()) {
553 int script_line_offset = script->line_offset(); 556 int script_line_offset = script->line_offset();
554 int line_number = Script::GetLineNumber(script, position); 557 int line_number = Script::GetLineNumber(script, position);
555 // line_number is already shifted by the script_line_offset. 558 // line_number is already shifted by the script_line_offset.
556 int relative_line_number = line_number - script_line_offset; 559 int relative_line_number = line_number - script_line_offset;
557 if (!column_key_.is_null() && relative_line_number >= 0) { 560 if (!column_key_.is_null() && relative_line_number >= 0) {
558 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 561 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
559 int start = (relative_line_number == 0) ? 0 : 562 int start = (relative_line_number == 0)
560 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1; 563 ? 0
561 int column_offset = position - start; 564 : Smi::cast(line_ends->get(relative_line_number - 1))
562 if (relative_line_number == 0) { 565 ->value() +
563 // For the case where the code is on the same line as the script 566 1;
564 // tag. 567 int column_offset = position - start;
565 column_offset += script->column_offset(); 568 if (relative_line_number == 0) {
569 // For the case where the code is on the same line as the script
570 // tag.
571 column_offset += script->column_offset();
572 }
573 JSObject::AddProperty(
574 stack_frame, column_key_,
575 handle(Smi::FromInt(column_offset + 1), isolate_), NONE);
566 } 576 }
567 JSObject::AddProperty(stack_frame, column_key_, 577 JSObject::AddProperty(stack_frame, line_key_,
568 handle(Smi::FromInt(column_offset + 1), isolate_), 578 handle(Smi::FromInt(line_number + 1), isolate_),
569 NONE); 579 NONE);
570 } 580 }
571 JSObject::AddProperty(stack_frame, line_key_,
572 handle(Smi::FromInt(line_number + 1), isolate_),
573 NONE);
574 }
575 581
576 if (!script_id_key_.is_null()) { 582 if (!script_id_key_.is_null()) {
577 JSObject::AddProperty(stack_frame, script_id_key_, 583 JSObject::AddProperty(stack_frame, script_id_key_,
578 handle(Smi::FromInt(script->id()), isolate_), NONE); 584 handle(Smi::FromInt(script->id()), isolate_),
579 } 585 NONE);
586 }
580 587
581 if (!script_name_key_.is_null()) { 588 if (!script_name_key_.is_null()) {
582 JSObject::AddProperty(stack_frame, script_name_key_, 589 JSObject::AddProperty(stack_frame, script_name_key_,
583 handle(script->name(), isolate_), NONE); 590 handle(script->name(), isolate_), NONE);
584 } 591 }
585 592
586 if (!script_name_or_source_url_key_.is_null()) { 593 if (!script_name_or_source_url_key_.is_null()) {
587 Handle<Object> result = Script::GetNameOrSourceURL(script); 594 Handle<Object> result = Script::GetNameOrSourceURL(script);
588 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, 595 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_,
589 NONE); 596 result, NONE);
597 }
598
599 if (!eval_key_.is_null()) {
600 Handle<Object> is_eval = factory()->ToBoolean(
601 script->compilation_type() == Script::COMPILATION_TYPE_EVAL);
602 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE);
603 }
590 } 604 }
591 605
592 if (!function_key_.is_null()) { 606 if (!function_key_.is_null()) {
593 Handle<Object> fun_name = JSFunction::GetDebugName(fun); 607 Handle<Object> fun_name = JSFunction::GetDebugName(fun);
594 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); 608 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE);
595 } 609 }
596 610
597 if (!eval_key_.is_null()) {
598 Handle<Object> is_eval = factory()->ToBoolean(
599 script->compilation_type() == Script::COMPILATION_TYPE_EVAL);
600 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE);
601 }
602
603 if (!constructor_key_.is_null()) { 611 if (!constructor_key_.is_null()) {
604 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor); 612 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor);
605 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj, 613 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj,
606 NONE); 614 NONE);
607 } 615 }
608 616
609 return stack_frame; 617 return stack_frame;
610 } 618 }
611 619
612 private: 620 private:
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 // Then check whether this scope intercepts. 2987 // Then check whether this scope intercepts.
2980 if ((flag & intercept_mask_)) { 2988 if ((flag & intercept_mask_)) {
2981 intercepted_flags_ |= flag; 2989 intercepted_flags_ |= flag;
2982 return true; 2990 return true;
2983 } 2991 }
2984 return false; 2992 return false;
2985 } 2993 }
2986 2994
2987 } // namespace internal 2995 } // namespace internal
2988 } // namespace v8 2996 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698