OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 CanDeoptimize can_deoptimize) { | 675 CanDeoptimize can_deoptimize) { |
676 info()->MarkAsNonDeferredCalling(); | 676 info()->MarkAsNonDeferredCalling(); |
677 | 677 |
678 #ifdef DEBUG | 678 #ifdef DEBUG |
679 instr->VerifyCall(); | 679 instr->VerifyCall(); |
680 #endif | 680 #endif |
681 instr->MarkAsCall(); | 681 instr->MarkAsCall(); |
682 instr = AssignPointerMap(instr); | 682 instr = AssignPointerMap(instr); |
683 | 683 |
684 if (hinstr->HasObservableSideEffects()) { | 684 if (hinstr->HasObservableSideEffects()) { |
685 ASSERT(hinstr->next()->IsSimulate()); | |
686 HSimulate* sim = HSimulate::cast(hinstr->next()); | |
687 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 685 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
688 ASSERT(pending_deoptimization_ast_id_.IsNone()); | 686 ASSERT(pending_deoptimization_ast_id_.IsNone()); |
| 687 if (!hinstr->IsControlInstruction()) { |
| 688 ASSERT(hinstr->next()->IsSimulate()); |
| 689 HSimulate* sim = HSimulate::cast(hinstr->next()); |
| 690 pending_deoptimization_ast_id_ = sim->ast_id(); |
| 691 } else { |
| 692 pending_deoptimization_ast_id_ = BailoutId::PendingMarker(); |
| 693 } |
689 instruction_pending_deoptimization_environment_ = instr; | 694 instruction_pending_deoptimization_environment_ = instr; |
690 pending_deoptimization_ast_id_ = sim->ast_id(); | |
691 } | 695 } |
692 | 696 |
693 // If instruction does not have side-effects lazy deoptimization | 697 // If instruction does not have side-effects lazy deoptimization |
694 // after the call will try to deoptimize to the point before the call. | 698 // after the call will try to deoptimize to the point before the call. |
695 // Thus we still need to attach environment to this call even if | 699 // Thus we still need to attach environment to this call even if |
696 // call sequence can not deoptimize eagerly. | 700 // call sequence can not deoptimize eagerly. |
697 bool needs_environment = | 701 bool needs_environment = |
698 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 702 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
699 !hinstr->HasObservableSideEffects(); | 703 !hinstr->HasObservableSideEffects(); |
700 if (needs_environment && !instr->HasEnvironment()) { | 704 if (needs_environment && !instr->HasEnvironment()) { |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 LOperand* global_object = UseTempRegister(instr->global_object()); | 1697 LOperand* global_object = UseTempRegister(instr->global_object()); |
1694 LOperand* scratch = TempRegister(); | 1698 LOperand* scratch = TempRegister(); |
1695 LOperand* scratch2 = TempRegister(); | 1699 LOperand* scratch2 = TempRegister(); |
1696 LOperand* scratch3 = TempRegister(); | 1700 LOperand* scratch3 = TempRegister(); |
1697 LRandom* result = new(zone()) LRandom( | 1701 LRandom* result = new(zone()) LRandom( |
1698 global_object, scratch, scratch2, scratch3); | 1702 global_object, scratch, scratch2, scratch3); |
1699 return DefineFixedDouble(result, xmm1); | 1703 return DefineFixedDouble(result, xmm1); |
1700 } | 1704 } |
1701 | 1705 |
1702 | 1706 |
1703 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1707 LInstruction* LChunkBuilder::DoCompareGenericAndBranch( |
| 1708 HCompareGenericAndBranch* instr) { |
1704 ASSERT(instr->left()->representation().IsSmiOrTagged()); | 1709 ASSERT(instr->left()->representation().IsSmiOrTagged()); |
1705 ASSERT(instr->right()->representation().IsSmiOrTagged()); | 1710 ASSERT(instr->right()->representation().IsSmiOrTagged()); |
1706 LOperand* context = UseFixed(instr->context(), esi); | 1711 LOperand* context = UseFixed(instr->context(), esi); |
1707 LOperand* left = UseFixed(instr->left(), edx); | 1712 LOperand* left = UseFixed(instr->left(), edx); |
1708 LOperand* right = UseFixed(instr->right(), eax); | 1713 LOperand* right = UseFixed(instr->right(), eax); |
1709 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1714 return MarkAsCall(new(zone()) LCompareGenericAndBranch(context, left, right), |
1710 return MarkAsCall(DefineFixed(result, eax), instr); | 1715 instr); |
1711 } | 1716 } |
1712 | 1717 |
1713 | 1718 |
1714 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1719 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1715 HCompareNumericAndBranch* instr) { | 1720 HCompareNumericAndBranch* instr) { |
1716 Representation r = instr->representation(); | 1721 Representation r = instr->representation(); |
1717 if (r.IsSmiOrInteger32()) { | 1722 if (r.IsSmiOrInteger32()) { |
1718 ASSERT(instr->left()->representation().Equals(r)); | 1723 ASSERT(instr->left()->representation().Equals(r)); |
1719 ASSERT(instr->right()->representation().Equals(r)); | 1724 ASSERT(instr->right()->representation().Equals(r)); |
1720 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1725 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2624 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
2620 } | 2625 } |
2621 | 2626 |
2622 | 2627 |
2623 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2628 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
2624 instr->ReplayEnvironment(current_block_->last_environment()); | 2629 instr->ReplayEnvironment(current_block_->last_environment()); |
2625 | 2630 |
2626 // If there is an instruction pending deoptimization environment create a | 2631 // If there is an instruction pending deoptimization environment create a |
2627 // lazy bailout instruction to capture the environment. | 2632 // lazy bailout instruction to capture the environment. |
2628 if (!pending_deoptimization_ast_id_.IsNone()) { | 2633 if (!pending_deoptimization_ast_id_.IsNone()) { |
2629 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); | 2634 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id() || |
| 2635 pending_deoptimization_ast_id_.IsPendingMarker()); |
2630 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2636 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
2631 LInstruction* result = AssignEnvironment(lazy_bailout); | 2637 LInstruction* result = AssignEnvironment(lazy_bailout); |
2632 // Store the lazy deopt environment with the instruction if needed. Right | 2638 // Store the lazy deopt environment with the instruction if needed. Right |
2633 // now it is only used for LInstanceOfKnownGlobal. | 2639 // now it is only used for LInstanceOfKnownGlobal. |
2634 instruction_pending_deoptimization_environment_-> | 2640 instruction_pending_deoptimization_environment_-> |
2635 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2641 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
2636 instruction_pending_deoptimization_environment_ = NULL; | 2642 instruction_pending_deoptimization_environment_ = NULL; |
2637 pending_deoptimization_ast_id_ = BailoutId::None(); | 2643 pending_deoptimization_ast_id_ = BailoutId::None(); |
2638 return result; | 2644 return result; |
2639 } | 2645 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2725 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2720 LOperand* object = UseRegister(instr->object()); | 2726 LOperand* object = UseRegister(instr->object()); |
2721 LOperand* index = UseTempRegister(instr->index()); | 2727 LOperand* index = UseTempRegister(instr->index()); |
2722 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2728 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2723 } | 2729 } |
2724 | 2730 |
2725 | 2731 |
2726 } } // namespace v8::internal | 2732 } } // namespace v8::internal |
2727 | 2733 |
2728 #endif // V8_TARGET_ARCH_IA32 | 2734 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |