Reviewers: Søren Gjesse,

Description:
Change the StackGuard runtime function to take no arguments.

For some reason the StackGuard runtime function took a dummy argument
that it always ignored.  Change it to take no arguments.

Please review this at http://codereview.chromium.org/3838003/show

Affected files:
  M src/arm/code-stubs-arm.cc
  M src/ia32/code-stubs-ia32.cc
  M src/runtime.h
  M src/runtime.cc
  M src/x64/code-stubs-x64.cc


Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index c63c3bdf0064de8361a6475a9697a93139c080c3..99da78cc1adbcbce47b9bc85425f2a7a0185df10 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -2297,13 +2297,7 @@ Runtime::FunctionId TranscendentalCacheStub::RuntimeFunction() {


 void StackCheckStub::Generate(MacroAssembler* masm) {
-  // Do tail-call to runtime routine.  Runtime routines expect at least one
-  // argument, so give it a Smi.
-  __ mov(r0, Operand(Smi::FromInt(0)));
-  __ push(r0);
   __ TailCallRuntime(Runtime::kStackGuard, 1, 1);
-
-  __ Ret();
 }


Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 897a3d54f6b36fff6ca80dac3c62c2be0e910892..348bb1484b4cece7f63c8cff748cd8b235b97f3c 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -2964,16 +2964,7 @@ void CompareStub::BranchIfNonSymbol(MacroAssembler* masm,


 void StackCheckStub::Generate(MacroAssembler* masm) {
-  // Because builtins always remove the receiver from the stack, we
-  // have to fake one to avoid underflowing the stack. The receiver
-  // must be inserted below the return address on the stack so we
-  // temporarily store that in a register.
-  __ pop(eax);
-  __ push(Immediate(Smi::FromInt(0)));
-  __ push(eax);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kStackGuard, 1, 1);
+  __ TailCallRuntime(Runtime::kStackGuard, 0, 1);
 }


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index d387618d09290868172bbc899f6c638dd9d40ff4..9a604a035dc9ed8662c62494cca75ad38e2e0494 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6703,7 +6703,7 @@ static Object* Runtime_StackOverflow(Arguments args) {


 static Object* Runtime_StackGuard(Arguments args) {
-  ASSERT(args.length() == 1);
+  ASSERT(args.length() == 0);

   // First check if this is a real stack overflow.
   if (StackGuard::IsStackOverflow()) {
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index 19f41441c08a32f595e78649e811d3198135cf7e..2cd95c493dad68d86260802478436c65a39f3a26 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -267,7 +267,7 @@ namespace internal {
   F(Throw, 1, 1) \
   F(ReThrow, 1, 1) \
   F(ThrowReferenceError, 1, 1) \
-  F(StackGuard, 1, 1) \
+  F(StackGuard, 0, 1) \
   F(PromoteScheduledException, 0, 1) \
   \
   /* Contexts */ \
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index 295d758a27d2e8e5f9826ee6766d81fc678d55b6..2d87667baef6cc69478a70bae76dfc97c16b1b62 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -2394,16 +2394,7 @@ void CompareStub::BranchIfNonSymbol(MacroAssembler* masm,


 void StackCheckStub::Generate(MacroAssembler* masm) {
-  // Because builtins always remove the receiver from the stack, we
-  // have to fake one to avoid underflowing the stack. The receiver
-  // must be inserted below the return address on the stack so we
-  // temporarily store that in a register.
-  __ pop(rax);
-  __ Push(Smi::FromInt(0));
-  __ push(rax);
-
-  // Do tail-call to runtime routine.
-  __ TailCallRuntime(Runtime::kStackGuard, 1, 1);
+  __ TailCallRuntime(Runtime::kStackGuard, 0, 1);
 }




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to