OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4079 __ Fsqrt(result, double_scratch()); | 4079 __ Fsqrt(result, double_scratch()); |
4080 | 4080 |
4081 __ Bind(&done); | 4081 __ Bind(&done); |
4082 } | 4082 } |
4083 | 4083 |
4084 | 4084 |
4085 void LCodeGen::DoPower(LPower* instr) { | 4085 void LCodeGen::DoPower(LPower* instr) { |
4086 Representation exponent_type = instr->hydrogen()->right()->representation(); | 4086 Representation exponent_type = instr->hydrogen()->right()->representation(); |
4087 // Having marked this as a call, we can use any registers. | 4087 // Having marked this as a call, we can use any registers. |
4088 // Just make sure that the input/output registers are the expected ones. | 4088 // Just make sure that the input/output registers are the expected ones. |
| 4089 Register tagged_exponent = MathPowTaggedDescriptor::exponent(); |
| 4090 Register integer_exponent = MathPowIntegerDescriptor::exponent(); |
4089 DCHECK(!instr->right()->IsDoubleRegister() || | 4091 DCHECK(!instr->right()->IsDoubleRegister() || |
4090 ToDoubleRegister(instr->right()).is(d1)); | 4092 ToDoubleRegister(instr->right()).is(d1)); |
4091 DCHECK(exponent_type.IsInteger32() || !instr->right()->IsRegister() || | 4093 DCHECK(exponent_type.IsInteger32() || !instr->right()->IsRegister() || |
4092 ToRegister(instr->right()).is(x11)); | 4094 ToRegister(instr->right()).is(tagged_exponent)); |
4093 DCHECK(!exponent_type.IsInteger32() || ToRegister(instr->right()).is(x12)); | 4095 DCHECK(!exponent_type.IsInteger32() || |
| 4096 ToRegister(instr->right()).is(integer_exponent)); |
4094 DCHECK(ToDoubleRegister(instr->left()).is(d0)); | 4097 DCHECK(ToDoubleRegister(instr->left()).is(d0)); |
4095 DCHECK(ToDoubleRegister(instr->result()).is(d0)); | 4098 DCHECK(ToDoubleRegister(instr->result()).is(d0)); |
4096 | 4099 |
4097 if (exponent_type.IsSmi()) { | 4100 if (exponent_type.IsSmi()) { |
4098 MathPowStub stub(isolate(), MathPowStub::TAGGED); | 4101 MathPowStub stub(isolate(), MathPowStub::TAGGED); |
4099 __ CallStub(&stub); | 4102 __ CallStub(&stub); |
4100 } else if (exponent_type.IsTagged()) { | 4103 } else if (exponent_type.IsTagged()) { |
4101 Label no_deopt; | 4104 Label no_deopt; |
4102 __ JumpIfSmi(x11, &no_deopt); | 4105 __ JumpIfSmi(tagged_exponent, &no_deopt); |
4103 __ Ldr(x0, FieldMemOperand(x11, HeapObject::kMapOffset)); | 4106 DCHECK(!x0.is(tagged_exponent)); |
| 4107 __ Ldr(x0, FieldMemOperand(tagged_exponent, HeapObject::kMapOffset)); |
4104 DeoptimizeIfNotRoot(x0, Heap::kHeapNumberMapRootIndex, | 4108 DeoptimizeIfNotRoot(x0, Heap::kHeapNumberMapRootIndex, |
4105 instr->environment()); | 4109 instr->environment()); |
4106 __ Bind(&no_deopt); | 4110 __ Bind(&no_deopt); |
4107 MathPowStub stub(isolate(), MathPowStub::TAGGED); | 4111 MathPowStub stub(isolate(), MathPowStub::TAGGED); |
4108 __ CallStub(&stub); | 4112 __ CallStub(&stub); |
4109 } else if (exponent_type.IsInteger32()) { | 4113 } else if (exponent_type.IsInteger32()) { |
4110 // Ensure integer exponent has no garbage in top 32-bits, as MathPowStub | 4114 // Ensure integer exponent has no garbage in top 32-bits, as MathPowStub |
4111 // supports large integer exponents. | 4115 // supports large integer exponents. |
4112 Register exponent = ToRegister(instr->right()); | 4116 __ Sxtw(integer_exponent, integer_exponent); |
4113 __ Sxtw(exponent, exponent); | |
4114 MathPowStub stub(isolate(), MathPowStub::INTEGER); | 4117 MathPowStub stub(isolate(), MathPowStub::INTEGER); |
4115 __ CallStub(&stub); | 4118 __ CallStub(&stub); |
4116 } else { | 4119 } else { |
4117 DCHECK(exponent_type.IsDouble()); | 4120 DCHECK(exponent_type.IsDouble()); |
4118 MathPowStub stub(isolate(), MathPowStub::DOUBLE); | 4121 MathPowStub stub(isolate(), MathPowStub::DOUBLE); |
4119 __ CallStub(&stub); | 4122 __ CallStub(&stub); |
4120 } | 4123 } |
4121 } | 4124 } |
4122 | 4125 |
4123 | 4126 |
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6050 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6053 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6051 __ Push(scope_info); | 6054 __ Push(scope_info); |
6052 __ Push(ToRegister(instr->function())); | 6055 __ Push(ToRegister(instr->function())); |
6053 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6056 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6054 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6057 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6055 } | 6058 } |
6056 | 6059 |
6057 | 6060 |
6058 | 6061 |
6059 } } // namespace v8::internal | 6062 } } // namespace v8::internal |
OLD | NEW |