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

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') | 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 <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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 script_name_key_ = 476 script_name_key_ =
477 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptName")); 477 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("scriptName"));
478 } 478 }
479 if (options & StackTrace::kScriptNameOrSourceURL) { 479 if (options & StackTrace::kScriptNameOrSourceURL) {
480 script_name_or_source_url_key_ = factory()->InternalizeOneByteString( 480 script_name_or_source_url_key_ = factory()->InternalizeOneByteString(
481 STATIC_CHAR_VECTOR("scriptNameOrSourceURL")); 481 STATIC_CHAR_VECTOR("scriptNameOrSourceURL"));
482 } 482 }
483 if (options & StackTrace::kFunctionName) { 483 if (options & StackTrace::kFunctionName) {
484 function_key_ = factory()->InternalizeOneByteString( 484 function_key_ = factory()->InternalizeOneByteString(
485 STATIC_CHAR_VECTOR("functionName")); 485 STATIC_CHAR_VECTOR("functionName"));
486 name_key_ =
487 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("name"));
488 } 486 }
489 if (options & StackTrace::kIsEval) { 487 if (options & StackTrace::kIsEval) {
490 eval_key_ = 488 eval_key_ =
491 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); 489 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval"));
492 } 490 }
493 if (options & StackTrace::kIsConstructor) { 491 if (options & StackTrace::kIsConstructor) {
494 constructor_key_ = factory()->InternalizeOneByteString( 492 constructor_key_ = factory()->InternalizeOneByteString(
495 STATIC_CHAR_VECTOR("isConstructor")); 493 STATIC_CHAR_VECTOR("isConstructor"));
496 } 494 }
497 } 495 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 handle(script->name(), isolate_), NONE); 537 handle(script->name(), isolate_), NONE);
540 } 538 }
541 539
542 if (!script_name_or_source_url_key_.is_null()) { 540 if (!script_name_or_source_url_key_.is_null()) {
543 Handle<Object> result = Script::GetNameOrSourceURL(script); 541 Handle<Object> result = Script::GetNameOrSourceURL(script);
544 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, 542 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result,
545 NONE); 543 NONE);
546 } 544 }
547 545
548 if (!function_key_.is_null()) { 546 if (!function_key_.is_null()) {
549 Handle<Object> fun_name = JSObject::GetDataProperty(fun, name_key_); 547 Handle<Object> fun_name = JSFunction::GetDebugName(fun);
550 if (!fun_name->IsString())
551 fun_name = Handle<Object>(fun->shared()->DebugName(), isolate_);
552 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); 548 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE);
553 } 549 }
554 550
555 if (!eval_key_.is_null()) { 551 if (!eval_key_.is_null()) {
556 Handle<Object> is_eval = factory()->ToBoolean( 552 Handle<Object> is_eval = factory()->ToBoolean(
557 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); 553 script->compilation_type() == Script::COMPILATION_TYPE_EVAL);
558 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); 554 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE);
559 } 555 }
560 556
561 if (!constructor_key_.is_null()) { 557 if (!constructor_key_.is_null()) {
(...skipping 10 matching lines...) Expand all
572 568
573 Isolate* isolate_; 569 Isolate* isolate_;
574 Handle<String> column_key_; 570 Handle<String> column_key_;
575 Handle<String> line_key_; 571 Handle<String> line_key_;
576 Handle<String> script_id_key_; 572 Handle<String> script_id_key_;
577 Handle<String> script_name_key_; 573 Handle<String> script_name_key_;
578 Handle<String> script_name_or_source_url_key_; 574 Handle<String> script_name_or_source_url_key_;
579 Handle<String> function_key_; 575 Handle<String> function_key_;
580 Handle<String> eval_key_; 576 Handle<String> eval_key_;
581 Handle<String> constructor_key_; 577 Handle<String> constructor_key_;
582 Handle<String> name_key_;
583 }; 578 };
584 579
585 580
586 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace( 581 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace(
587 Handle<JSObject> error_object) { 582 Handle<JSObject> error_object) {
588 Handle<Name> key = factory()->stack_trace_symbol(); 583 Handle<Name> key = factory()->stack_trace_symbol();
589 Handle<Object> property = JSObject::GetDataProperty(error_object, key); 584 Handle<Object> property = JSObject::GetDataProperty(error_object, key);
590 if (!property->IsJSArray()) return Handle<JSArray>(); 585 if (!property->IsJSArray()) return Handle<JSArray>();
591 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); 586 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
592 587
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 if (prev_ && prev_->Intercept(flag)) return true; 2615 if (prev_ && prev_->Intercept(flag)) return true;
2621 // Then check whether this scope intercepts. 2616 // Then check whether this scope intercepts.
2622 if ((flag & intercept_mask_)) { 2617 if ((flag & intercept_mask_)) {
2623 intercepted_flags_ |= flag; 2618 intercepted_flags_ |= flag;
2624 return true; 2619 return true;
2625 } 2620 }
2626 return false; 2621 return false;
2627 } 2622 }
2628 2623
2629 } } // namespace v8::internal 2624 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698