Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 } | 649 } |
| 650 | 650 |
| 651 | 651 |
| 652 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 652 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 653 HEnvironment* hydrogen_env = current_block_->last_environment(); | 653 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 654 instr->set_environment(CreateEnvironment(hydrogen_env)); | 654 instr->set_environment(CreateEnvironment(hydrogen_env)); |
| 655 return instr; | 655 return instr; |
| 656 } | 656 } |
| 657 | 657 |
| 658 | 658 |
| 659 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | |
| 660 LInstruction* instr, int ast_id) { | |
| 661 ASSERT(instructions_pending_deoptimization_environment_ == NULL); | |
| 662 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | |
| 663 instructions_pending_deoptimization_environment_ = instr; | |
| 664 pending_deoptimization_ast_id_ = ast_id; | |
| 665 return instr; | |
| 666 } | |
| 667 | |
| 668 | |
| 669 void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() { | |
| 670 instructions_pending_deoptimization_environment_ = NULL; | |
| 671 pending_deoptimization_ast_id_ = AstNode::kNoNumber; | |
| 672 } | |
| 673 | |
| 674 | |
| 675 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 659 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 676 HInstruction* hinstr, | 660 HInstruction* hinstr, |
| 677 CanDeoptimize can_deoptimize) { | 661 CanDeoptimize can_deoptimize) { |
| 678 allocator_->MarkAsCall(); | 662 allocator_->MarkAsCall(); |
| 679 instr = AssignPointerMap(instr); | 663 instr = AssignPointerMap(instr); |
| 680 | 664 |
| 681 if (hinstr->HasSideEffects()) { | 665 if (hinstr->HasSideEffects()) { |
| 682 ASSERT(hinstr->next()->IsSimulate()); | 666 ASSERT(hinstr->next()->IsSimulate()); |
| 683 HSimulate* sim = HSimulate::cast(hinstr->next()); | 667 HSimulate* sim = HSimulate::cast(hinstr->next()); |
| 684 instr = SetInstructionPendingDeoptimizationEnvironment( | 668 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
| 685 instr, sim->ast_id()); | 669 pending_deoptimization_ast_id_ = sim->ast_id(); |
| 686 } | 670 } |
| 687 | 671 |
| 688 // If instruction does not have side-effects lazy deoptimization | 672 // If instruction does not have side-effects lazy deoptimization |
| 689 // after the call will try to deoptimize to the point before the call. | 673 // after the call will try to deoptimize to the point before the call. |
| 690 // Thus we still need to attach environment to this call even if | 674 // Thus we still need to attach environment to this call even if |
| 691 // call sequence can not deoptimize eagerly. | 675 // call sequence can not deoptimize eagerly. |
| 692 bool needs_environment = | 676 bool needs_environment = |
| 693 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects(); | 677 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects(); |
| 694 if (needs_environment && !instr->HasEnvironment()) { | 678 if (needs_environment && !instr->HasEnvironment()) { |
| 695 instr = AssignEnvironment(instr); | 679 instr = AssignEnvironment(instr); |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1867 if (instr->HasAssignedIndexAt(i)) { | 1851 if (instr->HasAssignedIndexAt(i)) { |
| 1868 env->Bind(instr->GetAssignedIndexAt(i), value); | 1852 env->Bind(instr->GetAssignedIndexAt(i), value); |
| 1869 } else { | 1853 } else { |
| 1870 env->Push(value); | 1854 env->Push(value); |
| 1871 } | 1855 } |
| 1872 } | 1856 } |
| 1873 ASSERT(env->length() == instr->environment_length()); | 1857 ASSERT(env->length() == instr->environment_length()); |
| 1874 | 1858 |
| 1875 // If there is an instruction pending deoptimization environment create a | 1859 // If there is an instruction pending deoptimization environment create a |
| 1876 // lazy bailout instruction to capture the environment. | 1860 // lazy bailout instruction to capture the environment. |
| 1877 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | 1861 if (pending_deoptimization_ast_id_ == instr->ast_id()) { |
|
Kevin Millikin (Chromium)
2011/01/24 13:31:38
This should really be:
if (pending_deoptimization
| |
| 1878 LLazyBailout* lazy_bailout = new LLazyBailout; | 1862 LLazyBailout* lazy_bailout = new LLazyBailout; |
| 1879 LInstruction* result = AssignEnvironment(lazy_bailout); | 1863 LInstruction* result = AssignEnvironment(lazy_bailout); |
|
Kevin Millikin (Chromium)
2011/01/24 13:31:38
I'm worried that the uses in this environment appe
| |
| 1880 instructions_pending_deoptimization_environment_-> | 1864 pending_deoptimization_ast_id_ = AstNode::kNoNumber; |
| 1881 set_deoptimization_environment(result->environment()); | |
| 1882 ClearInstructionPendingDeoptimizationEnvironment(); | |
| 1883 return result; | 1865 return result; |
| 1884 } | 1866 } |
| 1885 | 1867 |
| 1886 return NULL; | 1868 return NULL; |
| 1887 } | 1869 } |
| 1888 | 1870 |
| 1889 | 1871 |
| 1890 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 1872 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 1891 return MarkAsCall(new LStackCheck, instr); | 1873 return MarkAsCall(new LStackCheck, instr); |
| 1892 } | 1874 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1908 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1890 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 1909 HEnvironment* outer = current_block_->last_environment()->outer(); | 1891 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 1910 current_block_->UpdateEnvironment(outer); | 1892 current_block_->UpdateEnvironment(outer); |
| 1911 return NULL; | 1893 return NULL; |
| 1912 } | 1894 } |
| 1913 | 1895 |
| 1914 | 1896 |
| 1915 } } // namespace v8::internal | 1897 } } // namespace v8::internal |
| 1916 | 1898 |
| 1917 #endif // V8_TARGET_ARCH_IA32 | 1899 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |