OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 3560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3571 // clang-format on | 3571 // clang-format on |
3572 } else { | 3572 } else { |
3573 if (if_false != fall_through) __ jmp(if_false); | 3573 if (if_false != fall_through) __ jmp(if_false); |
3574 } | 3574 } |
3575 context()->Plug(if_true, if_false); | 3575 context()->Plug(if_true, if_false); |
3576 } | 3576 } |
3577 | 3577 |
3578 | 3578 |
3579 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 3579 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
3580 Comment cmnt(masm_, "[ CompareOperation"); | 3580 Comment cmnt(masm_, "[ CompareOperation"); |
3581 SetExpressionPosition(expr); | |
3582 | 3581 |
3583 // First we try a fast inlined version of the compare when one of | 3582 // First we try a fast inlined version of the compare when one of |
3584 // the operands is a literal. | 3583 // the operands is a literal. |
3585 if (TryLiteralCompare(expr)) return; | 3584 if (TryLiteralCompare(expr)) return; |
3586 | 3585 |
3587 // Always perform the comparison for its control flow. Pack the result | 3586 // Always perform the comparison for its control flow. Pack the result |
3588 // into the expression's context after the comparison is performed. | 3587 // into the expression's context after the comparison is performed. |
3589 Label materialize_true, materialize_false; | 3588 Label materialize_true, materialize_false; |
3590 Label* if_true = NULL; | 3589 Label* if_true = NULL; |
3591 Label* if_false = NULL; | 3590 Label* if_false = NULL; |
3592 Label* fall_through = NULL; | 3591 Label* fall_through = NULL; |
3593 context()->PrepareTest(&materialize_true, &materialize_false, | 3592 context()->PrepareTest(&materialize_true, &materialize_false, |
3594 &if_true, &if_false, &fall_through); | 3593 &if_true, &if_false, &fall_through); |
3595 | 3594 |
3596 Token::Value op = expr->op(); | 3595 Token::Value op = expr->op(); |
3597 VisitForStackValue(expr->left()); | 3596 VisitForStackValue(expr->left()); |
3598 switch (op) { | 3597 switch (op) { |
3599 case Token::IN: | 3598 case Token::IN: |
3600 VisitForStackValue(expr->right()); | 3599 VisitForStackValue(expr->right()); |
| 3600 SetExpressionPosition(expr); |
3601 CallRuntimeWithOperands(Runtime::kHasProperty); | 3601 CallRuntimeWithOperands(Runtime::kHasProperty); |
3602 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3602 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3603 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 3603 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
3604 Split(equal, if_true, if_false, fall_through); | 3604 Split(equal, if_true, if_false, fall_through); |
3605 break; | 3605 break; |
3606 | 3606 |
3607 case Token::INSTANCEOF: { | 3607 case Token::INSTANCEOF: { |
3608 VisitForAccumulatorValue(expr->right()); | 3608 VisitForAccumulatorValue(expr->right()); |
| 3609 SetExpressionPosition(expr); |
3609 PopOperand(rdx); | 3610 PopOperand(rdx); |
3610 InstanceOfStub stub(isolate()); | 3611 InstanceOfStub stub(isolate()); |
3611 __ CallStub(&stub); | 3612 __ CallStub(&stub); |
3612 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3613 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3613 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 3614 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
3614 Split(equal, if_true, if_false, fall_through); | 3615 Split(equal, if_true, if_false, fall_through); |
3615 break; | 3616 break; |
3616 } | 3617 } |
3617 | 3618 |
3618 default: { | 3619 default: { |
3619 VisitForAccumulatorValue(expr->right()); | 3620 VisitForAccumulatorValue(expr->right()); |
| 3621 SetExpressionPosition(expr); |
3620 Condition cc = CompareIC::ComputeCondition(op); | 3622 Condition cc = CompareIC::ComputeCondition(op); |
3621 PopOperand(rdx); | 3623 PopOperand(rdx); |
3622 | 3624 |
3623 bool inline_smi_code = ShouldInlineSmiCase(op); | 3625 bool inline_smi_code = ShouldInlineSmiCase(op); |
3624 JumpPatchSite patch_site(masm_); | 3626 JumpPatchSite patch_site(masm_); |
3625 if (inline_smi_code) { | 3627 if (inline_smi_code) { |
3626 Label slow_case; | 3628 Label slow_case; |
3627 __ movp(rcx, rdx); | 3629 __ movp(rcx, rdx); |
3628 __ orp(rcx, rax); | 3630 __ orp(rcx, rax); |
3629 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); | 3631 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3854 DCHECK_EQ( | 3856 DCHECK_EQ( |
3855 isolate->builtins()->OnStackReplacement()->entry(), | 3857 isolate->builtins()->OnStackReplacement()->entry(), |
3856 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3858 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3857 return ON_STACK_REPLACEMENT; | 3859 return ON_STACK_REPLACEMENT; |
3858 } | 3860 } |
3859 | 3861 |
3860 } // namespace internal | 3862 } // namespace internal |
3861 } // namespace v8 | 3863 } // namespace v8 |
3862 | 3864 |
3863 #endif // V8_TARGET_ARCH_X64 | 3865 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |