| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 607 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 608 HInstruction* hinstr, | 608 HInstruction* hinstr, |
| 609 CanDeoptimize can_deoptimize) { | 609 CanDeoptimize can_deoptimize) { |
| 610 info()->MarkAsNonDeferredCalling(); | 610 info()->MarkAsNonDeferredCalling(); |
| 611 #ifdef DEBUG | 611 #ifdef DEBUG |
| 612 instr->VerifyCall(); | 612 instr->VerifyCall(); |
| 613 #endif | 613 #endif |
| 614 instr->MarkAsCall(); | 614 instr->MarkAsCall(); |
| 615 instr = AssignPointerMap(instr); | 615 instr = AssignPointerMap(instr); |
| 616 | 616 |
| 617 if (hinstr->HasObservableSideEffects()) { | |
| 618 ASSERT(hinstr->next()->IsSimulate()); | |
| 619 HSimulate* sim = HSimulate::cast(hinstr->next()); | |
| 620 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | |
| 621 ASSERT(pending_deoptimization_ast_id_.IsNone()); | |
| 622 instruction_pending_deoptimization_environment_ = instr; | |
| 623 pending_deoptimization_ast_id_ = sim->ast_id(); | |
| 624 } | |
| 625 | |
| 626 // If instruction does not have side-effects lazy deoptimization | 617 // If instruction does not have side-effects lazy deoptimization |
| 627 // after the call will try to deoptimize to the point before the call. | 618 // after the call will try to deoptimize to the point before the call. |
| 628 // Thus we still need to attach environment to this call even if | 619 // Thus we still need to attach environment to this call even if |
| 629 // call sequence can not deoptimize eagerly. | 620 // call sequence can not deoptimize eagerly. |
| 630 bool needs_environment = | 621 bool needs_environment = |
| 631 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 622 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
| 632 !hinstr->HasObservableSideEffects(); | 623 !hinstr->HasObservableSideEffects(); |
| 633 if (needs_environment && !instr->HasEnvironment()) { | 624 if (needs_environment && !instr->HasEnvironment()) { |
| 634 instr = AssignEnvironment(instr); | 625 instr = AssignEnvironment(instr); |
| 635 } | 626 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 } | 890 } |
| 900 #endif | 891 #endif |
| 901 | 892 |
| 902 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 893 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
| 903 instr = AssignPointerMap(instr); | 894 instr = AssignPointerMap(instr); |
| 904 } | 895 } |
| 905 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 896 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 906 instr = AssignEnvironment(instr); | 897 instr = AssignEnvironment(instr); |
| 907 } | 898 } |
| 908 chunk_->AddInstruction(instr, current_block_); | 899 chunk_->AddInstruction(instr, current_block_); |
| 900 |
| 901 if (instr->IsCall()) { |
| 902 HValue* hydrogen_value_for_lazy_bailout = current; |
| 903 LInstruction* instruction_needing_environment = NULL; |
| 904 if (current->HasObservableSideEffects()) { |
| 905 HSimulate* sim = HSimulate::cast(current->next()); |
| 906 instruction_needing_environment = instr; |
| 907 sim->ReplayEnvironment(current_block_->last_environment()); |
| 908 hydrogen_value_for_lazy_bailout = sim; |
| 909 } |
| 910 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout()); |
| 911 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout); |
| 912 chunk_->AddInstruction(bailout, current_block_); |
| 913 if (instruction_needing_environment != NULL) { |
| 914 // Store the lazy deopt environment with the instruction if needed. |
| 915 // Right now it is only used for LInstanceOfKnownGlobal. |
| 916 instruction_needing_environment-> |
| 917 SetDeferredLazyDeoptimizationEnvironment(bailout->environment()); |
| 918 } |
| 919 } |
| 909 } | 920 } |
| 910 current_instruction_ = old_current; | 921 current_instruction_ = old_current; |
| 911 } | 922 } |
| 912 | 923 |
| 913 | 924 |
| 914 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 925 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 915 return new(zone()) LGoto(instr->FirstSuccessor()); | 926 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 916 } | 927 } |
| 917 | 928 |
| 918 | 929 |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 | 2382 |
| 2372 | 2383 |
| 2373 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2384 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2374 HIsConstructCallAndBranch* instr) { | 2385 HIsConstructCallAndBranch* instr) { |
| 2375 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2386 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2376 } | 2387 } |
| 2377 | 2388 |
| 2378 | 2389 |
| 2379 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 2390 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| 2380 instr->ReplayEnvironment(current_block_->last_environment()); | 2391 instr->ReplayEnvironment(current_block_->last_environment()); |
| 2381 | |
| 2382 // If there is an instruction pending deoptimization environment create a | |
| 2383 // lazy bailout instruction to capture the environment. | |
| 2384 if (pending_deoptimization_ast_id_ == instr->ast_id()) { | |
| 2385 LInstruction* result = new(zone()) LLazyBailout; | |
| 2386 result = AssignEnvironment(result); | |
| 2387 // Store the lazy deopt environment with the instruction if needed. Right | |
| 2388 // now it is only used for LInstanceOfKnownGlobal. | |
| 2389 instruction_pending_deoptimization_environment_-> | |
| 2390 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | |
| 2391 instruction_pending_deoptimization_environment_ = NULL; | |
| 2392 pending_deoptimization_ast_id_ = BailoutId::None(); | |
| 2393 return result; | |
| 2394 } | |
| 2395 | |
| 2396 return NULL; | 2392 return NULL; |
| 2397 } | 2393 } |
| 2398 | 2394 |
| 2399 | 2395 |
| 2400 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2396 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2401 if (instr->is_function_entry()) { | 2397 if (instr->is_function_entry()) { |
| 2402 LOperand* context = UseFixed(instr->context(), cp); | 2398 LOperand* context = UseFixed(instr->context(), cp); |
| 2403 return MarkAsCall(new(zone()) LStackCheck(context), instr); | 2399 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
| 2404 } else { | 2400 } else { |
| 2405 ASSERT(instr->is_backwards_branch()); | 2401 ASSERT(instr->is_backwards_branch()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 } | 2465 } |
| 2470 | 2466 |
| 2471 | 2467 |
| 2472 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2468 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2473 LOperand* object = UseRegister(instr->object()); | 2469 LOperand* object = UseRegister(instr->object()); |
| 2474 LOperand* index = UseRegister(instr->index()); | 2470 LOperand* index = UseRegister(instr->index()); |
| 2475 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2471 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2476 } | 2472 } |
| 2477 | 2473 |
| 2478 } } // namespace v8::internal | 2474 } } // namespace v8::internal |
| OLD | NEW |