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