OLD | NEW |
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 Loading... |
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")); |
492 } | 494 } |
493 if (options & StackTrace::kIsEval) { | 495 if (options & StackTrace::kIsEval) { |
494 eval_key_ = | 496 eval_key_ = |
495 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); | 497 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); |
496 } | 498 } |
497 if (options & StackTrace::kIsConstructor) { | 499 if (options & StackTrace::kIsConstructor) { |
498 constructor_key_ = factory()->InternalizeOneByteString( | 500 constructor_key_ = factory()->InternalizeOneByteString( |
499 STATIC_CHAR_VECTOR("isConstructor")); | 501 STATIC_CHAR_VECTOR("isConstructor")); |
500 } | 502 } |
501 } | 503 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 handle(script->name(), isolate_), NONE); | 545 handle(script->name(), isolate_), NONE); |
544 } | 546 } |
545 | 547 |
546 if (!script_name_or_source_url_key_.is_null()) { | 548 if (!script_name_or_source_url_key_.is_null()) { |
547 Handle<Object> result = Script::GetNameOrSourceURL(script); | 549 Handle<Object> result = Script::GetNameOrSourceURL(script); |
548 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, | 550 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, |
549 NONE); | 551 NONE); |
550 } | 552 } |
551 | 553 |
552 if (!function_key_.is_null()) { | 554 if (!function_key_.is_null()) { |
553 Handle<Object> fun_name(fun->shared()->DebugName(), isolate_); | 555 Handle<Object> fun_name = JSObject::GetDataProperty(fun, name_key_); |
| 556 if (!fun_name->IsString()) |
| 557 fun_name = Handle<Object>(fun->shared()->DebugName(), isolate_); |
554 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); | 558 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); |
555 } | 559 } |
556 | 560 |
557 if (!eval_key_.is_null()) { | 561 if (!eval_key_.is_null()) { |
558 Handle<Object> is_eval = factory()->ToBoolean( | 562 Handle<Object> is_eval = factory()->ToBoolean( |
559 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); | 563 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); |
560 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); | 564 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); |
561 } | 565 } |
562 | 566 |
563 if (!constructor_key_.is_null()) { | 567 if (!constructor_key_.is_null()) { |
(...skipping 10 matching lines...) Expand all Loading... |
574 | 578 |
575 Isolate* isolate_; | 579 Isolate* isolate_; |
576 Handle<String> column_key_; | 580 Handle<String> column_key_; |
577 Handle<String> line_key_; | 581 Handle<String> line_key_; |
578 Handle<String> script_id_key_; | 582 Handle<String> script_id_key_; |
579 Handle<String> script_name_key_; | 583 Handle<String> script_name_key_; |
580 Handle<String> script_name_or_source_url_key_; | 584 Handle<String> script_name_or_source_url_key_; |
581 Handle<String> function_key_; | 585 Handle<String> function_key_; |
582 Handle<String> eval_key_; | 586 Handle<String> eval_key_; |
583 Handle<String> constructor_key_; | 587 Handle<String> constructor_key_; |
| 588 Handle<String> name_key_; |
584 }; | 589 }; |
585 | 590 |
586 | 591 |
587 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace( | 592 Handle<JSArray> Isolate::GetDetailedFromSimpleStackTrace( |
588 Handle<JSObject> error_object) { | 593 Handle<JSObject> error_object) { |
589 Handle<Name> key = factory()->stack_trace_symbol(); | 594 Handle<Name> key = factory()->stack_trace_symbol(); |
590 Handle<Object> property = JSObject::GetDataProperty(error_object, key); | 595 Handle<Object> property = JSObject::GetDataProperty(error_object, key); |
591 if (!property->IsJSArray()) return Handle<JSArray>(); | 596 if (!property->IsJSArray()) return Handle<JSArray>(); |
592 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 597 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); |
593 | 598 |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 if (prev_ && prev_->Intercept(flag)) return true; | 2659 if (prev_ && prev_->Intercept(flag)) return true; |
2655 // Then check whether this scope intercepts. | 2660 // Then check whether this scope intercepts. |
2656 if ((flag & intercept_mask_)) { | 2661 if ((flag & intercept_mask_)) { |
2657 intercepted_flags_ |= flag; | 2662 intercepted_flags_ |= flag; |
2658 return true; | 2663 return true; |
2659 } | 2664 } |
2660 return false; | 2665 return false; |
2661 } | 2666 } |
2662 | 2667 |
2663 } } // namespace v8::internal | 2668 } } // namespace v8::internal |
OLD | NEW |