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