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<String> key = factory()->stack_overflow_string(); | 848 Handle<Object> exception; |
849 Handle<Object> boilerplate = | 849 if (bootstrapper()->IsActive()) { |
850 Object::GetProperty(js_builtins_object(), key).ToHandleChecked(); | 850 // There is no boilerplate to use during bootstrapping. |
851 if (boilerplate->IsUndefined()) { | 851 exception = factory()->NewStringFromAsciiChecked( |
852 return Throw(heap()->undefined_value(), nullptr); | 852 MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); |
| 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; |
853 } | 858 } |
854 Handle<JSObject> exception = | |
855 factory()->CopyJSObject(Handle<JSObject>::cast(boilerplate)); | |
856 Throw(*exception, nullptr); | 859 Throw(*exception, nullptr); |
857 | 860 |
858 CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value()); | |
859 #ifdef VERIFY_HEAP | 861 #ifdef VERIFY_HEAP |
860 if (FLAG_verify_heap && FLAG_stress_compaction) { | 862 if (FLAG_verify_heap && FLAG_stress_compaction) { |
861 heap()->CollectAllAvailableGarbage("trigger compaction"); | 863 heap()->CollectAllAvailableGarbage("trigger compaction"); |
862 } | 864 } |
863 #endif // VERIFY_HEAP | 865 #endif // VERIFY_HEAP |
864 | 866 |
865 return heap()->exception(); | 867 return heap()->exception(); |
866 } | 868 } |
867 | 869 |
868 | 870 |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 // Then check whether this scope intercepts. | 2817 // Then check whether this scope intercepts. |
2816 if ((flag & intercept_mask_)) { | 2818 if ((flag & intercept_mask_)) { |
2817 intercepted_flags_ |= flag; | 2819 intercepted_flags_ |= flag; |
2818 return true; | 2820 return true; |
2819 } | 2821 } |
2820 return false; | 2822 return false; |
2821 } | 2823 } |
2822 | 2824 |
2823 } // namespace internal | 2825 } // namespace internal |
2824 } // namespace v8 | 2826 } // namespace v8 |
OLD | NEW |