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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3598 } else { | 3598 } else { |
3599 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof other"); | 3599 ASM_LOCATION("FullCodeGenerator::EmitLiteralCompareTypeof other"); |
3600 if (if_false != fall_through) __ B(if_false); | 3600 if (if_false != fall_through) __ B(if_false); |
3601 } | 3601 } |
3602 context()->Plug(if_true, if_false); | 3602 context()->Plug(if_true, if_false); |
3603 } | 3603 } |
3604 | 3604 |
3605 | 3605 |
3606 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 3606 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
3607 Comment cmnt(masm_, "[ CompareOperation"); | 3607 Comment cmnt(masm_, "[ CompareOperation"); |
3608 SetExpressionPosition(expr); | |
3609 | 3608 |
3610 // Try to generate an optimized comparison with a literal value. | 3609 // Try to generate an optimized comparison with a literal value. |
3611 // TODO(jbramley): This only checks common values like NaN or undefined. | 3610 // TODO(jbramley): This only checks common values like NaN or undefined. |
3612 // Should it also handle ARM64 immediate operands? | 3611 // Should it also handle ARM64 immediate operands? |
3613 if (TryLiteralCompare(expr)) { | 3612 if (TryLiteralCompare(expr)) { |
3614 return; | 3613 return; |
3615 } | 3614 } |
3616 | 3615 |
3617 // Assign labels according to context()->PrepareTest. | 3616 // Assign labels according to context()->PrepareTest. |
3618 Label materialize_true; | 3617 Label materialize_true; |
3619 Label materialize_false; | 3618 Label materialize_false; |
3620 Label* if_true = NULL; | 3619 Label* if_true = NULL; |
3621 Label* if_false = NULL; | 3620 Label* if_false = NULL; |
3622 Label* fall_through = NULL; | 3621 Label* fall_through = NULL; |
3623 context()->PrepareTest(&materialize_true, &materialize_false, | 3622 context()->PrepareTest(&materialize_true, &materialize_false, |
3624 &if_true, &if_false, &fall_through); | 3623 &if_true, &if_false, &fall_through); |
3625 | 3624 |
3626 Token::Value op = expr->op(); | 3625 Token::Value op = expr->op(); |
3627 VisitForStackValue(expr->left()); | 3626 VisitForStackValue(expr->left()); |
3628 switch (op) { | 3627 switch (op) { |
3629 case Token::IN: | 3628 case Token::IN: |
3630 VisitForStackValue(expr->right()); | 3629 VisitForStackValue(expr->right()); |
| 3630 SetExpressionPosition(expr); |
3631 CallRuntimeWithOperands(Runtime::kHasProperty); | 3631 CallRuntimeWithOperands(Runtime::kHasProperty); |
3632 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3632 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3633 __ CompareRoot(x0, Heap::kTrueValueRootIndex); | 3633 __ CompareRoot(x0, Heap::kTrueValueRootIndex); |
3634 Split(eq, if_true, if_false, fall_through); | 3634 Split(eq, if_true, if_false, fall_through); |
3635 break; | 3635 break; |
3636 | 3636 |
3637 case Token::INSTANCEOF: { | 3637 case Token::INSTANCEOF: { |
3638 VisitForAccumulatorValue(expr->right()); | 3638 VisitForAccumulatorValue(expr->right()); |
| 3639 SetExpressionPosition(expr); |
3639 PopOperand(x1); | 3640 PopOperand(x1); |
3640 InstanceOfStub stub(isolate()); | 3641 InstanceOfStub stub(isolate()); |
3641 __ CallStub(&stub); | 3642 __ CallStub(&stub); |
3642 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3643 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3643 __ CompareRoot(x0, Heap::kTrueValueRootIndex); | 3644 __ CompareRoot(x0, Heap::kTrueValueRootIndex); |
3644 Split(eq, if_true, if_false, fall_through); | 3645 Split(eq, if_true, if_false, fall_through); |
3645 break; | 3646 break; |
3646 } | 3647 } |
3647 | 3648 |
3648 default: { | 3649 default: { |
3649 VisitForAccumulatorValue(expr->right()); | 3650 VisitForAccumulatorValue(expr->right()); |
| 3651 SetExpressionPosition(expr); |
3650 Condition cond = CompareIC::ComputeCondition(op); | 3652 Condition cond = CompareIC::ComputeCondition(op); |
3651 | 3653 |
3652 // Pop the stack value. | 3654 // Pop the stack value. |
3653 PopOperand(x1); | 3655 PopOperand(x1); |
3654 | 3656 |
3655 JumpPatchSite patch_site(masm_); | 3657 JumpPatchSite patch_site(masm_); |
3656 if (ShouldInlineSmiCase(op)) { | 3658 if (ShouldInlineSmiCase(op)) { |
3657 Label slow_case; | 3659 Label slow_case; |
3658 patch_site.EmitJumpIfEitherNotSmi(x0, x1, &slow_case); | 3660 patch_site.EmitJumpIfEitherNotSmi(x0, x1, &slow_case); |
3659 __ Cmp(x1, x0); | 3661 __ Cmp(x1, x0); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4029 } | 4031 } |
4030 | 4032 |
4031 return INTERRUPT; | 4033 return INTERRUPT; |
4032 } | 4034 } |
4033 | 4035 |
4034 | 4036 |
4035 } // namespace internal | 4037 } // namespace internal |
4036 } // namespace v8 | 4038 } // namespace v8 |
4037 | 4039 |
4038 #endif // V8_TARGET_ARCH_ARM64 | 4040 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |