summaryrefslogtreecommitdiffstats
path: root/chromium/v8/src/builtins/arm64/builtins-arm64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/builtins/arm64/builtins-arm64.cc')
-rw-r--r--chromium/v8/src/builtins/arm64/builtins-arm64.cc84
1 files changed, 47 insertions, 37 deletions
diff --git a/chromium/v8/src/builtins/arm64/builtins-arm64.cc b/chromium/v8/src/builtins/arm64/builtins-arm64.cc
index 6bad8b2849c..eb9cc734c6a 100644
--- a/chromium/v8/src/builtins/arm64/builtins-arm64.cc
+++ b/chromium/v8/src/builtins/arm64/builtins-arm64.cc
@@ -88,6 +88,44 @@ static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
namespace {
+void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
+ Label* stack_overflow) {
+ UseScratchRegisterScope temps(masm);
+ Register scratch = temps.AcquireX();
+
+ // Check the stack for overflow.
+ // We are not trying to catch interruptions (e.g. debug break and
+ // preemption) here, so the "real stack limit" is checked.
+ Label enough_stack_space;
+ __ LoadRoot(scratch, Heap::kRealStackLimitRootIndex);
+ // Make scratch the space we have left. The stack might already be overflowed
+ // here which will cause scratch to become negative.
+ __ Sub(scratch, sp, scratch);
+ // Check if the arguments will overflow the stack.
+ __ Cmp(scratch, Operand(num_args, LSL, kPointerSizeLog2));
+ __ B(le, stack_overflow);
+
+#if defined(V8_OS_WIN)
+ // Simulate _chkstk to extend stack guard page on Windows ARM64.
+ const int kPageSize = 4096;
+ Label chkstk, chkstk_done;
+ Register probe = temps.AcquireX();
+
+ __ Sub(scratch, sp, Operand(num_args, LSL, kPointerSizeLog2));
+ __ Mov(probe, sp);
+
+ // Loop start of stack probe.
+ __ Bind(&chkstk);
+ __ Sub(probe, probe, kPageSize);
+ __ Cmp(probe, scratch);
+ __ B(lo, &chkstk_done);
+ __ Ldrb(xzr, MemOperand(probe));
+ __ B(&chkstk);
+
+ __ Bind(&chkstk_done);
+#endif
+}
+
void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
Label post_instantiation_deopt_entry;
@@ -101,6 +139,8 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// -----------------------------------
ASM_LOCATION("Builtins::Generate_JSConstructStubHelper");
+ Label stack_overflow;
+ Generate_StackOverflowCheck(masm, x0, &stack_overflow);
// Enter a construct frame.
{
@@ -191,46 +231,16 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// Remove caller arguments from the stack and return.
__ DropArguments(x1, TurboAssembler::kCountExcludesReceiver);
__ Ret();
-}
-void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
- Label* stack_overflow) {
- UseScratchRegisterScope temps(masm);
- Register scratch = temps.AcquireX();
-
- // Check the stack for overflow.
- // We are not trying to catch interruptions (e.g. debug break and
- // preemption) here, so the "real stack limit" is checked.
- Label enough_stack_space;
- __ LoadRoot(scratch, Heap::kRealStackLimitRootIndex);
- // Make scratch the space we have left. The stack might already be overflowed
- // here which will cause scratch to become negative.
- __ Sub(scratch, sp, scratch);
- // Check if the arguments will overflow the stack.
- __ Cmp(scratch, Operand(num_args, LSL, kPointerSizeLog2));
- __ B(le, stack_overflow);
-
-#if defined(V8_OS_WIN)
- // Simulate _chkstk to extend stack guard page on Windows ARM64.
- const int kPageSize = 4096;
- Label chkstk, chkstk_done;
- Register probe = temps.AcquireX();
-
- __ Sub(scratch, sp, Operand(num_args, LSL, kPointerSizeLog2));
- __ Mov(probe, sp);
-
- // Loop start of stack probe.
- __ Bind(&chkstk);
- __ Sub(probe, probe, kPageSize);
- __ Cmp(probe, scratch);
- __ B(lo, &chkstk_done);
- __ Ldrb(xzr, MemOperand(probe));
- __ B(&chkstk);
-
- __ Bind(&chkstk_done);
-#endif
+ __ Bind(&stack_overflow);
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ CallRuntime(Runtime::kThrowStackOverflow);
+ __ Unreachable();
+ }
}
+
} // namespace
// The construct stub for ES5 constructor functions and ES6 class constructors.