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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); | 642 ASSERT(hinstr->next()->IsSimulate()); |
643 HSimulate* sim = HSimulate::cast(hinstr->next()); | 643 HSimulate* sim = HSimulate::cast(hinstr->next()); |
644 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 644 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
645 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 645 ASSERT(pending_deoptimization_ast_id_.IsNone()); |
646 instruction_pending_deoptimization_environment_ = instr; | 646 instruction_pending_deoptimization_environment_ = instr; |
647 pending_deoptimization_ast_id_ = sim->ast_id(); | 647 pending_deoptimization_ast_id_ = sim->ast_id(); |
648 } | 648 } |
649 | 649 |
650 // If instruction does not have side-effects lazy deoptimization | 650 // If instruction does not have side-effects lazy deoptimization |
651 // after the call will try to deoptimize to the point before the call. | 651 // 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 | 652 // Thus we still need to attach environment to this call even if |
653 // call sequence can not deoptimize eagerly. | 653 // call sequence can not deoptimize eagerly. |
654 bool needs_environment = | 654 bool needs_environment = |
655 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 655 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 } | 873 } |
874 | 874 |
875 | 875 |
876 LEnvironment* LChunkBuilder::CreateEnvironment( | 876 LEnvironment* LChunkBuilder::CreateEnvironment( |
877 HEnvironment* hydrogen_env, | 877 HEnvironment* hydrogen_env, |
878 int* argument_index_accumulator) { | 878 int* argument_index_accumulator) { |
879 if (hydrogen_env == NULL) return NULL; | 879 if (hydrogen_env == NULL) return NULL; |
880 | 880 |
881 LEnvironment* outer = | 881 LEnvironment* outer = |
882 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 882 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
883 int ast_id = hydrogen_env->ast_id(); | 883 BailoutId ast_id = hydrogen_env->ast_id(); |
884 ASSERT(ast_id != AstNode::kNoNumber || | 884 ASSERT(!ast_id.IsNone() || |
885 hydrogen_env->frame_type() != JS_FUNCTION); | 885 hydrogen_env->frame_type() != JS_FUNCTION); |
886 int value_count = hydrogen_env->length(); | 886 int value_count = hydrogen_env->length(); |
887 LEnvironment* result = | 887 LEnvironment* result = |
888 new(zone()) LEnvironment(hydrogen_env->closure(), | 888 new(zone()) LEnvironment(hydrogen_env->closure(), |
889 hydrogen_env->frame_type(), | 889 hydrogen_env->frame_type(), |
890 ast_id, | 890 ast_id, |
891 hydrogen_env->parameter_count(), | 891 hydrogen_env->parameter_count(), |
892 argument_count_, | 892 argument_count_, |
893 value_count, | 893 value_count, |
894 outer, | 894 outer, |
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 HValue* value = instr->values()->at(i); | 2289 HValue* value = instr->values()->at(i); |
2290 if (instr->HasAssignedIndexAt(i)) { | 2290 if (instr->HasAssignedIndexAt(i)) { |
2291 env->Bind(instr->GetAssignedIndexAt(i), value); | 2291 env->Bind(instr->GetAssignedIndexAt(i), value); |
2292 } else { | 2292 } else { |
2293 env->Push(value); | 2293 env->Push(value); |
2294 } | 2294 } |
2295 } | 2295 } |
2296 | 2296 |
2297 // If there is an instruction pending deoptimization environment create a | 2297 // If there is an instruction pending deoptimization environment create a |
2298 // lazy bailout instruction to capture the environment. | 2298 // lazy bailout instruction to capture the environment. |
2299 if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) { | 2299 if (!pending_deoptimization_ast_id_.IsNone()) { |
2300 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); | 2300 ASSERT(pending_deoptimization_ast_id_ == instr->ast_id()); |
2301 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; | 2301 LLazyBailout* lazy_bailout = new(zone()) LLazyBailout; |
2302 LInstruction* result = AssignEnvironment(lazy_bailout); | 2302 LInstruction* result = AssignEnvironment(lazy_bailout); |
2303 // Store the lazy deopt environment with the instruction if needed. Right | 2303 // Store the lazy deopt environment with the instruction if needed. Right |
2304 // now it is only used for LInstanceOfKnownGlobal. | 2304 // now it is only used for LInstanceOfKnownGlobal. |
2305 instruction_pending_deoptimization_environment_-> | 2305 instruction_pending_deoptimization_environment_-> |
2306 SetDeferredLazyDeoptimizationEnvironment(result->environment()); | 2306 SetDeferredLazyDeoptimizationEnvironment(result->environment()); |
2307 instruction_pending_deoptimization_environment_ = NULL; | 2307 instruction_pending_deoptimization_environment_ = NULL; |
2308 pending_deoptimization_ast_id_ = AstNode::kNoNumber; | 2308 pending_deoptimization_ast_id_ = BailoutId::None(); |
2309 return result; | 2309 return result; |
2310 } | 2310 } |
2311 | 2311 |
2312 return NULL; | 2312 return NULL; |
2313 } | 2313 } |
2314 | 2314 |
2315 | 2315 |
2316 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2316 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2317 if (instr->is_function_entry()) { | 2317 if (instr->is_function_entry()) { |
2318 LOperand* context = UseFixed(instr->context(), esi); | 2318 LOperand* context = UseFixed(instr->context(), esi); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2396 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2397 LOperand* object = UseRegister(instr->object()); | 2397 LOperand* object = UseRegister(instr->object()); |
2398 LOperand* index = UseTempRegister(instr->index()); | 2398 LOperand* index = UseTempRegister(instr->index()); |
2399 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2399 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2400 } | 2400 } |
2401 | 2401 |
2402 | 2402 |
2403 } } // namespace v8::internal | 2403 } } // namespace v8::internal |
2404 | 2404 |
2405 #endif // V8_TARGET_ARCH_IA32 | 2405 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |