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