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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3578 // clang-format on | 3578 // clang-format on |
3579 } else { | 3579 } else { |
3580 if (if_false != fall_through) __ jmp(if_false); | 3580 if (if_false != fall_through) __ jmp(if_false); |
3581 } | 3581 } |
3582 context()->Plug(if_true, if_false); | 3582 context()->Plug(if_true, if_false); |
3583 } | 3583 } |
3584 | 3584 |
3585 | 3585 |
3586 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 3586 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
3587 Comment cmnt(masm_, "[ CompareOperation"); | 3587 Comment cmnt(masm_, "[ CompareOperation"); |
3588 SetExpressionPosition(expr); | |
3589 | 3588 |
3590 // First we try a fast inlined version of the compare when one of | 3589 // First we try a fast inlined version of the compare when one of |
3591 // the operands is a literal. | 3590 // the operands is a literal. |
3592 if (TryLiteralCompare(expr)) return; | 3591 if (TryLiteralCompare(expr)) return; |
3593 | 3592 |
3594 // Always perform the comparison for its control flow. Pack the result | 3593 // Always perform the comparison for its control flow. Pack the result |
3595 // into the expression's context after the comparison is performed. | 3594 // into the expression's context after the comparison is performed. |
3596 Label materialize_true, materialize_false; | 3595 Label materialize_true, materialize_false; |
3597 Label* if_true = NULL; | 3596 Label* if_true = NULL; |
3598 Label* if_false = NULL; | 3597 Label* if_false = NULL; |
3599 Label* fall_through = NULL; | 3598 Label* fall_through = NULL; |
3600 context()->PrepareTest(&materialize_true, &materialize_false, | 3599 context()->PrepareTest(&materialize_true, &materialize_false, |
3601 &if_true, &if_false, &fall_through); | 3600 &if_true, &if_false, &fall_through); |
3602 | 3601 |
3603 Token::Value op = expr->op(); | 3602 Token::Value op = expr->op(); |
3604 VisitForStackValue(expr->left()); | 3603 VisitForStackValue(expr->left()); |
3605 switch (op) { | 3604 switch (op) { |
3606 case Token::IN: | 3605 case Token::IN: |
3607 VisitForStackValue(expr->right()); | 3606 VisitForStackValue(expr->right()); |
| 3607 SetExpressionPosition(expr); |
3608 CallRuntimeWithOperands(Runtime::kHasProperty); | 3608 CallRuntimeWithOperands(Runtime::kHasProperty); |
3609 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3609 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3610 __ cmp(eax, isolate()->factory()->true_value()); | 3610 __ cmp(eax, isolate()->factory()->true_value()); |
3611 Split(equal, if_true, if_false, fall_through); | 3611 Split(equal, if_true, if_false, fall_through); |
3612 break; | 3612 break; |
3613 | 3613 |
3614 case Token::INSTANCEOF: { | 3614 case Token::INSTANCEOF: { |
3615 VisitForAccumulatorValue(expr->right()); | 3615 VisitForAccumulatorValue(expr->right()); |
| 3616 SetExpressionPosition(expr); |
3616 PopOperand(edx); | 3617 PopOperand(edx); |
3617 InstanceOfStub stub(isolate()); | 3618 InstanceOfStub stub(isolate()); |
3618 __ CallStub(&stub); | 3619 __ CallStub(&stub); |
3619 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3620 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3620 __ cmp(eax, isolate()->factory()->true_value()); | 3621 __ cmp(eax, isolate()->factory()->true_value()); |
3621 Split(equal, if_true, if_false, fall_through); | 3622 Split(equal, if_true, if_false, fall_through); |
3622 break; | 3623 break; |
3623 } | 3624 } |
3624 | 3625 |
3625 default: { | 3626 default: { |
3626 VisitForAccumulatorValue(expr->right()); | 3627 VisitForAccumulatorValue(expr->right()); |
| 3628 SetExpressionPosition(expr); |
3627 Condition cc = CompareIC::ComputeCondition(op); | 3629 Condition cc = CompareIC::ComputeCondition(op); |
3628 PopOperand(edx); | 3630 PopOperand(edx); |
3629 | 3631 |
3630 bool inline_smi_code = ShouldInlineSmiCase(op); | 3632 bool inline_smi_code = ShouldInlineSmiCase(op); |
3631 JumpPatchSite patch_site(masm_); | 3633 JumpPatchSite patch_site(masm_); |
3632 if (inline_smi_code) { | 3634 if (inline_smi_code) { |
3633 Label slow_case; | 3635 Label slow_case; |
3634 __ mov(ecx, edx); | 3636 __ mov(ecx, edx); |
3635 __ or_(ecx, eax); | 3637 __ or_(ecx, eax); |
3636 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); | 3638 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3862 isolate->builtins()->OnStackReplacement()->entry(), | 3864 isolate->builtins()->OnStackReplacement()->entry(), |
3863 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3865 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3864 return ON_STACK_REPLACEMENT; | 3866 return ON_STACK_REPLACEMENT; |
3865 } | 3867 } |
3866 | 3868 |
3867 | 3869 |
3868 } // namespace internal | 3870 } // namespace internal |
3869 } // namespace v8 | 3871 } // namespace v8 |
3870 | 3872 |
3871 #endif // V8_TARGET_ARCH_X87 | 3873 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |