OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 STATIC_ASSERT(kSmiTag == 0); | 546 STATIC_ASSERT(kSmiTag == 0); |
547 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); | 547 DCHECK_EQ(static_cast<Smi*>(0), Smi::FromInt(0)); |
548 __ and_(r2, lhs, Operand(rhs)); | 548 __ and_(r2, lhs, Operand(rhs)); |
549 __ JumpIfNotSmi(r2, ¬_smis); | 549 __ JumpIfNotSmi(r2, ¬_smis); |
550 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: | 550 // One operand is a smi. EmitSmiNonsmiComparison generates code that can: |
551 // 1) Return the answer. | 551 // 1) Return the answer. |
552 // 2) Go to slow. | 552 // 2) Go to slow. |
553 // 3) Fall through to both_loaded_as_doubles. | 553 // 3) Fall through to both_loaded_as_doubles. |
554 // 4) Jump to lhs_not_nan. | 554 // 4) Jump to lhs_not_nan. |
555 // In cases 3 and 4 we have found out we were dealing with a number-number | 555 // In cases 3 and 4 we have found out we were dealing with a number-number |
556 // comparison. If VFP3 is supported the double values of the numbers have | 556 // comparison. The double values of the numbers have been loaded into d7 (lhs) |
557 // been loaded into d7 and d6. Otherwise, the double values have been loaded | 557 // and d6 (rhs). |
558 // into r0, r1, r2, and r3. | |
559 EmitSmiNonsmiComparison(masm, lhs, rhs, &lhs_not_nan, &slow, strict()); | 558 EmitSmiNonsmiComparison(masm, lhs, rhs, &lhs_not_nan, &slow, strict()); |
560 | 559 |
561 __ bind(&both_loaded_as_doubles); | 560 __ bind(&both_loaded_as_doubles); |
562 // The arguments have been converted to doubles and stored in d6 and d7, if | 561 // The arguments have been converted to doubles and stored in d6 and d7. |
563 // VFP3 is supported, or in r0, r1, r2, and r3. | |
564 __ bind(&lhs_not_nan); | 562 __ bind(&lhs_not_nan); |
565 Label no_nan; | 563 Label no_nan; |
566 // ARMv7 VFP3 instructions to implement double precision comparison. | |
567 __ VFPCompareAndSetFlags(d7, d6); | 564 __ VFPCompareAndSetFlags(d7, d6); |
568 Label nan; | 565 Label nan; |
569 __ b(vs, &nan); | 566 __ b(vs, &nan); |
570 __ mov(r0, Operand(EQUAL), LeaveCC, eq); | 567 __ mov(r0, Operand(EQUAL), LeaveCC, eq); |
571 __ mov(r0, Operand(LESS), LeaveCC, lt); | 568 __ mov(r0, Operand(LESS), LeaveCC, lt); |
572 __ mov(r0, Operand(GREATER), LeaveCC, gt); | 569 __ mov(r0, Operand(GREATER), LeaveCC, gt); |
573 __ Ret(); | 570 __ Ret(); |
574 | 571 |
575 __ bind(&nan); | 572 __ bind(&nan); |
576 // If one of the sides was a NaN then the v flag is set. Load r0 with | 573 // If one of the sides was a NaN then the v flag is set. Load r0 with |
(...skipping 4603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5180 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5177 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5181 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5178 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5182 } | 5179 } |
5183 | 5180 |
5184 #undef __ | 5181 #undef __ |
5185 | 5182 |
5186 } // namespace internal | 5183 } // namespace internal |
5187 } // namespace v8 | 5184 } // namespace v8 |
5188 | 5185 |
5189 #endif // V8_TARGET_ARCH_ARM | 5186 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |