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

Side by Side Diff: src/isolate.cc

Issue 919653002: [V8] Use Function.name in Error.stack (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | src/messages.js » ('j') | src/objects.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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 script_name_key_ = 482 script_name_key_ =
483 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptName")); 483 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptName"));
484 } 484 }
485 if (options & StackTrace::kScriptNameOrSourceURL) { 485 if (options & StackTrace::kScriptNameOrSourceURL) {
486 script_name_or_source_url_key_ = factory()->InternalizeOneByteString( 486 script_name_or_source_url_key_ = factory()->InternalizeOneByteString(
487 STATIC_CHAR_VECTOR("scriptNameOrSourceURL")); 487 STATIC_CHAR_VECTOR("scriptNameOrSourceURL"));
488 } 488 }
489 if (options & StackTrace::kFunctionName) { 489 if (options & StackTrace::kFunctionName) {
490 function_key_ = factory()->InternalizeOneByteString( 490 function_key_ = factory()->InternalizeOneByteString(
491 STATIC_CHAR_VECTOR("functionName")); 491 STATIC_CHAR_VECTOR("functionName"));
492 name_key_ =
493 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("name"));
494 } 492 }
495 if (options & StackTrace::kIsEval) { 493 if (options & StackTrace::kIsEval) {
496 eval_key_ = 494 eval_key_ =
497 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); 495 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval"));
498 } 496 }
499 if (options & StackTrace::kIsConstructor) { 497 if (options & StackTrace::kIsConstructor) {
500 constructor_key_ = factory()->InternalizeOneByteString( 498 constructor_key_ = factory()->InternalizeOneByteString(
501 STATIC_CHAR_VECTOR("isConstructor")); 499 STATIC_CHAR_VECTOR("isConstructor"));
502 } 500 }
503 } 501 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 handle(script->name(), isolate_), NONE); 543 handle(script->name(), isolate_), NONE);
546 } 544 }
547 545
548 if (!script_name_or_source_url_key_.is_null()) { 546 if (!script_name_or_source_url_key_.is_null()) {
549 Handle<Object> result = Script::GetNameOrSourceURL(script); 547 Handle<Object> result = Script::GetNameOrSourceURL(script);
550 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, 548 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result,
551 NONE); 549 NONE);
552 } 550 }
553 551
554 if (!function_key_.is_null()) { 552 if (!function_key_.is_null()) {
555 Handle<Object> fun_name = JSObject::GetDataProperty(fun, name_key_); 553 Handle<Object> fun_name = Handle<Object>(fun->DebugName(), isolate_);
556 if (!fun_name->IsString())
557 fun_name = Handle<Object>(fun->shared()->DebugName(), isolate_);
558 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); 554 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE);
559 } 555 }
560 556
561 if (!eval_key_.is_null()) { 557 if (!eval_key_.is_null()) {
562 Handle<Object> is_eval = factory()->ToBoolean( 558 Handle<Object> is_eval = factory()->ToBoolean(
563 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); 559 script->compilation_type() == Script::COMPILATION_TYPE_EVAL);
564 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); 560 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE);
565 } 561 }
566 562
567 if (!constructor_key_.is_null()) { 563 if (!constructor_key_.is_null()) {
(...skipping 10 matching lines...) Expand all
578 574
579 Isolate* isolate_; 575 Isolate* isolate_;
580 Handle<String> column_key_; 576 Handle<String> column_key_;
581 Handle<String> line_key_; 577 Handle<String> line_key_;
582 Handle<String> script_id_key_; 578 Handle<String> script_id_key_;
583 Handle<String> script_name_key_; 579 Handle<String> script_name_key_;
584 Handle<String> script_name_or_source_url_key_; 580 Handle<String> script_name_or_source_url_key_;
585 Handle<String> function_key_; 581 Handle<String> function_key_;
586 Handle<String> eval_key_; 582 Handle<String> eval_key_;
587 Handle<String> constructor_key_; 583 Handle<String> constructor_key_;
588 Handle<String> name_key_;
589 }; 584 };
590 585
591 586
592 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace( 587 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace(
593 Handle<JSObject> error_object) { 588 Handle<JSObject> error_object) {
594 Handle<Name> key = factory()->stack_trace_symbol(); 589 Handle<Name> key = factory()->stack_trace_symbol();
595 Handle<Object> property = JSObject::GetDataProperty(error_object, key); 590 Handle<Object> property = JSObject::GetDataProperty(error_object, key);
596 if (!property->IsJSArray()) return Handle<JSArray>(); 591 if (!property->IsJSArray()) return Handle<JSArray>();
597 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); 592 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
598 593
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 if (prev_ && prev_->Intercept(flag)) return true; 2649 if (prev_ && prev_->Intercept(flag)) return true;
2655 // Then check whether this scope intercepts. 2650 // Then check whether this scope intercepts.
2656 if ((flag & intercept_mask_)) { 2651 if ((flag & intercept_mask_)) {
2657 intercepted_flags_ |= flag; 2652 intercepted_flags_ |= flag;
2658 return true; 2653 return true;
2659 } 2654 }
2660 return false; 2655 return false;
2661 } 2656 }
2662 2657
2663 } } // namespace v8::internal 2658 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698