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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 | 838 |
839 const char* const Isolate::kStackOverflowMessage = | 839 const char* const Isolate::kStackOverflowMessage = |
840 "Uncaught RangeError: Maximum call stack size exceeded"; | 840 "Uncaught RangeError: Maximum call stack size exceeded"; |
841 | 841 |
842 | 842 |
843 Object* Isolate::StackOverflow() { | 843 Object* Isolate::StackOverflow() { |
844 HandleScope scope(this); | 844 HandleScope scope(this); |
845 // At this point we cannot create an Error object using its javascript | 845 // At this point we cannot create an Error object using its javascript |
846 // constructor. Instead, we copy the pre-constructed boilerplate and | 846 // constructor. Instead, we copy the pre-constructed boilerplate and |
847 // attach the stack trace as a hidden property. | 847 // attach the stack trace as a hidden property. |
848 Handle<Object> exception; | 848 Handle<String> key = factory()->stack_overflow_string(); |
849 if (bootstrapper()->IsActive()) { | 849 Handle<Object> boilerplate = |
850 // There is no boilerplate to use during bootstrapping. | 850 Object::GetProperty(js_builtins_object(), key).ToHandleChecked(); |
851 exception = factory()->NewStringFromAsciiChecked( | 851 if (boilerplate->IsUndefined()) { |
852 MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); | 852 return Throw(heap()->undefined_value(), nullptr); |
853 } else { | |
854 Handle<JSObject> boilerplate = stack_overflow_boilerplate(); | |
855 Handle<JSObject> copy = factory()->CopyJSObject(boilerplate); | |
856 CaptureAndSetSimpleStackTrace(copy, factory()->undefined_value()); | |
857 exception = copy; | |
858 } | 853 } |
| 854 Handle<JSObject> exception = |
| 855 factory()->CopyJSObject(Handle<JSObject>::cast(boilerplate)); |
859 Throw(*exception, nullptr); | 856 Throw(*exception, nullptr); |
860 | 857 |
| 858 CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value()); |
861 #ifdef VERIFY_HEAP | 859 #ifdef VERIFY_HEAP |
862 if (FLAG_verify_heap && FLAG_stress_compaction) { | 860 if (FLAG_verify_heap && FLAG_stress_compaction) { |
863 heap()->CollectAllAvailableGarbage("trigger compaction"); | 861 heap()->CollectAllAvailableGarbage("trigger compaction"); |
864 } | 862 } |
865 #endif // VERIFY_HEAP | 863 #endif // VERIFY_HEAP |
866 | 864 |
867 return heap()->exception(); | 865 return heap()->exception(); |
868 } | 866 } |
869 | 867 |
870 | 868 |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2817 // Then check whether this scope intercepts. | 2815 // Then check whether this scope intercepts. |
2818 if ((flag & intercept_mask_)) { | 2816 if ((flag & intercept_mask_)) { |
2819 intercepted_flags_ |= flag; | 2817 intercepted_flags_ |= flag; |
2820 return true; | 2818 return true; |
2821 } | 2819 } |
2822 return false; | 2820 return false; |
2823 } | 2821 } |
2824 | 2822 |
2825 } // namespace internal | 2823 } // namespace internal |
2826 } // namespace v8 | 2824 } // namespace v8 |
OLD | NEW |