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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 9584006: Inline ordered relative compares of mixed double/undefined values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Tweak comment Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6542 matching lines...) Expand 10 before | Expand all | Expand 10 after
6553 6553
6554 __ bind(&miss); 6554 __ bind(&miss);
6555 GenerateMiss(masm); 6555 GenerateMiss(masm);
6556 } 6556 }
6557 6557
6558 6558
6559 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { 6559 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) {
6560 ASSERT(state_ == CompareIC::HEAP_NUMBERS); 6560 ASSERT(state_ == CompareIC::HEAP_NUMBERS);
6561 6561
6562 Label generic_stub; 6562 Label generic_stub;
6563 Label unordered; 6563 Label unordered, maybe_undefined1, maybe_undefined2;
6564 Label miss; 6564 Label miss;
6565 __ and_(r2, r1, Operand(r0)); 6565 __ and_(r2, r1, Operand(r0));
6566 __ JumpIfSmi(r2, &generic_stub); 6566 __ JumpIfSmi(r2, &generic_stub);
6567 6567
6568 __ CompareObjectType(r0, r2, r2, HEAP_NUMBER_TYPE); 6568 __ CompareObjectType(r0, r2, r2, HEAP_NUMBER_TYPE);
6569 __ b(ne, &miss); 6569 __ b(ne, &maybe_undefined1);
6570 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE); 6570 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE);
6571 __ b(ne, &miss); 6571 __ b(ne, &maybe_undefined2);
6572 6572
6573 // Inlining the double comparison and falling back to the general compare 6573 // Inlining the double comparison and falling back to the general compare
6574 // stub if NaN is involved or VFP3 is unsupported. 6574 // stub if NaN is involved or VFP3 is unsupported.
6575 if (CpuFeatures::IsSupported(VFP3)) { 6575 if (CpuFeatures::IsSupported(VFP3)) {
6576 CpuFeatures::Scope scope(VFP3); 6576 CpuFeatures::Scope scope(VFP3);
6577 6577
6578 // Load left and right operand 6578 // Load left and right operand
6579 __ sub(r2, r1, Operand(kHeapObjectTag)); 6579 __ sub(r2, r1, Operand(kHeapObjectTag));
6580 __ vldr(d0, r2, HeapNumber::kValueOffset); 6580 __ vldr(d0, r2, HeapNumber::kValueOffset);
6581 __ sub(r2, r0, Operand(kHeapObjectTag)); 6581 __ sub(r2, r0, Operand(kHeapObjectTag));
6582 __ vldr(d1, r2, HeapNumber::kValueOffset); 6582 __ vldr(d1, r2, HeapNumber::kValueOffset);
6583 6583
6584 // Compare operands 6584 // Compare operands
6585 __ VFPCompareAndSetFlags(d0, d1); 6585 __ VFPCompareAndSetFlags(d0, d1);
6586 6586
6587 // Don't base result on status bits when a NaN is involved. 6587 // Don't base result on status bits when a NaN is involved.
6588 __ b(vs, &unordered); 6588 __ b(vs, &unordered);
6589 6589
6590 // Return a result of -1, 0, or 1, based on status bits. 6590 // Return a result of -1, 0, or 1, based on status bits.
6591 __ mov(r0, Operand(EQUAL), LeaveCC, eq); 6591 __ mov(r0, Operand(EQUAL), LeaveCC, eq);
6592 __ mov(r0, Operand(LESS), LeaveCC, lt); 6592 __ mov(r0, Operand(LESS), LeaveCC, lt);
6593 __ mov(r0, Operand(GREATER), LeaveCC, gt); 6593 __ mov(r0, Operand(GREATER), LeaveCC, gt);
6594 __ Ret(); 6594 __ Ret();
6595
6596 __ bind(&unordered);
6597 } 6595 }
6598 6596
6597 __ bind(&unordered);
6599 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS, r1, r0); 6598 CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS, r1, r0);
6600 __ bind(&generic_stub); 6599 __ bind(&generic_stub);
6601 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); 6600 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
6602 6601
6602 __ bind(&maybe_undefined1);
6603 if (Token::IsOrderedRelationalCompareOp(op_)) {
6604 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
6605 __ b(ne, &miss);
6606 __ CompareObjectType(r1, r2, r2, HEAP_NUMBER_TYPE);
6607 __ b(ne, &maybe_undefined2);
6608 __ jmp(&unordered);
6609 }
6610
6611 __ bind(&maybe_undefined2);
6612 if (Token::IsOrderedRelationalCompareOp(op_)) {
6613 __ CompareRoot(r1, Heap::kUndefinedValueRootIndex);
6614 __ b(eq, &unordered);
6615 }
6616
6603 __ bind(&miss); 6617 __ bind(&miss);
6604 GenerateMiss(masm); 6618 GenerateMiss(masm);
6605 } 6619 }
6606 6620
6607 6621
6608 void ICCompareStub::GenerateSymbols(MacroAssembler* masm) { 6622 void ICCompareStub::GenerateSymbols(MacroAssembler* masm) {
6609 ASSERT(state_ == CompareIC::SYMBOLS); 6623 ASSERT(state_ == CompareIC::SYMBOLS);
6610 Label miss; 6624 Label miss;
6611 6625
6612 // Registers containing left and right operands respectively. 6626 // Registers containing left and right operands respectively.
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
7380 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, 7394 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2,
7381 &slow_elements); 7395 &slow_elements);
7382 __ Ret(); 7396 __ Ret();
7383 } 7397 }
7384 7398
7385 #undef __ 7399 #undef __
7386 7400
7387 } } // namespace v8::internal 7401 } } // namespace v8::internal
7388 7402
7389 #endif // V8_TARGET_ARCH_ARM 7403 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698