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()); |
685 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 687 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
686 ASSERT(pending_deoptimization_ast_id_.IsNone()); | 688 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 } | |
694 instruction_pending_deoptimization_environment_ = instr; | 689 instruction_pending_deoptimization_environment_ = instr; |
| 690 pending_deoptimization_ast_id_ = sim->ast_id(); |
695 } | 691 } |
696 | 692 |
697 // If instruction does not have side-effects lazy deoptimization | 693 // If instruction does not have side-effects lazy deoptimization |
698 // after the call will try to deoptimize to the point before the call. | 694 // after the call will try to deoptimize to the point before the call. |
699 // Thus we still need to attach environment to this call even if | 695 // Thus we still need to attach environment to this call even if |
700 // call sequence can not deoptimize eagerly. | 696 // call sequence can not deoptimize eagerly. |
701 bool needs_environment = | 697 bool needs_environment = |
702 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 698 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
703 !hinstr->HasObservableSideEffects(); | 699 !hinstr->HasObservableSideEffects(); |
704 if (needs_environment && !instr->HasEnvironment()) { | 700 if (needs_environment && !instr->HasEnvironment()) { |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 LOperand* global_object = UseTempRegister(instr->global_object()); | 1693 LOperand* global_object = UseTempRegister(instr->global_object()); |
1698 LOperand* scratch = TempRegister(); | 1694 LOperand* scratch = TempRegister(); |
1699 LOperand* scratch2 = TempRegister(); | 1695 LOperand* scratch2 = TempRegister(); |
1700 LOperand* scratch3 = TempRegister(); | 1696 LOperand* scratch3 = TempRegister(); |
1701 LRandom* result = new(zone()) LRandom( | 1697 LRandom* result = new(zone()) LRandom( |
1702 global_object, scratch, scratch2, scratch3); | 1698 global_object, scratch, scratch2, scratch3); |
1703 return DefineFixedDouble(result, xmm1); | 1699 return DefineFixedDouble(result, xmm1); |
1704 } | 1700 } |
1705 | 1701 |
1706 | 1702 |
1707 LInstruction* LChunkBuilder::DoCompareGenericAndBranch( | 1703 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1708 HCompareGenericAndBranch* instr) { | |
1709 ASSERT(instr->left()->representation().IsSmiOrTagged()); | 1704 ASSERT(instr->left()->representation().IsSmiOrTagged()); |
1710 ASSERT(instr->right()->representation().IsSmiOrTagged()); | 1705 ASSERT(instr->right()->representation().IsSmiOrTagged()); |
1711 LOperand* context = UseFixed(instr->context(), esi); | 1706 LOperand* context = UseFixed(instr->context(), esi); |
1712 LOperand* left = UseFixed(instr->left(), edx); | 1707 LOperand* left = UseFixed(instr->left(), edx); |
1713 LOperand* right = UseFixed(instr->right(), eax); | 1708 LOperand* right = UseFixed(instr->right(), eax); |
1714 return MarkAsCall(new(zone()) LCompareGenericAndBranch(context, left, right), | 1709 LCmpT* result = new(zone()) LCmpT(context, left, right); |
1715 instr); | 1710 return MarkAsCall(DefineFixed(result, eax), instr); |
1716 } | 1711 } |
1717 | 1712 |
1718 | 1713 |
1719 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1714 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1720 HCompareNumericAndBranch* instr) { | 1715 HCompareNumericAndBranch* instr) { |
1721 Representation r = instr->representation(); | 1716 Representation r = instr->representation(); |
1722 if (r.IsSmiOrInteger32()) { | 1717 if (r.IsSmiOrInteger32()) { |
1723 ASSERT(instr->left()->representation().Equals(r)); | 1718 ASSERT(instr->left()->representation().Equals(r)); |
1724 ASSERT(instr->right()->representation().Equals(r)); | 1719 ASSERT(instr->right()->representation().Equals(r)); |
1725 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1720 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2619 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
2625 } | 2620 } |
2626 | 2621 |
2627 | 2622 |
2628 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2623 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
2629 instr->ReplayEnvironment(current_block_->last_environment()); | 2624 instr->ReplayEnvironment(current_block_->last_environment()); |
2630 | 2625 |
2631 // If there is an instruction pending deoptimization environment create a | 2626 // If there is an instruction pending deoptimization environment create a |
2632 // lazy bailout instruction to capture the environment. | 2627 // lazy bailout instruction to capture the environment. |
2633 if (!pending_deoptimization_ast_id_.IsNone()) { | 2628 if (!pending_deoptimization_ast_id_.IsNone()) { |
2634 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id() || | 2629 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); |
2635 pending_deoptimization_ast_id_.IsPendingMarker()); | |
2636 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2630 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
2637 LInstruction* result = AssignEnvironment(lazy_bailout); | 2631 LInstruction* result = AssignEnvironment(lazy_bailout); |
2638 // Store the lazy deopt environment with the instruction if needed. Right | 2632 // Store the lazy deopt environment with the instruction if needed. Right |
2639 // now it is only used for LInstanceOfKnownGlobal. | 2633 // now it is only used for LInstanceOfKnownGlobal. |
2640 instruction_pending_deoptimization_environment_-> | 2634 instruction_pending_deoptimization_environment_-> |
2641 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2635 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
2642 instruction_pending_deoptimization_environment_ = NULL; | 2636 instruction_pending_deoptimization_environment_ = NULL; |
2643 pending_deoptimization_ast_id_ = BailoutId::None(); | 2637 pending_deoptimization_ast_id_ = BailoutId::None(); |
2644 return result; | 2638 return result; |
2645 } | 2639 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2719 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2726 LOperand* object = UseRegister(instr->object()); | 2720 LOperand* object = UseRegister(instr->object()); |
2727 LOperand* index = UseTempRegister(instr->index()); | 2721 LOperand* index = UseTempRegister(instr->index()); |
2728 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2722 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2729 } | 2723 } |
2730 | 2724 |
2731 | 2725 |
2732 } } // namespace v8::internal | 2726 } } // namespace v8::internal |
2733 | 2727 |
2734 #endif // V8_TARGET_ARCH_IA32 | 2728 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |