Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/arm/code-stubs-arm.cc

Issue 6324013: ARM: Add subtract to the type recording binary operation stub. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
===================================================================
--- src/arm/code-stubs-arm.cc (revision 6471)
+++ src/arm/code-stubs-arm.cc (working copy)
@@ -2433,6 +2433,46 @@
}
+void TypeRecordingBinaryOpStub::GenerateOptimisticSmiOperation(
+ MacroAssembler* masm) {
+ Register left = r1;
+ Register right = r0;
+
+ ASSERT(right.is(r0));
+
+ switch (op_) {
+ case Token::ADD:
+ __ add(right, left, Operand(right), SetCC); // Add optimistically.
+ __ Ret(vc);
+ __ sub(right, right, Operand(left)); // Revert optimistic add.
+ break;
+ case Token::SUB:
+ __ sub(right, left, Operand(right), SetCC); // Subtract optimistically.
+ __ Ret(vc);
+ __ sub(right, left, Operand(right)); // Revert optimistic subtract.
Alexandre 2011/01/25 16:51:15 Shouldn't it be an add(right, right, Operand(left)
Alexandre 2011/01/25 16:54:45 Sorry I messed up with these right and left. On 20
+ break;
+ default:
+ UNREACHABLE();
+ }
+}
+
+
+void TypeRecordingBinaryOpStub::GenerateVFPOperation(
+ MacroAssembler* masm) {
+ switch (op_) {
+ case Token::ADD:
+ __ vadd(d5, d6, d7);
+ break;
+ case Token::SUB:
+ __ vsub(d5, d6, d7);
+ break;
+ default:
+ UNREACHABLE();
+ }
+
+}
+
+
// Generate the smi code. If the operation on smis are successful this return is
// generated. If the result is not a smi and heap number allocation is not
// requested the code falls through. If number allocation is requested but a
@@ -2442,7 +2482,7 @@
SmiCodeGenerateHeapNumberResults allow_heapnumber_results) {
Label not_smis;
- ASSERT(op_ == Token::ADD);
+ ASSERT(op_ == Token::ADD || op_ == Token::SUB);
Register left = r1;
Register right = r0;
@@ -2455,15 +2495,8 @@
__ tst(scratch1, Operand(kSmiTagMask));
__ b(ne, &not_smis);
- __ add(right, right, Operand(left), SetCC); // Add optimistically.
+ GenerateOptimisticSmiOperation(masm);
- // Return smi result if no overflow (r0 is the result).
- ASSERT(right.is(r0));
- __ Ret(vc);
-
- // Result is not a smi. Revert the optimistic add.
- __ sub(right, right, Operand(left));
-
// If heap number results are possible generate the result in an allocated
// heap number.
if (allow_heapnumber_results == ALLOW_HEAPNUMBER_RESULTS) {
@@ -2489,7 +2522,7 @@
// d6: Left value
// d7: Right value
CpuFeatures::Scope scope(VFP3);
- __ vadd(d5, d6, d7);
+ GenerateVFPOperation(masm);
__ sub(r0, heap_number, Operand(kHeapObjectTag));
__ vstr(d5, r0, HeapNumber::kValueOffset);
@@ -2530,7 +2563,7 @@
void TypeRecordingBinaryOpStub::GenerateSmiStub(MacroAssembler* masm) {
Label not_smis, call_runtime;
- ASSERT(op_ == Token::ADD);
+ ASSERT(op_ == Token::ADD || op_ == Token::SUB);
if (result_type_ == TRBinaryOpIC::UNINITIALIZED ||
result_type_ == TRBinaryOpIC::SMI) {
@@ -2562,7 +2595,7 @@
void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
- ASSERT(op_ == Token::ADD);
+ ASSERT(op_ == Token::ADD || op_ == Token::SUB);
ASSERT(operands_type_ == TRBinaryOpIC::INT32);
@@ -2571,7 +2604,7 @@
void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
- ASSERT(op_ == Token::ADD);
+ ASSERT(op_ == Token::ADD || op_ == Token::SUB);
Register scratch1 = r7;
Register scratch2 = r9;
@@ -2597,7 +2630,7 @@
if (destination == FloatingPointHelper::kVFPRegisters) {
// Use floating point instructions for the binary operation.
CpuFeatures::Scope scope(VFP3);
- __ vadd(d5, d6, d7);
+ GenerateVFPOperation(masm);
// Get a heap number object for the result - might be left or right if one
// of these are overwritable.
@@ -2651,7 +2684,7 @@
void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) {
- ASSERT(op_ == Token::ADD);
+ ASSERT(op_ == Token::ADD || op_ == Token::SUB);
Label call_runtime;
@@ -2695,11 +2728,14 @@
void TypeRecordingBinaryOpStub::GenerateCallRuntime(MacroAssembler* masm) {
+ GenerateRegisterArgsPush(masm);
switch (op_) {
case Token::ADD:
- GenerateRegisterArgsPush(masm);
__ InvokeBuiltin(Builtins::ADD, JUMP_JS);
break;
+ case Token::SUB:
+ __ InvokeBuiltin(Builtins::SUB, JUMP_JS);
+ break;
default:
UNREACHABLE();
}
« no previous file with comments | « src/arm/code-stubs-arm.h ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698