| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 612 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 613 HInstruction* hinstr, | 613 HInstruction* hinstr, |
| 614 CanDeoptimize can_deoptimize) { | 614 CanDeoptimize can_deoptimize) { |
| 615 info()->MarkAsNonDeferredCalling(); | 615 info()->MarkAsNonDeferredCalling(); |
| 616 #ifdef DEBUG | 616 #ifdef DEBUG |
| 617 instr->VerifyCall(); | 617 instr->VerifyCall(); |
| 618 #endif | 618 #endif |
| 619 instr->MarkAsCall(); | 619 instr->MarkAsCall(); |
| 620 instr = AssignPointerMap(instr); | 620 instr = AssignPointerMap(instr); |
| 621 | 621 |
| 622 if (hinstr->HasObservableSideEffects()) { | |
| 623 ASSERT(hinstr->next()->IsSimulate()); | |
| 624 HSimulate* sim = HSimulate::cast(hinstr->next()); | |
| 625 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | |
| 626 ASSERT(pending_deoptimization_ast_id_.IsNone()); | |
| 627 instruction_pending_deoptimization_environment_ = instr; | |
| 628 pending_deoptimization_ast_id_ = sim->ast_id(); | |
| 629 } | |
| 630 | |
| 631 // If instruction does not have side-effects lazy deoptimization | 622 // If instruction does not have side-effects lazy deoptimization |
| 632 // after the call will try to deoptimize to the point before the call. | 623 // after the call will try to deoptimize to the point before the call. |
| 633 // Thus we still need to attach environment to this call even if | 624 // Thus we still need to attach environment to this call even if |
| 634 // call sequence can not deoptimize eagerly. | 625 // call sequence can not deoptimize eagerly. |
| 635 bool needs_environment = | 626 bool needs_environment = |
| 636 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 627 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
| 637 !hinstr->HasObservableSideEffects(); | 628 !hinstr->HasObservableSideEffects(); |
| 638 if (needs_environment && !instr->HasEnvironment()) { | 629 if (needs_environment && !instr->HasEnvironment()) { |
| 639 instr = AssignEnvironment(instr); | 630 instr = AssignEnvironment(instr); |
| 640 } | 631 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 } | 898 } |
| 908 #endif | 899 #endif |
| 909 | 900 |
| 910 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 901 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 911 instr = AssignPointerMap(instr); | 902 instr = AssignPointerMap(instr); |
| 912 } | 903 } |
| 913 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 904 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 914 instr = AssignEnvironment(instr); | 905 instr = AssignEnvironment(instr); |
| 915 } | 906 } |
| 916 chunk_->AddInstruction(instr, current_block_); | 907 chunk_->AddInstruction(instr, current_block_); |
| 908 |
| 909 if (instr->IsCall()) { |
| 910 HValue* hydrogen_value_for_lazy_bailout = current; |
| 911 LInstruction* instruction_needing_environment = NULL; |
| 912 if (current->HasObservableSideEffects()) { |
| 913 HSimulate* sim = HSimulate::cast(current->next()); |
| 914 instruction_needing_environment = instr; |
| 915 sim->ReplayEnvironment(current_block_->last_environment()); |
| 916 hydrogen_value_for_lazy_bailout = sim; |
| 917 } |
| 918 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 919 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 920 chunk_->AddInstruction(bailout, current_block_); |
| 921 if (instruction_needing_environment != NULL) { |
| 922 // Store the lazy deopt environment with the instruction if needed. |
| 923 // Right now it is only used for LInstanceOfKnownGlobal. |
| 924 instruction_needing_environment-> |
| 925 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 926 } |
| 927 } |
| 917 } | 928 } |
| 918 current_instruction_ = old_current; | 929 current_instruction_ = old_current; |
| 919 } | 930 } |
| 920 | 931 |
| 921 | 932 |
| 922 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 933 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 923 return new(zone()) LGoto(instr->FirstSuccessor()); | 934 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 924 } | 935 } |
| 925 | 936 |
| 926 | 937 |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 | 2311 |
| 2301 | 2312 |
| 2302 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2313 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2303 HIsConstructCallAndBranch* instr) { | 2314 HIsConstructCallAndBranch* instr) { |
| 2304 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2315 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2305 } | 2316 } |
| 2306 | 2317 |
| 2307 | 2318 |
| 2308 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2319 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| 2309 instr->ReplayEnvironment(current_block_->last_environment()); | 2320 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2310 | |
| 2311 // If there is an instruction pending deoptimization environment create a | |
| 2312 // lazy bailout instruction to capture the environment. | |
| 2313 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | |
| 2314 LInstruction* result = new(zone()) LLazyBailout; | |
| 2315 result = AssignEnvironment(result); | |
| 2316 // Store the lazy deopt environment with the instruction if needed. Right | |
| 2317 // now it is only used for LInstanceOfKnownGlobal. | |
| 2318 instruction_pending_deoptimization_environment_-> | |
| 2319 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | |
| 2320 instruction_pending_deoptimization_environment_ = NULL; | |
| 2321 pending_deoptimization_ast_id_ = BailoutId::None(); | |
| 2322 return result; | |
| 2323 } | |
| 2324 | |
| 2325 return NULL; | 2321 return NULL; |
| 2326 } | 2322 } |
| 2327 | 2323 |
| 2328 | 2324 |
| 2329 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2325 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2330 if (instr->is_function_entry()) { | 2326 if (instr->is_function_entry()) { |
| 2331 LOperand* context = UseFixed(instr->context(), cp); | 2327 LOperand* context = UseFixed(instr->context(), cp); |
| 2332 return MarkAsCall(new(zone()) LStackCheck(context), instr); | 2328 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
| 2333 } else { | 2329 } else { |
| 2334 ASSERT(instr->is_backwards_branch()); | 2330 ASSERT(instr->is_backwards_branch()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2399 | 2395 |
| 2400 | 2396 |
| 2401 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2397 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2402 LOperand* object = UseRegister(instr->object()); | 2398 LOperand* object = UseRegister(instr->object()); |
| 2403 LOperand* index = UseRegister(instr->index()); | 2399 LOperand* index = UseRegister(instr->index()); |
| 2404 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2400 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2405 } | 2401 } |
| 2406 | 2402 |
| 2407 | 2403 |
| 2408 } } // namespace v8::internal | 2404 } } // namespace v8::internal |
| OLD | NEW |