Commit f622a232 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

ARM: Remove crankshaft dependency on the generic binary operation stub

The crankshaft code now only relies on the type recording binary operation stub.

Added check for overwritable heap number in the type recording binary operation stub.
Review URL: http://codereview.chromium.org/6529050

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6823 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 181bdc5f
......@@ -2661,8 +2661,8 @@ void TypeRecordingBinaryOpStub::GenerateFPOperation(MacroAssembler* masm,
// Allocate new heap number for result.
Register result = r5;
__ AllocateHeapNumber(
result, scratch1, scratch2, heap_number_map, gc_required);
GenerateHeapResultAllocation(
masm, result, heap_number_map, scratch1, scratch2, gc_required);
// Load the operands.
if (smi_operands) {
......@@ -2811,8 +2811,14 @@ void TypeRecordingBinaryOpStub::GenerateFPOperation(MacroAssembler* masm,
// Allocate new heap number for result.
__ bind(&result_not_a_smi);
__ AllocateHeapNumber(
r5, scratch1, scratch2, heap_number_map, gc_required);
Register result = r5;
if (smi_operands) {
__ AllocateHeapNumber(
result, scratch1, scratch2, heap_number_map, gc_required);
} else {
GenerateHeapResultAllocation(
masm, result, heap_number_map, scratch1, scratch2, gc_required);
}
// r2: Answer as signed int32.
// r5: Heap number to write answer into.
......@@ -2934,21 +2940,19 @@ void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) {
Label call_runtime;
Label call_runtime, call_string_add_or_runtime;
GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS);
// If all else fails, use the runtime system to get the correct
// result.
__ bind(&call_runtime);
GenerateFPOperation(masm, false, &call_string_add_or_runtime, &call_runtime);
// Try to add strings before calling runtime.
__ bind(&call_string_add_or_runtime);
if (op_ == Token::ADD) {
GenerateAddStrings(masm);
}
GenericBinaryOpStub stub(op_, mode_, r1, r0);
__ TailCallStub(&stub);
__ bind(&call_runtime);
GenerateCallRuntime(masm);
}
......
......@@ -987,7 +987,7 @@ void LCodeGen::DoModI(LModI* instr) {
DeferredModI(LCodeGen* codegen, LModI* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredGenericBinaryStub(instr_, Token::MOD);
codegen()->DoDeferredBinaryOpStub(instr_, Token::MOD);
}
private:
LModI* instr_;
......@@ -1016,7 +1016,7 @@ void LCodeGen::DoModI(LModI* instr) {
__ bind(&ok);
}
// Try a few common cases before using the generic stub.
// Try a few common cases before using the stub.
Label call_stub;
const int kUnfolds = 3;
// Skip if either side is negative.
......@@ -1044,7 +1044,7 @@ void LCodeGen::DoModI(LModI* instr) {
__ and_(result, scratch, Operand(left));
__ bind(&call_stub);
// Call the generic stub. The numbers in r0 and r1 have
// Call the stub. The numbers in r0 and r1 have
// to be tagged to Smis. If that is not possible, deoptimize.
DeferredModI* deferred = new DeferredModI(this, instr);
__ TrySmiTag(left, &deoptimize, scratch);
......@@ -1070,7 +1070,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
DeferredDivI(LCodeGen* codegen, LDivI* instr)
: LDeferredCode(codegen), instr_(instr) { }
virtual void Generate() {
codegen()->DoDeferredGenericBinaryStub(instr_, Token::DIV);
codegen()->DoDeferredBinaryOpStub(instr_, Token::DIV);
}
private:
LDivI* instr_;
......@@ -1123,7 +1123,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
__ mov(result, Operand(left, ASR, 2), LeaveCC, eq);
__ b(eq, &done);
// Call the generic stub. The numbers in r0 and r1 have
// Call the stub. The numbers in r0 and r1 have
// to be tagged to Smis. If that is not possible, deoptimize.
DeferredDivI* deferred = new DeferredDivI(this, instr);
......@@ -1145,13 +1145,27 @@ void LCodeGen::DoDivI(LDivI* instr) {
template<int T>
void LCodeGen::DoDeferredGenericBinaryStub(LTemplateInstruction<1, 2, T>* instr,
Token::Value op) {
void LCodeGen::DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
Token::Value op) {
Register left = ToRegister(instr->InputAt(0));
Register right = ToRegister(instr->InputAt(1));
__ PushSafepointRegistersAndDoubles();
GenericBinaryOpStub stub(op, OVERWRITE_LEFT, left, right);
// Move left to r1 and right to r0 for the stub call.
if (left.is(r1)) {
__ Move(r0, right);
} else if (left.is(r0) && right.is(r1)) {
__ Swap(r0, r1, r2);
} else if (left.is(r0)) {
ASSERT(!right.is(r1));
__ mov(r1, r0);
__ mov(r0, right);
} else {
ASSERT(!left.is(r0) && !right.is(r0));
__ mov(r0, right);
__ mov(r1, left);
}
TypeRecordingBinaryOpStub stub(op, OVERWRITE_LEFT);
__ CallStub(&stub);
RecordSafepointWithRegistersAndDoubles(instr->pointer_map(),
0,
......@@ -1431,10 +1445,7 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
ASSERT(ToRegister(instr->InputAt(1)).is(r0));
ASSERT(ToRegister(instr->result()).is(r0));
// TODO(regis): Implement TypeRecordingBinaryOpStub and replace current
// GenericBinaryOpStub:
// TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
GenericBinaryOpStub stub(instr->op(), NO_OVERWRITE, r1, r0);
TypeRecordingBinaryOpStub stub(instr->op(), NO_OVERWRITE);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
}
......
......@@ -94,8 +94,8 @@ class LCodeGen BASE_EMBEDDED {
// Deferred code support.
template<int T>
void DoDeferredGenericBinaryStub(LTemplateInstruction<1, 2, T>* instr,
Token::Value op);
void DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
Token::Value op);
void DoDeferredNumberTagD(LNumberTagD* instr);
void DoDeferredNumberTagI(LNumberTagI* instr);
void DoDeferredTaggedToI(LTaggedToI* instr);
......
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