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