| 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 722 |
| 723 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 723 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 724 HEnvironment* hydrogen_env = current_block_->last_environment(); | 724 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 725 int argument_index_accumulator = 0; | 725 int argument_index_accumulator = 0; |
| 726 instr->set_environment(CreateEnvironment(hydrogen_env, | 726 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 727 &argument_index_accumulator)); | 727 &argument_index_accumulator)); |
| 728 return instr; | 728 return instr; |
| 729 } | 729 } |
| 730 | 730 |
| 731 | 731 |
| 732 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | |
| 733 LInstruction* instr, int ast_id) { | |
| 734 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | |
| 735 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | |
| 736 instruction_pending_deoptimization_environment_ = instr; | |
| 737 pending_deoptimization_ast_id_ = ast_id; | |
| 738 return instr; | |
| 739 } | |
| 740 | |
| 741 | |
| 742 void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() { | |
| 743 instruction_pending_deoptimization_environment_ = NULL; | |
| 744 pending_deoptimization_ast_id_ = AstNode::kNoNumber; | |
| 745 } | |
| 746 | |
| 747 | |
| 748 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 732 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 749 HInstruction* hinstr, | 733 HInstruction* hinstr, |
| 750 CanDeoptimize can_deoptimize) { | 734 CanDeoptimize can_deoptimize) { |
| 751 #ifdef DEBUG | 735 #ifdef DEBUG |
| 752 instr->VerifyCall(); | 736 instr->VerifyCall(); |
| 753 #endif | 737 #endif |
| 754 instr->MarkAsCall(); | 738 instr->MarkAsCall(); |
| 755 instr = AssignPointerMap(instr); | 739 instr = AssignPointerMap(instr); |
| 756 | 740 |
| 757 if (hinstr->HasObservableSideEffects()) { | 741 if (hinstr->HasObservableSideEffects()) { |
| 758 ASSERT(hinstr->next()->IsSimulate()); | 742 ASSERT(hinstr->next()->IsSimulate()); |
| 759 HSimulate* sim = HSimulate::cast(hinstr->next()); | 743 HSimulate* sim = HSimulate::cast(hinstr->next()); |
| 760 instr = SetInstructionPendingDeoptimizationEnvironment( | 744 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
| 761 instr, sim->ast_id()); | 745 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
| 746 instruction_pending_deoptimization_environment_ = instr; |
| 747 pending_deoptimization_ast_id_ = sim->ast_id(); |
| 762 } | 748 } |
| 763 | 749 |
| 764 // If instruction does not have side-effects lazy deoptimization | 750 // If instruction does not have side-effects lazy deoptimization |
| 765 // after the call will try to deoptimize to the point before the call. | 751 // after the call will try to deoptimize to the point before the call. |
| 766 // Thus we still need to attach environment to this call even if | 752 // Thus we still need to attach environment to this call even if |
| 767 // call sequence can not deoptimize eagerly. | 753 // call sequence can not deoptimize eagerly. |
| 768 bool needs_environment = | 754 bool needs_environment = |
| 769 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 755 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
| 770 !hinstr->HasObservableSideEffects(); | 756 !hinstr->HasObservableSideEffects(); |
| 771 if (needs_environment && !instr->HasEnvironment()) { | 757 if (needs_environment && !instr->HasEnvironment()) { |
| 772 instr = AssignEnvironment(instr); | 758 instr = AssignEnvironment(instr); |
| 773 } | 759 } |
| 774 | 760 |
| 775 return instr; | 761 return instr; |
| 776 } | 762 } |
| 777 | 763 |
| 778 | 764 |
| 779 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) { | |
| 780 instr->MarkAsSaveDoubles(); | |
| 781 return instr; | |
| 782 } | |
| 783 | |
| 784 | |
| 785 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 765 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
| 786 ASSERT(!instr->HasPointerMap()); | 766 ASSERT(!instr->HasPointerMap()); |
| 787 instr->set_pointer_map(new(zone()) LPointerMap(position_)); | 767 instr->set_pointer_map(new(zone()) LPointerMap(position_)); |
| 788 return instr; | 768 return instr; |
| 789 } | 769 } |
| 790 | 770 |
| 791 | 771 |
| 792 LUnallocated* LChunkBuilder::TempRegister() { | 772 LUnallocated* LChunkBuilder::TempRegister() { |
| 793 LUnallocated* operand = | 773 LUnallocated* operand = |
| 794 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 774 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 env->Push(value); | 2321 env->Push(value); |
| 2342 } | 2322 } |
| 2343 } | 2323 } |
| 2344 | 2324 |
| 2345 // If there is an instruction pending deoptimization environment create a | 2325 // If there is an instruction pending deoptimization environment create a |
| 2346 // lazy bailout instruction to capture the environment. | 2326 // lazy bailout instruction to capture the environment. |
| 2347 if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) { | 2327 if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) { |
| 2348 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); | 2328 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); |
| 2349 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2329 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
| 2350 LInstruction* result = AssignEnvironment(lazy_bailout); | 2330 LInstruction* result = AssignEnvironment(lazy_bailout); |
| 2331 // Store the lazy deopt environment with the instruction if needed. Right |
| 2332 // now it is only used for LInstanceOfKnownGlobal. |
| 2351 instruction_pending_deoptimization_environment_-> | 2333 instruction_pending_deoptimization_environment_-> |
| 2352 set_deoptimization_environment(result->environment()); | 2334 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
| 2353 ClearInstructionPendingDeoptimizationEnvironment(); | 2335 instruction_pending_deoptimization_environment_ = NULL; |
| 2336 pending_deoptimization_ast_id_ = AstNode::kNoNumber; |
| 2354 return result; | 2337 return result; |
| 2355 } | 2338 } |
| 2356 | 2339 |
| 2357 return NULL; | 2340 return NULL; |
| 2358 } | 2341 } |
| 2359 | 2342 |
| 2360 | 2343 |
| 2361 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2344 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2362 if (instr->is_function_entry()) { | 2345 if (instr->is_function_entry()) { |
| 2363 LOperand* context = UseFixed(instr->context(), esi); | 2346 LOperand* context = UseFixed(instr->context(), esi); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2424 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2442 LOperand* object = UseRegister(instr->object()); | 2425 LOperand* object = UseRegister(instr->object()); |
| 2443 LOperand* index = UseTempRegister(instr->index()); | 2426 LOperand* index = UseTempRegister(instr->index()); |
| 2444 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2427 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2445 } | 2428 } |
| 2446 | 2429 |
| 2447 | 2430 |
| 2448 } } // namespace v8::internal | 2431 } } // namespace v8::internal |
| 2449 | 2432 |
| 2450 #endif // V8_TARGET_ARCH_IA32 | 2433 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |