summaryrefslogtreecommitdiffstats
path: root/chromium/v8/src/builtins/ia32/builtins-ia32.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/builtins/ia32/builtins-ia32.cc')
-rw-r--r--chromium/v8/src/builtins/ia32/builtins-ia32.cc56
1 files changed, 33 insertions, 23 deletions
diff --git a/chromium/v8/src/builtins/ia32/builtins-ia32.cc b/chromium/v8/src/builtins/ia32/builtins-ia32.cc
index 69ddc00d0e8..9bccfd46f15 100644
--- a/chromium/v8/src/builtins/ia32/builtins-ia32.cc
+++ b/chromium/v8/src/builtins/ia32/builtins-ia32.cc
@@ -67,6 +67,30 @@ static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
namespace {
+void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
+ Register scratch, Label* stack_overflow,
+ bool include_receiver = false) {
+ // 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.
+ ExternalReference real_stack_limit =
+ ExternalReference::address_of_real_stack_limit(masm->isolate());
+ // Compute the space that is left as a negative number in scratch. If
+ // we already overflowed, this will be a positive number.
+ __ mov(scratch, Operand::StaticVariable(real_stack_limit));
+ __ sub(scratch, esp);
+ // Add the size of the arguments.
+ static_assert(kPointerSize == 4,
+ "The next instruction assumes kPointerSize == 4");
+ __ lea(scratch, Operand(scratch, num_args, times_4, 0));
+ if (include_receiver) {
+ __ add(scratch, Immediate(kPointerSize));
+ }
+ // See if we overflowed, i.e. scratch is positive.
+ __ cmp(scratch, Immediate(0));
+ __ j(greater, stack_overflow); // Signed comparison.
+}
+
void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax: number of arguments
@@ -75,6 +99,9 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
// -- esi: context
// -----------------------------------
+ Label stack_overflow;
+ Generate_StackOverflowCheck(masm, eax, ecx, &stack_overflow);
+
// Enter a construct frame.
{
FrameScope scope(masm, StackFrame::CONSTRUCT);
@@ -131,32 +158,15 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
__ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver
__ push(ecx);
__ ret(0);
-}
-
-void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
- Register scratch, Label* stack_overflow,
- bool include_receiver = false) {
- // 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.
- ExternalReference real_stack_limit =
- ExternalReference::address_of_real_stack_limit(masm->isolate());
- // Compute the space that is left as a negative number in scratch. If
- // we already overflowed, this will be a positive number.
- __ mov(scratch, Operand::StaticVariable(real_stack_limit));
- __ sub(scratch, esp);
- // Add the size of the arguments.
- static_assert(kPointerSize == 4,
- "The next instruction assumes kPointerSize == 4");
- __ lea(scratch, Operand(scratch, num_args, times_4, 0));
- if (include_receiver) {
- __ add(scratch, Immediate(kPointerSize));
+ __ bind(&stack_overflow);
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ CallRuntime(Runtime::kThrowStackOverflow);
+ __ int3(); // This should be unreachable.
}
- // See if we overflowed, i.e. scratch is positive.
- __ cmp(scratch, Immediate(0));
- __ j(greater, stack_overflow); // Signed comparison.
}
+
} // namespace
// The construct stub for ES5 constructor functions and ES6 class constructors.