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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 10990024: ARM: Small optimisation of VFP immediate creation (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 2 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 | « src/arm/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 void LCodeGen::DoConstantI(LConstantI* instr) { 1544 void LCodeGen::DoConstantI(LConstantI* instr) {
1545 ASSERT(instr->result()->IsRegister()); 1545 ASSERT(instr->result()->IsRegister());
1546 __ mov(ToRegister(instr->result()), Operand(instr->value())); 1546 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1547 } 1547 }
1548 1548
1549 1549
1550 void LCodeGen::DoConstantD(LConstantD* instr) { 1550 void LCodeGen::DoConstantD(LConstantD* instr) {
1551 ASSERT(instr->result()->IsDoubleRegister()); 1551 ASSERT(instr->result()->IsDoubleRegister());
1552 DwVfpRegister result = ToDoubleRegister(instr->result()); 1552 DwVfpRegister result = ToDoubleRegister(instr->result());
1553 double v = instr->value(); 1553 double v = instr->value();
1554 __ Vmov(result, v); 1554 __ Vmov(result, v, scratch0());
1555 } 1555 }
1556 1556
1557 1557
1558 void LCodeGen::DoConstantT(LConstantT* instr) { 1558 void LCodeGen::DoConstantT(LConstantT* instr) {
1559 Handle<Object> value = instr->value(); 1559 Handle<Object> value = instr->value();
1560 if (value->IsSmi()) { 1560 if (value->IsSmi()) {
1561 __ mov(ToRegister(instr->result()), Operand(value)); 1561 __ mov(ToRegister(instr->result()), Operand(value));
1562 } else { 1562 } else {
1563 __ LoadHeapObject(ToRegister(instr->result()), 1563 __ LoadHeapObject(ToRegister(instr->result()),
1564 Handle<HeapObject>::cast(value)); 1564 Handle<HeapObject>::cast(value));
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 __ b(le, &check_sign_on_zero); 3523 __ b(le, &check_sign_on_zero);
3524 } else { 3524 } else {
3525 __ b(le, &done); 3525 __ b(le, &done);
3526 } 3526 }
3527 3527
3528 // The following conversion will not work with numbers 3528 // The following conversion will not work with numbers
3529 // outside of ]-2^32, 2^32[. 3529 // outside of ]-2^32, 2^32[.
3530 __ cmp(scratch, Operand(HeapNumber::kExponentBias + 32)); 3530 __ cmp(scratch, Operand(HeapNumber::kExponentBias + 32));
3531 DeoptimizeIf(ge, instr->environment()); 3531 DeoptimizeIf(ge, instr->environment());
3532 3532
3533 __ Vmov(double_scratch0(), 0.5, scratch);
3534 __ vadd(double_scratch0(), input, double_scratch0());
3535
3533 // Save the original sign for later comparison. 3536 // Save the original sign for later comparison.
3534 __ and_(scratch, result, Operand(HeapNumber::kSignMask)); 3537 __ and_(scratch, result, Operand(HeapNumber::kSignMask));
3535 3538
3536 __ Vmov(double_scratch0(), 0.5);
3537 __ vadd(double_scratch0(), input, double_scratch0());
3538
3539 // Check sign of the result: if the sign changed, the input 3539 // Check sign of the result: if the sign changed, the input
3540 // value was in ]0.5, 0[ and the result should be -0. 3540 // value was in ]0.5, 0[ and the result should be -0.
3541 __ vmov(result, double_scratch0().high()); 3541 __ vmov(result, double_scratch0().high());
3542 __ eor(result, result, Operand(scratch), SetCC); 3542 __ eor(result, result, Operand(scratch), SetCC);
3543 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 3543 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
3544 DeoptimizeIf(mi, instr->environment()); 3544 DeoptimizeIf(mi, instr->environment());
3545 } else { 3545 } else {
3546 __ mov(result, Operand(0), LeaveCC, mi); 3546 __ mov(result, Operand(0), LeaveCC, mi);
3547 __ b(mi, &done); 3547 __ b(mi, &done);
3548 } 3548 }
(...skipping 28 matching lines...) Expand all
3577 3577
3578 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { 3578 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) {
3579 DoubleRegister input = ToDoubleRegister(instr->value()); 3579 DoubleRegister input = ToDoubleRegister(instr->value());
3580 DoubleRegister result = ToDoubleRegister(instr->result()); 3580 DoubleRegister result = ToDoubleRegister(instr->result());
3581 DoubleRegister temp = ToDoubleRegister(instr->temp()); 3581 DoubleRegister temp = ToDoubleRegister(instr->temp());
3582 3582
3583 // Note that according to ECMA-262 15.8.2.13: 3583 // Note that according to ECMA-262 15.8.2.13:
3584 // Math.pow(-Infinity, 0.5) == Infinity 3584 // Math.pow(-Infinity, 0.5) == Infinity
3585 // Math.sqrt(-Infinity) == NaN 3585 // Math.sqrt(-Infinity) == NaN
3586 Label done; 3586 Label done;
3587 __ vmov(temp, -V8_INFINITY); 3587 __ vmov(temp, -V8_INFINITY, scratch0());
3588 __ VFPCompareAndSetFlags(input, temp); 3588 __ VFPCompareAndSetFlags(input, temp);
3589 __ vneg(result, temp, eq); 3589 __ vneg(result, temp, eq);
3590 __ b(&done, eq); 3590 __ b(&done, eq);
3591 3591
3592 // Add +0 to convert -0 to +0. 3592 // Add +0 to convert -0 to +0.
3593 __ vadd(result, input, kDoubleRegZero); 3593 __ vadd(result, input, kDoubleRegZero);
3594 __ vsqrt(result, result); 3594 __ vsqrt(result, result);
3595 __ bind(&done); 3595 __ bind(&done);
3596 } 3596 }
3597 3597
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4059 __ add(scratch, scratch, 4059 __ add(scratch, scratch,
4060 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); 4060 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
4061 } 4061 }
4062 4062
4063 if (instr->NeedsCanonicalization()) { 4063 if (instr->NeedsCanonicalization()) {
4064 // Check for NaN. All NaNs must be canonicalized. 4064 // Check for NaN. All NaNs must be canonicalized.
4065 __ VFPCompareAndSetFlags(value, value); 4065 __ VFPCompareAndSetFlags(value, value);
4066 // Only load canonical NaN if the comparison above set the overflow. 4066 // Only load canonical NaN if the comparison above set the overflow.
4067 __ Vmov(value, 4067 __ Vmov(value,
4068 FixedDoubleArray::canonical_not_the_hole_nan_as_double(), 4068 FixedDoubleArray::canonical_not_the_hole_nan_as_double(),
4069 vs); 4069 no_reg, vs);
4070 } 4070 }
4071 4071
4072 __ vstr(value, scratch, instr->additional_index() << element_size_shift); 4072 __ vstr(value, scratch, instr->additional_index() << element_size_shift);
4073 } 4073 }
4074 4074
4075 4075
4076 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 4076 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
4077 LStoreKeyedSpecializedArrayElement* instr) { 4077 LStoreKeyedSpecializedArrayElement* instr) {
4078 4078
4079 Register external_pointer = ToRegister(instr->external_pointer()); 4079 Register external_pointer = ToRegister(instr->external_pointer());
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
5660 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5660 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5661 __ ldr(result, FieldMemOperand(scratch, 5661 __ ldr(result, FieldMemOperand(scratch,
5662 FixedArray::kHeaderSize - kPointerSize)); 5662 FixedArray::kHeaderSize - kPointerSize));
5663 __ bind(&done); 5663 __ bind(&done);
5664 } 5664 }
5665 5665
5666 5666
5667 #undef __ 5667 #undef __
5668 5668
5669 } } // namespace v8::internal 5669 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698