[builtins] Remove the weird STACK_OVERFLOW builtin.
Just use a %ThrowStackOverflow runtime function instead, which does the trick, especially since the Isolate already has a preallocated StackOverflow error for that. R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/1337883002 Cr-Commit-Position: refs/heads/master@{#30693}
This commit is contained in:
parent
18bba7cb41
commit
39604dda56
@ -768,7 +768,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ SmiTag(argc);
|
||||
}
|
||||
__ Push(r1, argc);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
|
||||
__ bind(&okay);
|
||||
}
|
||||
@ -920,7 +920,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ LoadRoot(r2, Heap::kRealStackLimitRootIndex);
|
||||
__ cmp(r9, Operand(r2));
|
||||
__ b(hs, &ok);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1794,7 +1794,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bkpt(0);
|
||||
}
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ SmiTag(argc);
|
||||
}
|
||||
__ Push(function, argc);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
// We should never return from the APPLY_OVERFLOW builtin.
|
||||
if (__ emit_debug_code()) {
|
||||
__ Unreachable();
|
||||
@ -945,7 +945,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ Sub(x10, jssp, Operand(x11));
|
||||
__ CompareRoot(x10, Heap::kRealStackLimitRootIndex);
|
||||
__ B(hs, &ok);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ Bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1863,7 +1863,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ Unreachable();
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,6 @@ enum BindingFlags {
|
||||
reflect_apply_prepare_builtin) \
|
||||
V(REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, JSFunction, \
|
||||
reflect_construct_prepare_builtin) \
|
||||
V(STACK_OVERFLOW_BUILTIN_INDEX, JSFunction, stack_overflow_builtin) \
|
||||
V(STRING_ADD_LEFT_BUILTIN_INDEX, JSFunction, string_add_left_builtin) \
|
||||
V(STRING_ADD_RIGHT_BUILTIN_INDEX, JSFunction, string_add_right_builtin)
|
||||
|
||||
|
@ -155,7 +155,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ LoadRoot(r2, Heap::kRealStackLimitRootIndex);
|
||||
__ cmp(r9, Operand(r2));
|
||||
__ b(hs, &ok);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
}
|
||||
__ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -159,7 +159,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ Sub(x10, jssp, locals_count * kPointerSize);
|
||||
__ CompareRoot(x10, Heap::kRealStackLimitRootIndex);
|
||||
__ B(hs, &ok);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ Bind(&ok);
|
||||
}
|
||||
__ LoadRoot(x10, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -150,7 +150,7 @@ void FullCodeGenerator::Generate() {
|
||||
ExternalReference::address_of_real_stack_limit(isolate());
|
||||
__ cmp(ecx, Operand::StaticVariable(stack_limit));
|
||||
__ j(above_equal, &ok, Label::kNear);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
}
|
||||
__ mov(eax, Immediate(isolate()->factory()->undefined_value()));
|
||||
|
@ -162,7 +162,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ Subu(t5, sp, Operand(locals_count * kPointerSize));
|
||||
__ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
|
||||
__ Branch(&ok, hs, t5, Operand(a2));
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
}
|
||||
__ LoadRoot(t5, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -159,7 +159,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ Dsubu(t1, sp, Operand(locals_count * kPointerSize));
|
||||
__ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
|
||||
__ Branch(&ok, hs, t1, Operand(a2));
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
}
|
||||
__ LoadRoot(t1, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -147,7 +147,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ subp(rcx, Immediate(locals_count * kPointerSize));
|
||||
__ CompareRoot(rcx, Heap::kRealStackLimitRootIndex);
|
||||
__ j(above_equal, &ok, Label::kNear);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
}
|
||||
__ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
|
||||
|
@ -522,7 +522,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ SmiTag(eax);
|
||||
}
|
||||
__ push(eax);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
|
||||
__ bind(&okay);
|
||||
}
|
||||
@ -660,7 +660,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
ExternalReference::address_of_real_stack_limit(masm->isolate());
|
||||
__ cmp(ecx, Operand::StaticVariable(stack_limit));
|
||||
__ j(above_equal, &ok);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1699,7 +1699,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ int3();
|
||||
}
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ SmiTag(argc);
|
||||
}
|
||||
__ Push(a1, argc);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
|
||||
__ bind(&okay);
|
||||
}
|
||||
@ -911,7 +911,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ Subu(t1, sp, Operand(t0));
|
||||
__ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
|
||||
__ Branch(&ok, hs, t1, Operand(a2));
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1811,7 +1811,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ break_(0xCC);
|
||||
}
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ SmiTag(argc);
|
||||
}
|
||||
__ Push(a1, argc);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
|
||||
__ bind(&okay);
|
||||
}
|
||||
@ -909,7 +909,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ Dsubu(a5, sp, Operand(a4));
|
||||
__ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
|
||||
__ Branch(&ok, hs, a5, Operand(a2));
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1808,7 +1808,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ break_(0xCC);
|
||||
}
|
||||
}
|
||||
|
@ -320,11 +320,6 @@ function CONCAT_ITERABLE_TO_ARRAY(iterable) {
|
||||
};
|
||||
|
||||
|
||||
function STACK_OVERFLOW(length) {
|
||||
throw %make_range_error(kStackOverflow);
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------
|
||||
- - - C o n v e r s i o n s - - -
|
||||
-------------------------------------
|
||||
@ -543,7 +538,6 @@ $toString = ToString;
|
||||
"equals_builtin", EQUALS,
|
||||
"reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE,
|
||||
"reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE,
|
||||
"stack_overflow_builtin", STACK_OVERFLOW,
|
||||
"string_add_left_builtin", STRING_ADD_LEFT,
|
||||
"string_add_right_builtin", STRING_ADD_RIGHT,
|
||||
]);
|
||||
|
@ -88,6 +88,13 @@ RUNTIME_FUNCTION(Runtime_ReThrow) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ThrowStackOverflow) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(0, args.length());
|
||||
return isolate->StackOverflow();
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_UnwindAndFindExceptionHandler) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK(args.length() == 0);
|
||||
|
@ -311,6 +311,7 @@ namespace internal {
|
||||
F(NewSyntaxError, 2, 1) \
|
||||
F(NewReferenceError, 2, 1) \
|
||||
F(ThrowIteratorResultNotAnObject, 1, 1) \
|
||||
F(ThrowStackOverflow, 0, 1) \
|
||||
F(ThrowStrongModeImplicitConversion, 0, 1) \
|
||||
F(PromiseRejectEvent, 3, 1) \
|
||||
F(PromiseRevokeReject, 1, 1) \
|
||||
|
@ -525,7 +525,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm,
|
||||
__ Integer32ToSmi(rax, rax);
|
||||
}
|
||||
__ Push(rax);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
|
||||
__ bind(&okay);
|
||||
}
|
||||
@ -718,7 +718,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
__ subp(rdx, rcx);
|
||||
__ CompareRoot(rdx, Heap::kRealStackLimitRootIndex);
|
||||
__ j(above_equal, &ok, Label::kNear);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ bind(&ok);
|
||||
|
||||
// If ok, push undefined as the initial value for all register file entries.
|
||||
@ -1619,7 +1619,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow, 0);
|
||||
__ int3();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user