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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 CanDeoptimize can_deoptimize) { | 632 CanDeoptimize can_deoptimize) { |
633 info()->MarkAsNonDeferredCalling(); | 633 info()->MarkAsNonDeferredCalling(); |
634 | 634 |
635 #ifdef DEBUG | 635 #ifdef DEBUG |
636 instr->VerifyCall(); | 636 instr->VerifyCall(); |
637 #endif | 637 #endif |
638 instr->MarkAsCall(); | 638 instr->MarkAsCall(); |
639 instr = AssignPointerMap(instr); | 639 instr = AssignPointerMap(instr); |
640 | 640 |
641 if (hinstr->HasObservableSideEffects()) { | 641 if (hinstr->HasObservableSideEffects()) { |
| 642 ASSERT(hinstr->next()->IsSimulate()); |
| 643 HSimulate* sim = HSimulate::cast(hinstr->next()); |
642 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 644 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
643 ASSERT(pending_deoptimization_ast_id_.IsNone()); | 645 ASSERT(pending_deoptimization_ast_id_.IsNone()); |
644 // For Control instructions we cannot verify the ast_id, since there is no | |
645 // 1:1 mapping but it corresponds to two simulates for each branch. | |
646 if (!hinstr->IsControlInstruction()) { | |
647 ASSERT(hinstr->next()->IsSimulate()); | |
648 HSimulate* sim = HSimulate::cast(hinstr->next()); | |
649 pending_deoptimization_ast_id_ = sim->ast_id(); | |
650 } else { | |
651 pending_deoptimization_ast_id_ = BailoutId::PendingMarker(); | |
652 } | |
653 instruction_pending_deoptimization_environment_ = instr; | 646 instruction_pending_deoptimization_environment_ = instr; |
| 647 pending_deoptimization_ast_id_ = sim->ast_id(); |
654 } | 648 } |
655 | 649 |
656 // If instruction does not have side-effects lazy deoptimization | 650 // If instruction does not have side-effects lazy deoptimization |
657 // after the call will try to deoptimize to the point before the call. | 651 // after the call will try to deoptimize to the point before the call. |
658 // Thus we still need to attach environment to this call even if | 652 // Thus we still need to attach environment to this call even if |
659 // call sequence can not deoptimize eagerly. | 653 // call sequence can not deoptimize eagerly. |
660 bool needs_environment = | 654 bool needs_environment = |
661 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 655 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
662 !hinstr->HasObservableSideEffects(); | 656 !hinstr->HasObservableSideEffects(); |
663 if (needs_environment && !instr->HasEnvironment()) { | 657 if (needs_environment && !instr->HasEnvironment()) { |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 LOperand* global_object = UseTempRegister(instr->global_object()); | 1593 LOperand* global_object = UseTempRegister(instr->global_object()); |
1600 LOperand* scratch = TempRegister(); | 1594 LOperand* scratch = TempRegister(); |
1601 LOperand* scratch2 = TempRegister(); | 1595 LOperand* scratch2 = TempRegister(); |
1602 LOperand* scratch3 = TempRegister(); | 1596 LOperand* scratch3 = TempRegister(); |
1603 LRandom* result = new(zone()) LRandom( | 1597 LRandom* result = new(zone()) LRandom( |
1604 global_object, scratch, scratch2, scratch3); | 1598 global_object, scratch, scratch2, scratch3); |
1605 return DefineFixedDouble(result, xmm1); | 1599 return DefineFixedDouble(result, xmm1); |
1606 } | 1600 } |
1607 | 1601 |
1608 | 1602 |
1609 LInstruction* LChunkBuilder::DoCompareGenericAndBranch( | 1603 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1610 HCompareGenericAndBranch* instr) { | |
1611 ASSERT(instr->left()->representation().IsTagged()); | 1604 ASSERT(instr->left()->representation().IsTagged()); |
1612 ASSERT(instr->right()->representation().IsTagged()); | 1605 ASSERT(instr->right()->representation().IsTagged()); |
1613 LOperand* left = UseFixed(instr->left(), rdx); | 1606 LOperand* left = UseFixed(instr->left(), rdx); |
1614 LOperand* right = UseFixed(instr->right(), rax); | 1607 LOperand* right = UseFixed(instr->right(), rax); |
1615 return MarkAsCall(new(zone()) LCompareGenericAndBranch(left, right), instr); | 1608 LCmpT* result = new(zone()) LCmpT(left, right); |
| 1609 return MarkAsCall(DefineFixed(result, rax), instr); |
1616 } | 1610 } |
1617 | 1611 |
1618 | 1612 |
1619 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1613 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1620 HCompareNumericAndBranch* instr) { | 1614 HCompareNumericAndBranch* instr) { |
1621 Representation r = instr->representation(); | 1615 Representation r = instr->representation(); |
1622 if (r.IsSmiOrInteger32()) { | 1616 if (r.IsSmiOrInteger32()) { |
1623 ASSERT(instr->left()->representation().Equals(r)); | 1617 ASSERT(instr->left()->representation().Equals(r)); |
1624 ASSERT(instr->right()->representation().Equals(r)); | 1618 ASSERT(instr->right()->representation().Equals(r)); |
1625 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1619 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 HIsConstructCallAndBranch* instr) { | 2427 HIsConstructCallAndBranch* instr) { |
2434 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2428 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
2435 } | 2429 } |
2436 | 2430 |
2437 | 2431 |
2438 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2432 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
2439 instr->ReplayEnvironment(current_block_->last_environment()); | 2433 instr->ReplayEnvironment(current_block_->last_environment()); |
2440 | 2434 |
2441 // If there is an instruction pending deoptimization environment create a | 2435 // If there is an instruction pending deoptimization environment create a |
2442 // lazy bailout instruction to capture the environment. | 2436 // lazy bailout instruction to capture the environment. |
2443 if (!pending_deoptimization_ast_id_.IsNone()) { | 2437 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
2444 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id() || | |
2445 pending_deoptimization_ast_id_.IsPendingMarker()); | |
2446 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2438 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
2447 LInstruction* result = AssignEnvironment(lazy_bailout); | 2439 LInstruction* result = AssignEnvironment(lazy_bailout); |
2448 // Store the lazy deopt environment with the instruction if needed. Right | 2440 // Store the lazy deopt environment with the instruction if needed. Right |
2449 // now it is only used for LInstanceOfKnownGlobal. | 2441 // now it is only used for LInstanceOfKnownGlobal. |
2450 instruction_pending_deoptimization_environment_-> | 2442 instruction_pending_deoptimization_environment_-> |
2451 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2443 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
2452 instruction_pending_deoptimization_environment_ = NULL; | 2444 instruction_pending_deoptimization_environment_ = NULL; |
2453 pending_deoptimization_ast_id_ = BailoutId::None(); | 2445 pending_deoptimization_ast_id_ = BailoutId::None(); |
2454 return result; | 2446 return result; |
2455 } | 2447 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2524 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2533 LOperand* object = UseRegister(instr->object()); | 2525 LOperand* object = UseRegister(instr->object()); |
2534 LOperand* index = UseTempRegister(instr->index()); | 2526 LOperand* index = UseTempRegister(instr->index()); |
2535 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2527 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2536 } | 2528 } |
2537 | 2529 |
2538 | 2530 |
2539 } } // namespace v8::internal | 2531 } } // namespace v8::internal |
2540 | 2532 |
2541 #endif // V8_TARGET_ARCH_X64 | 2533 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |