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

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

Issue 134223003: A64: Implement LPower and extend MathPowStub to support args in registers (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: reupload Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 // Add +0.0 to convert -0.0 to +0.0. 3617 // Add +0.0 to convert -0.0 to +0.0.
3618 // TODO(jbramley): A constant zero register would be helpful here. 3618 // TODO(jbramley): A constant zero register would be helpful here.
3619 __ Fmov(double_scratch(), 0.0); 3619 __ Fmov(double_scratch(), 0.0);
3620 __ Fadd(double_scratch(), input, double_scratch()); 3620 __ Fadd(double_scratch(), input, double_scratch());
3621 __ Fsqrt(result, double_scratch()); 3621 __ Fsqrt(result, double_scratch());
3622 3622
3623 __ Bind(&done); 3623 __ Bind(&done);
3624 } 3624 }
3625 3625
3626 3626
3627 void LCodeGen::DoPower(LPower* instr) {
3628 Representation exponent_type = instr->hydrogen()->right()->representation();
3629 // Having marked this as a call, we can use any registers.
3630 // Just make sure that the input/output registers are the expected ones.
3631 ASSERT(!instr->right()->IsDoubleRegister() ||
3632 ToDoubleRegister(instr->right()).is(d1));
3633 ASSERT(!instr->right()->IsRegister() ||
3634 ToRegister(instr->right()).is(x11));
3635 ASSERT(ToDoubleRegister(instr->left()).is(d0));
3636 ASSERT(ToDoubleRegister(instr->result()).is(d0));
3637
3638 if (exponent_type.IsSmi()) {
3639 MathPowStub stub(MathPowStub::TAGGED);
3640 __ CallStub(&stub);
3641 } else if (exponent_type.IsTagged()) {
3642 Label no_deopt;
3643 __ JumpIfSmi(x11, &no_deopt);
3644 __ Ldr(x0, FieldMemOperand(x11, HeapObject::kMapOffset));
3645 DeoptimizeIfNotRoot(x0, Heap::kHeapNumberMapRootIndex,
3646 instr->environment());
3647 __ Bind(&no_deopt);
3648 MathPowStub stub(MathPowStub::TAGGED);
3649 __ CallStub(&stub);
3650 } else if (exponent_type.IsInteger32()) {
3651 MathPowStub stub(MathPowStub::INTEGER);
3652 __ CallStub(&stub);
3653 } else {
3654 ASSERT(exponent_type.IsDouble());
3655 MathPowStub stub(MathPowStub::DOUBLE);
3656 __ CallStub(&stub);
3657 }
3658 }
3659
3660
3627 void LCodeGen::DoMathRound(LMathRound* instr) { 3661 void LCodeGen::DoMathRound(LMathRound* instr) {
3628 // TODO(jbramley): We could provide a double result here using frint. 3662 // TODO(jbramley): We could provide a double result here using frint.
3629 DoubleRegister input = ToDoubleRegister(instr->value()); 3663 DoubleRegister input = ToDoubleRegister(instr->value());
3630 DoubleRegister temp1 = ToDoubleRegister(instr->temp1()); 3664 DoubleRegister temp1 = ToDoubleRegister(instr->temp1());
3631 Register result = ToRegister(instr->result()); 3665 Register result = ToRegister(instr->result());
3632 Label try_rounding; 3666 Label try_rounding;
3633 Label deopt; 3667 Label deopt;
3634 Label done; 3668 Label done;
3635 3669
3636 // Math.round() rounds to the nearest integer, with ties going towards 3670 // Math.round() rounds to the nearest integer, with ties going towards
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
5179 __ Bind(&out_of_object); 5213 __ Bind(&out_of_object);
5180 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5214 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5181 // Index is equal to negated out of object property index plus 1. 5215 // Index is equal to negated out of object property index plus 1.
5182 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5216 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5183 __ Ldr(result, FieldMemOperand(result, 5217 __ Ldr(result, FieldMemOperand(result,
5184 FixedArray::kHeaderSize - kPointerSize)); 5218 FixedArray::kHeaderSize - kPointerSize));
5185 __ Bind(&done); 5219 __ Bind(&done);
5186 } 5220 }
5187 5221
5188 } } // namespace v8::internal 5222 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698