Commit 0686fc25 authored by danno@chromium.org's avatar danno@chromium.org

MIPS: Fix several bugs that cause crashes in soft-float mode.

TEST=cctest/RobustSubStringStub,cctest/test-api/Threading,cctest/test-api/ExternalFloatArray,cctest/test-api/ExternalDoubleArray,mjsunit/external-array,mjsunit/unicodelctest

BUG=

Review URL: https://chromiumcodereview.appspot.com/10446003
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11708 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ee6a85a0
...@@ -3130,7 +3130,7 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) { ...@@ -3130,7 +3130,7 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
} else { } else {
// Tail call that writes the int32 in a2 to the heap number in v0, using // Tail call that writes the int32 in a2 to the heap number in v0, using
// a3 and a0 as scratch. v0 is preserved and returned. // a3 and a0 as scratch. v0 is preserved and returned.
__ mov(a0, t1); __ mov(v0, t1);
WriteInt32ToHeapNumberStub stub(a2, v0, a3, a0); WriteInt32ToHeapNumberStub stub(a2, v0, a3, a0);
__ TailCallStub(&stub); __ TailCallStub(&stub);
} }
......
...@@ -1502,10 +1502,15 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { ...@@ -1502,10 +1502,15 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
break; break;
} }
} }
double result = target(arg0, arg1, arg2, arg3);
if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) { if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) {
SetFpResult(result); SimulatorRuntimeFPCall target =
reinterpret_cast<SimulatorRuntimeFPCall>(external);
double result = target(arg0, arg1, arg2, arg3);
SetFpResult(result);
} else { } else {
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
uint64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5);
int32_t gpreg_pair[2]; int32_t gpreg_pair[2];
memcpy(&gpreg_pair[0], &result, 2 * sizeof(int32_t)); memcpy(&gpreg_pair[0], &result, 2 * sizeof(int32_t));
set_register(v0, gpreg_pair[0]); set_register(v0, gpreg_pair[0]);
......
...@@ -3705,7 +3705,7 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray( ...@@ -3705,7 +3705,7 @@ void KeyedLoadStubCompiler::GenerateLoadExternalArray(
__ li(t0, 0x7ff); __ li(t0, 0x7ff);
__ Xor(t1, t5, Operand(0xFF)); __ Xor(t1, t5, Operand(0xFF));
__ Movz(t5, t0, t1); // Set t5 to 0x7ff only if t5 is equal to 0xff. __ Movz(t5, t0, t1); // Set t5 to 0x7ff only if t5 is equal to 0xff.
__ Branch(&exponent_rebiased, eq, t0, Operand(0xff)); __ Branch(&exponent_rebiased, eq, t1, Operand(zero_reg));
// Rebias exponent. // Rebias exponent.
__ Addu(t5, __ Addu(t5,
...@@ -4005,7 +4005,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray( ...@@ -4005,7 +4005,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
__ xor_(t1, t6, t5); __ xor_(t1, t6, t5);
__ li(t2, kBinary32ExponentMask); __ li(t2, kBinary32ExponentMask);
__ Movz(t6, t2, t1); // Only if t6 is equal to t5. __ Movz(t6, t2, t1); // Only if t6 is equal to t5.
__ Branch(&nan_or_infinity_or_zero, eq, t6, Operand(t5)); __ Branch(&nan_or_infinity_or_zero, eq, t1, Operand(zero_reg));
// Rebias exponent. // Rebias exponent.
__ srl(t6, t6, HeapNumber::kExponentShift); __ srl(t6, t6, HeapNumber::kExponentShift);
...@@ -4036,7 +4036,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray( ...@@ -4036,7 +4036,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
__ bind(&done); __ bind(&done);
__ sll(t9, key, 1); __ sll(t9, key, 1);
__ addu(t9, a2, t9); __ addu(t9, a3, t9);
__ sw(t3, MemOperand(t9, 0)); __ sw(t3, MemOperand(t9, 0));
// Entry registers are intact, a0 holds the value which is the return // Entry registers are intact, a0 holds the value which is the return
...@@ -4054,7 +4054,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray( ...@@ -4054,7 +4054,7 @@ void KeyedStoreStubCompiler::GenerateStoreExternalArray(
__ or_(t3, t6, t4); __ or_(t3, t6, t4);
__ Branch(&done); __ Branch(&done);
} else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
__ sll(t8, t0, 3); __ sll(t8, key, 2);
__ addu(t8, a3, t8); __ addu(t8, a3, t8);
// t8: effective address of destination element. // t8: effective address of destination element.
__ sw(t4, MemOperand(t8, 0)); __ sw(t4, MemOperand(t8, 0));
......
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