Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 06cca0ab0bcfdb72af10f48c20d8f8fbc1b6ea36..155e9ead0870a7cb6a715eec114e3aaa4f557be7 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -845,17 +845,19 @@ Object* Isolate::StackOverflow() { |
// At this point we cannot create an Error object using its javascript |
// constructor. Instead, we copy the pre-constructed boilerplate and |
// attach the stack trace as a hidden property. |
- Handle<String> key = factory()->stack_overflow_string(); |
- Handle<Object> boilerplate = |
- Object::GetProperty(js_builtins_object(), key).ToHandleChecked(); |
- if (boilerplate->IsUndefined()) { |
- return Throw(heap()->undefined_value(), nullptr); |
- } |
- Handle<JSObject> exception = |
- factory()->CopyJSObject(Handle<JSObject>::cast(boilerplate)); |
+ Handle<Object> exception; |
+ if (bootstrapper()->IsActive()) { |
+ // There is no boilerplate to use during bootstrapping. |
+ exception = factory()->NewStringFromAsciiChecked( |
+ MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); |
+ } else { |
+ Handle<JSObject> boilerplate = stack_overflow_boilerplate(); |
+ Handle<JSObject> copy = factory()->CopyJSObject(boilerplate); |
+ CaptureAndSetSimpleStackTrace(copy, factory()->undefined_value()); |
+ exception = copy; |
+ } |
Throw(*exception, nullptr); |
- CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value()); |
#ifdef VERIFY_HEAP |
if (FLAG_verify_heap && FLAG_stress_compaction) { |
heap()->CollectAllAvailableGarbage("trigger compaction"); |