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 "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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 JSObject::AddProperty(stack_frame, script_id_key_, | 651 JSObject::AddProperty(stack_frame, script_id_key_, |
652 handle(Smi::FromInt(script->id()), isolate_), NONE); | 652 handle(Smi::FromInt(script->id()), isolate_), NONE); |
653 } | 653 } |
654 | 654 |
655 if (!script_name_key_.is_null()) { | 655 if (!script_name_key_.is_null()) { |
656 JSObject::AddProperty(stack_frame, script_name_key_, | 656 JSObject::AddProperty(stack_frame, script_name_key_, |
657 handle(script->name(), isolate_), NONE); | 657 handle(script->name(), isolate_), NONE); |
658 } | 658 } |
659 | 659 |
660 if (!script_name_or_source_url_key_.is_null()) { | 660 if (!script_name_or_source_url_key_.is_null()) { |
661 Handle<Object> result = Script::GetNameOrSourceURL(script); | 661 Handle<Object> result(script->GetNameOrSourceURL(), isolate_); |
662 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, | 662 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, |
663 NONE); | 663 NONE); |
664 } | 664 } |
665 | 665 |
666 if (!eval_key_.is_null()) { | 666 if (!eval_key_.is_null()) { |
667 Handle<Object> is_eval = factory()->ToBoolean( | 667 Handle<Object> is_eval = factory()->ToBoolean( |
668 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); | 668 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); |
669 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); | 669 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); |
670 } | 670 } |
671 | 671 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 DCHECK(!has_pending_exception()); | 1070 DCHECK(!has_pending_exception()); |
1071 | 1071 |
1072 HandleScope scope(this); | 1072 HandleScope scope(this); |
1073 Handle<Object> exception_handle(exception, this); | 1073 Handle<Object> exception_handle(exception, this); |
1074 | 1074 |
1075 if (FLAG_print_all_exceptions) { | 1075 if (FLAG_print_all_exceptions) { |
1076 printf("=========================================================\n"); | 1076 printf("=========================================================\n"); |
1077 printf("Exception thrown:\n"); | 1077 printf("Exception thrown:\n"); |
1078 if (location) { | 1078 if (location) { |
1079 Handle<Script> script = location->script(); | 1079 Handle<Script> script = location->script(); |
1080 Handle<Object> name = Script::GetNameOrSourceURL(script); | 1080 Handle<Object> name(script->GetNameOrSourceURL(), this); |
1081 printf("at "); | 1081 printf("at "); |
1082 if (name->IsString() && String::cast(*name)->length() > 0) | 1082 if (name->IsString() && String::cast(*name)->length() > 0) |
1083 String::cast(*name)->PrintOn(stdout); | 1083 String::cast(*name)->PrintOn(stdout); |
1084 else | 1084 else |
1085 printf("<anonymous>"); | 1085 printf("<anonymous>"); |
1086 // Script::GetLineNumber and Script::GetColumnNumber can allocate on the heap to | 1086 // Script::GetLineNumber and Script::GetColumnNumber can allocate on the heap to |
1087 // initialize the line_ends array, so be careful when calling them. | 1087 // initialize the line_ends array, so be careful when calling them. |
1088 #ifdef DEBUG | 1088 #ifdef DEBUG |
1089 if (AllowHeapAllocation::IsAllowed()) { | 1089 if (AllowHeapAllocation::IsAllowed()) { |
1090 #else | 1090 #else |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 return nullptr; | 2801 return nullptr; |
2802 } | 2802 } |
2803 | 2803 |
2804 | 2804 |
2805 bool Isolate::use_crankshaft() const { | 2805 bool Isolate::use_crankshaft() const { |
2806 return FLAG_crankshaft && | 2806 return FLAG_crankshaft && |
2807 !serializer_enabled_ && | 2807 !serializer_enabled_ && |
2808 CpuFeatures::SupportsCrankshaft(); | 2808 CpuFeatures::SupportsCrankshaft(); |
2809 } | 2809 } |
2810 | 2810 |
| 2811 bool Isolate::NeedsSourcePositionsForProfiling() const { |
| 2812 return FLAG_trace_deopt || FLAG_trace_turbo || FLAG_trace_turbo_graph || |
| 2813 FLAG_turbo_profiling || is_profiling() || debug_->is_active() || |
| 2814 logger_->is_logging(); |
| 2815 } |
| 2816 |
2811 bool Isolate::IsArrayOrObjectPrototype(Object* object) { | 2817 bool Isolate::IsArrayOrObjectPrototype(Object* object) { |
2812 Object* context = heap()->native_contexts_list(); | 2818 Object* context = heap()->native_contexts_list(); |
2813 while (!context->IsUndefined(this)) { | 2819 while (!context->IsUndefined(this)) { |
2814 Context* current_context = Context::cast(context); | 2820 Context* current_context = Context::cast(context); |
2815 if (current_context->initial_object_prototype() == object || | 2821 if (current_context->initial_object_prototype() == object || |
2816 current_context->initial_array_prototype() == object) { | 2822 current_context->initial_array_prototype() == object) { |
2817 return true; | 2823 return true; |
2818 } | 2824 } |
2819 context = current_context->next_context_link(); | 2825 context = current_context->next_context_link(); |
2820 } | 2826 } |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3539 // Then check whether this scope intercepts. | 3545 // Then check whether this scope intercepts. |
3540 if ((flag & intercept_mask_)) { | 3546 if ((flag & intercept_mask_)) { |
3541 intercepted_flags_ |= flag; | 3547 intercepted_flags_ |= flag; |
3542 return true; | 3548 return true; |
3543 } | 3549 } |
3544 return false; | 3550 return false; |
3545 } | 3551 } |
3546 | 3552 |
3547 } // namespace internal | 3553 } // namespace internal |
3548 } // namespace v8 | 3554 } // namespace v8 |
OLD | NEW |