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-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 5613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5624 __ Ccmp(input, false_root, ZFlag, ne); | 5624 __ Ccmp(input, false_root, ZFlag, ne); |
5625 __ B(eq, &done); | 5625 __ B(eq, &done); |
5626 | 5626 |
5627 // Output contains zero, undefined is converted to zero for truncating | 5627 // Output contains zero, undefined is converted to zero for truncating |
5628 // conversions. | 5628 // conversions. |
5629 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, instr); | 5629 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, instr); |
5630 } else { | 5630 } else { |
5631 Register output = ToRegister32(instr->result()); | 5631 Register output = ToRegister32(instr->result()); |
5632 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); | 5632 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); |
5633 | 5633 |
5634 __ RecordComment("Deferred TaggedToI: not a heap number"); | 5634 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, instr, |
5635 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, instr); | 5635 "not a heap number"); |
5636 | 5636 |
5637 // A heap number: load value and convert to int32 using non-truncating | 5637 // A heap number: load value and convert to int32 using non-truncating |
5638 // function. If the result is out of range, branch to deoptimize. | 5638 // function. If the result is out of range, branch to deoptimize. |
5639 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); | 5639 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); |
5640 __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2); | 5640 __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2); |
5641 __ RecordComment("Deferred TaggedToI: lost precision or NaN"); | 5641 DeoptimizeIf(ne, instr, "lost precision or NaN"); |
5642 DeoptimizeIf(ne, instr); | |
5643 | 5642 |
5644 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 5643 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
5645 __ Cmp(output, 0); | 5644 __ Cmp(output, 0); |
5646 __ B(ne, &done); | 5645 __ B(ne, &done); |
5647 __ Fmov(scratch1, dbl_scratch1); | 5646 __ Fmov(scratch1, dbl_scratch1); |
5648 __ RecordComment("Deferred TaggedToI: minus zero"); | 5647 DeoptimizeIfNegative(scratch1, instr, "minus zero"); |
5649 DeoptimizeIfNegative(scratch1, instr); | |
5650 } | 5648 } |
5651 } | 5649 } |
5652 __ Bind(&done); | 5650 __ Bind(&done); |
5653 } | 5651 } |
5654 | 5652 |
5655 | 5653 |
5656 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5654 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
5657 class DeferredTaggedToI: public LDeferredCode { | 5655 class DeferredTaggedToI: public LDeferredCode { |
5658 public: | 5656 public: |
5659 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 5657 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6039 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6037 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6040 __ Push(scope_info); | 6038 __ Push(scope_info); |
6041 __ Push(ToRegister(instr->function())); | 6039 __ Push(ToRegister(instr->function())); |
6042 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6040 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6043 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6041 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6044 } | 6042 } |
6045 | 6043 |
6046 | 6044 |
6047 | 6045 |
6048 } } // namespace v8::internal | 6046 } } // namespace v8::internal |
OLD | NEW |