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 5627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5638 __ Cset(output, eq); | 5638 __ Cset(output, eq); |
5639 __ Ccmp(input, false_root, ZFlag, ne); | 5639 __ Ccmp(input, false_root, ZFlag, ne); |
5640 __ B(eq, &done); | 5640 __ B(eq, &done); |
5641 | 5641 |
5642 // Output contains zero, undefined is converted to zero for truncating | 5642 // Output contains zero, undefined is converted to zero for truncating |
5643 // conversions. | 5643 // conversions. |
5644 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, | 5644 DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex, |
5645 instr->environment()); | 5645 instr->environment()); |
5646 } else { | 5646 } else { |
5647 Register output = ToRegister32(instr->result()); | 5647 Register output = ToRegister32(instr->result()); |
5648 | |
5649 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); | 5648 DoubleRegister dbl_scratch2 = ToDoubleRegister(temp2); |
5650 | 5649 |
5651 // Deoptimized if it's not a heap number. | 5650 __ RecordComment("Deferred TaggedToI: not a heap number"); |
5652 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, | 5651 DeoptimizeIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, |
5653 instr->environment()); | 5652 instr->environment()); |
5654 | 5653 |
5655 // A heap number: load value and convert to int32 using non-truncating | 5654 // A heap number: load value and convert to int32 using non-truncating |
5656 // function. If the result is out of range, branch to deoptimize. | 5655 // function. If the result is out of range, branch to deoptimize. |
5657 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); | 5656 __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset)); |
5658 __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2); | 5657 __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2); |
| 5658 __ RecordComment("Deferred TaggedToI: lost precision or NaN"); |
5659 DeoptimizeIf(ne, instr->environment()); | 5659 DeoptimizeIf(ne, instr->environment()); |
5660 | 5660 |
5661 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 5661 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
5662 __ Cmp(output, 0); | 5662 __ Cmp(output, 0); |
5663 __ B(ne, &done); | 5663 __ B(ne, &done); |
5664 __ Fmov(scratch1, dbl_scratch1); | 5664 __ Fmov(scratch1, dbl_scratch1); |
| 5665 __ RecordComment("Deferred TaggedToI: minus zero"); |
5665 DeoptimizeIfNegative(scratch1, instr->environment()); | 5666 DeoptimizeIfNegative(scratch1, instr->environment()); |
5666 } | 5667 } |
5667 } | 5668 } |
5668 __ Bind(&done); | 5669 __ Bind(&done); |
5669 } | 5670 } |
5670 | 5671 |
5671 | 5672 |
5672 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 5673 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
5673 class DeferredTaggedToI: public LDeferredCode { | 5674 class DeferredTaggedToI: public LDeferredCode { |
5674 public: | 5675 public: |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6055 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6056 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6056 __ Push(scope_info); | 6057 __ Push(scope_info); |
6057 __ Push(ToRegister(instr->function())); | 6058 __ Push(ToRegister(instr->function())); |
6058 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6059 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6059 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6060 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6060 } | 6061 } |
6061 | 6062 |
6062 | 6063 |
6063 | 6064 |
6064 } } // namespace v8::internal | 6065 } } // namespace v8::internal |
OLD | NEW |