Commit 4fe70e49 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Fix ARMu debug mode failure by handling runtime calls

with the wrong number of arguments on ARM in the same
way it's done on IA32. Make sure to remove arguments
on both platforms and return the illegal result in 
register eax or r0.
Review URL: http://codereview.chromium.org/6263

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@435 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5458eac1
...@@ -690,12 +690,24 @@ void MacroAssembler::StubReturn(int argc) { ...@@ -690,12 +690,24 @@ void MacroAssembler::StubReturn(int argc) {
} }
void MacroAssembler::IllegalOperation(int num_arguments) {
if (num_arguments > 0) {
add(sp, sp, Operand(num_arguments * kPointerSize));
}
mov(r0, Operand(Factory::undefined_value()));
}
void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
// All parameters are on the stack. r0 has the return value after call. // All parameters are on the stack. r0 has the return value after call.
// Either the expected number of arguments is unknown, or the actual // If the expected number of arguments of the runtime function is
// number of arguments match the expectation. // constant, we check that the actual number of arguments match the
ASSERT(f->nargs < 0 || f->nargs == num_arguments); // expectation.
if (f->nargs >= 0 && f->nargs != num_arguments) {
IllegalOperation(num_arguments);
return;
}
Runtime::FunctionId function_id = Runtime::FunctionId function_id =
static_cast<Runtime::FunctionId>(f->stub_id); static_cast<Runtime::FunctionId>(f->stub_id);
......
...@@ -176,6 +176,14 @@ class MacroAssembler: public Assembler { ...@@ -176,6 +176,14 @@ class MacroAssembler: public Assembler {
void CheckAccessGlobal(Register holder_reg, Register scratch, Label* miss); void CheckAccessGlobal(Register holder_reg, Register scratch, Label* miss);
// ---------------------------------------------------------------------------
// Support functions.
// Generates code for reporting that an illegal operation has
// occurred.
void IllegalOperation(int num_arguments);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Runtime calls // Runtime calls
......
...@@ -601,8 +601,11 @@ void MacroAssembler::StubReturn(int argc) { ...@@ -601,8 +601,11 @@ void MacroAssembler::StubReturn(int argc) {
} }
void MacroAssembler::IllegalOperation() { void MacroAssembler::IllegalOperation(int num_arguments) {
push(Immediate(Factory::undefined_value())); if (num_arguments > 0) {
add(Operand(esp), Immediate(num_arguments * kPointerSize));
}
mov(Operand(eax), Immediate(Factory::undefined_value()));
} }
...@@ -616,7 +619,7 @@ void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { ...@@ -616,7 +619,7 @@ void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
// constant, we check that the actual number of arguments match the // constant, we check that the actual number of arguments match the
// expectation. // expectation.
if (f->nargs >= 0 && f->nargs != num_arguments) { if (f->nargs >= 0 && f->nargs != num_arguments) {
IllegalOperation(); IllegalOperation(num_arguments);
return; return;
} }
......
...@@ -180,8 +180,8 @@ class MacroAssembler: public Assembler { ...@@ -180,8 +180,8 @@ class MacroAssembler: public Assembler {
Register scratch, Label* then_label); Register scratch, Label* then_label);
// Generates code for reporting that an illegal operation has // Generates code for reporting that an illegal operation has
// occurred // occurred.
void IllegalOperation(); void IllegalOperation(int num_arguments);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Runtime calls // Runtime calls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment