| 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 template<int I, int T> | 699 template<int I, int T> |
| 700 LInstruction* LChunkBuilder::DefineFixedDouble( | 700 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 701 LTemplateInstruction<1, I, T>* instr, | 701 LTemplateInstruction<1, I, T>* instr, |
| 702 XMMRegister reg) { | 702 XMMRegister reg) { |
| 703 return Define(instr, ToUnallocated(reg)); | 703 return Define(instr, ToUnallocated(reg)); |
| 704 } | 704 } |
| 705 | 705 |
| 706 | 706 |
| 707 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 707 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 708 HEnvironment* hydrogen_env = current_block_->last_environment(); | 708 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 709 instr->set_environment(CreateEnvironment(hydrogen_env)); | 709 int argument_index_accumulator = 0; |
| 710 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 711 &argument_index_accumulator)); |
| 710 return instr; | 712 return instr; |
| 711 } | 713 } |
| 712 | 714 |
| 713 | 715 |
| 714 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 716 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
| 715 LInstruction* instr, int ast_id) { | 717 LInstruction* instr, int ast_id) { |
| 716 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 718 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
| 717 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 719 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
| 718 instruction_pending_deoptimization_environment_ = instr; | 720 instruction_pending_deoptimization_environment_ = instr; |
| 719 pending_deoptimization_ast_id_ = ast_id; | 721 pending_deoptimization_ast_id_ = ast_id; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 988 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 987 instr = AssignEnvironment(instr); | 989 instr = AssignEnvironment(instr); |
| 988 } | 990 } |
| 989 instr->set_hydrogen_value(current); | 991 instr->set_hydrogen_value(current); |
| 990 chunk_->AddInstruction(instr, current_block_); | 992 chunk_->AddInstruction(instr, current_block_); |
| 991 } | 993 } |
| 992 current_instruction_ = old_current; | 994 current_instruction_ = old_current; |
| 993 } | 995 } |
| 994 | 996 |
| 995 | 997 |
| 996 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { | 998 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 999 HEnvironment* hydrogen_env, |
| 1000 int* argument_index_accumulator) { |
| 997 if (hydrogen_env == NULL) return NULL; | 1001 if (hydrogen_env == NULL) return NULL; |
| 998 | 1002 |
| 999 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); | 1003 LEnvironment* outer = |
| 1004 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
| 1000 int ast_id = hydrogen_env->ast_id(); | 1005 int ast_id = hydrogen_env->ast_id(); |
| 1001 ASSERT(ast_id != AstNode::kNoNumber); | 1006 ASSERT(ast_id != AstNode::kNoNumber); |
| 1002 int value_count = hydrogen_env->length(); | 1007 int value_count = hydrogen_env->length(); |
| 1003 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1008 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 1004 ast_id, | 1009 ast_id, |
| 1005 hydrogen_env->parameter_count(), | 1010 hydrogen_env->parameter_count(), |
| 1006 argument_count_, | 1011 argument_count_, |
| 1007 value_count, | 1012 value_count, |
| 1008 outer); | 1013 outer); |
| 1009 int argument_index = 0; | |
| 1010 for (int i = 0; i < value_count; ++i) { | 1014 for (int i = 0; i < value_count; ++i) { |
| 1011 if (hydrogen_env->is_special_index(i)) continue; | 1015 if (hydrogen_env->is_special_index(i)) continue; |
| 1012 | 1016 |
| 1013 HValue* value = hydrogen_env->values()->at(i); | 1017 HValue* value = hydrogen_env->values()->at(i); |
| 1014 LOperand* op = NULL; | 1018 LOperand* op = NULL; |
| 1015 if (value->IsArgumentsObject()) { | 1019 if (value->IsArgumentsObject()) { |
| 1016 op = NULL; | 1020 op = NULL; |
| 1017 } else if (value->IsPushArgument()) { | 1021 } else if (value->IsPushArgument()) { |
| 1018 op = new LArgument(argument_index++); | 1022 op = new LArgument((*argument_index_accumulator)++); |
| 1019 } else { | 1023 } else { |
| 1020 op = UseAny(value); | 1024 op = UseAny(value); |
| 1021 } | 1025 } |
| 1022 result->AddValue(op, value->representation()); | 1026 result->AddValue(op, value->representation()); |
| 1023 } | 1027 } |
| 1024 | 1028 |
| 1025 return result; | 1029 return result; |
| 1026 } | 1030 } |
| 1027 | 1031 |
| 1028 | 1032 |
| (...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 LOperand* key = UseOrConstantAtStart(instr->key()); | 2261 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2258 LOperand* object = UseOrConstantAtStart(instr->object()); | 2262 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2259 LIn* result = new LIn(context, key, object); | 2263 LIn* result = new LIn(context, key, object); |
| 2260 return MarkAsCall(DefineFixed(result, eax), instr); | 2264 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2261 } | 2265 } |
| 2262 | 2266 |
| 2263 | 2267 |
| 2264 } } // namespace v8::internal | 2268 } } // namespace v8::internal |
| 2265 | 2269 |
| 2266 #endif // V8_TARGET_ARCH_IA32 | 2270 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |