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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 HInstruction* hinstr, | 623 HInstruction* hinstr, |
624 CanDeoptimize can_deoptimize) { | 624 CanDeoptimize can_deoptimize) { |
625 info()->MarkAsNonDeferredCalling(); | 625 info()->MarkAsNonDeferredCalling(); |
626 #ifdef DEBUG | 626 #ifdef DEBUG |
627 instr->VerifyCall(); | 627 instr->VerifyCall(); |
628 #endif | 628 #endif |
629 instr->MarkAsCall(); | 629 instr->MarkAsCall(); |
630 instr = AssignPointerMap(instr); | 630 instr = AssignPointerMap(instr); |
631 | 631 |
632 if (hinstr->HasObservableSideEffects()) { | 632 if (hinstr->HasObservableSideEffects()) { |
| 633 ASSERT(hinstr->next()->IsSimulate()); |
| 634 HSimulate* sim = HSimulate::cast(hinstr->next()); |
633 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 635 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
634 ASSERT(pending_deoptimization_ast_id_.IsNone()); | 636 ASSERT(pending_deoptimization_ast_id_.IsNone()); |
635 if (!hinstr->IsControlInstruction()) { | |
636 ASSERT(hinstr->next()->IsSimulate()); | |
637 HSimulate* sim = HSimulate::cast(hinstr->next()); | |
638 pending_deoptimization_ast_id_ = sim->ast_id(); | |
639 } else { | |
640 pending_deoptimization_ast_id_ = BailoutId::PendingMarker(); | |
641 } | |
642 instruction_pending_deoptimization_environment_ = instr; | 637 instruction_pending_deoptimization_environment_ = instr; |
| 638 pending_deoptimization_ast_id_ = sim->ast_id(); |
643 } | 639 } |
644 | 640 |
645 // If instruction does not have side-effects lazy deoptimization | 641 // If instruction does not have side-effects lazy deoptimization |
646 // after the call will try to deoptimize to the point before the call. | 642 // after the call will try to deoptimize to the point before the call. |
647 // Thus we still need to attach environment to this call even if | 643 // Thus we still need to attach environment to this call even if |
648 // call sequence can not deoptimize eagerly. | 644 // call sequence can not deoptimize eagerly. |
649 bool needs_environment = | 645 bool needs_environment = |
650 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 646 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
651 !hinstr->HasObservableSideEffects(); | 647 !hinstr->HasObservableSideEffects(); |
652 if (needs_environment && !instr->HasEnvironment()) { | 648 if (needs_environment && !instr->HasEnvironment()) { |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 LOperand* global_object = UseTempRegister(instr->global_object()); | 1709 LOperand* global_object = UseTempRegister(instr->global_object()); |
1714 LOperand* scratch = TempRegister(); | 1710 LOperand* scratch = TempRegister(); |
1715 LOperand* scratch2 = TempRegister(); | 1711 LOperand* scratch2 = TempRegister(); |
1716 LOperand* scratch3 = TempRegister(); | 1712 LOperand* scratch3 = TempRegister(); |
1717 LRandom* result = new(zone()) LRandom( | 1713 LRandom* result = new(zone()) LRandom( |
1718 global_object, scratch, scratch2, scratch3); | 1714 global_object, scratch, scratch2, scratch3); |
1719 return DefineFixedDouble(result, d7); | 1715 return DefineFixedDouble(result, d7); |
1720 } | 1716 } |
1721 | 1717 |
1722 | 1718 |
1723 LInstruction* LChunkBuilder::DoCompareGenericAndBranch( | 1719 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1724 HCompareGenericAndBranch* instr) { | |
1725 ASSERT(instr->left()->representation().IsTagged()); | 1720 ASSERT(instr->left()->representation().IsTagged()); |
1726 ASSERT(instr->right()->representation().IsTagged()); | 1721 ASSERT(instr->right()->representation().IsTagged()); |
1727 LOperand* left = UseFixed(instr->left(), r1); | 1722 LOperand* left = UseFixed(instr->left(), r1); |
1728 LOperand* right = UseFixed(instr->right(), r0); | 1723 LOperand* right = UseFixed(instr->right(), r0); |
1729 return MarkAsCall(new(zone()) LCompareGenericAndBranch(left, right), instr); | 1724 LCmpT* result = new(zone()) LCmpT(left, right); |
| 1725 return MarkAsCall(DefineFixed(result, r0), instr); |
1730 } | 1726 } |
1731 | 1727 |
1732 | 1728 |
1733 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1729 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1734 HCompareNumericAndBranch* instr) { | 1730 HCompareNumericAndBranch* instr) { |
1735 Representation r = instr->representation(); | 1731 Representation r = instr->representation(); |
1736 if (r.IsSmiOrInteger32()) { | 1732 if (r.IsSmiOrInteger32()) { |
1737 ASSERT(instr->left()->representation().Equals(r)); | 1733 ASSERT(instr->left()->representation().Equals(r)); |
1738 ASSERT(instr->right()->representation().Equals(r)); | 1734 ASSERT(instr->right()->representation().Equals(r)); |
1739 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1735 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 HIsConstructCallAndBranch* instr) { | 2508 HIsConstructCallAndBranch* instr) { |
2513 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2509 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
2514 } | 2510 } |
2515 | 2511 |
2516 | 2512 |
2517 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2513 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
2518 instr->ReplayEnvironment(current_block_->last_environment()); | 2514 instr->ReplayEnvironment(current_block_->last_environment()); |
2519 | 2515 |
2520 // If there is an instruction pending deoptimization environment create a | 2516 // If there is an instruction pending deoptimization environment create a |
2521 // lazy bailout instruction to capture the environment. | 2517 // lazy bailout instruction to capture the environment. |
2522 if (!pending_deoptimization_ast_id_.IsNone()) { | 2518 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
2523 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id() || | |
2524 pending_deoptimization_ast_id_.IsPendingMarker()); | |
2525 LInstruction* result = new(zone()) LLazyBailout; | 2519 LInstruction* result = new(zone()) LLazyBailout; |
2526 result = AssignEnvironment(result); | 2520 result = AssignEnvironment(result); |
2527 // Store the lazy deopt environment with the instruction if needed. Right | 2521 // Store the lazy deopt environment with the instruction if needed. Right |
2528 // now it is only used for LInstanceOfKnownGlobal. | 2522 // now it is only used for LInstanceOfKnownGlobal. |
2529 instruction_pending_deoptimization_environment_-> | 2523 instruction_pending_deoptimization_environment_-> |
2530 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2524 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
2531 instruction_pending_deoptimization_environment_ = NULL; | 2525 instruction_pending_deoptimization_environment_ = NULL; |
2532 pending_deoptimization_ast_id_ = BailoutId::None(); | 2526 pending_deoptimization_ast_id_ = BailoutId::None(); |
2533 return result; | 2527 return result; |
2534 } | 2528 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 | 2601 |
2608 | 2602 |
2609 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2603 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2610 LOperand* object = UseRegister(instr->object()); | 2604 LOperand* object = UseRegister(instr->object()); |
2611 LOperand* index = UseRegister(instr->index()); | 2605 LOperand* index = UseRegister(instr->index()); |
2612 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2606 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2613 } | 2607 } |
2614 | 2608 |
2615 | 2609 |
2616 } } // namespace v8::internal | 2610 } } // namespace v8::internal |
OLD | NEW |