| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 | 703 |
| 704 template<int I, int T> | 704 template<int I, int T> |
| 705 LInstruction* LChunkBuilder::DefineFixedDouble( | 705 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 706 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { | 706 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { |
| 707 return Define(instr, ToUnallocated(reg)); | 707 return Define(instr, ToUnallocated(reg)); |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 711 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 712 HEnvironment* hydrogen_env = current_block_->last_environment(); | 712 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 713 instr->set_environment(CreateEnvironment(hydrogen_env)); | 713 int argument_index_accumulator = 0; |
| 714 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 715 &argument_index_accumulator)); |
| 714 return instr; | 716 return instr; |
| 715 } | 717 } |
| 716 | 718 |
| 717 | 719 |
| 718 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 720 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
| 719 LInstruction* instr, int ast_id) { | 721 LInstruction* instr, int ast_id) { |
| 720 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 722 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
| 721 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 723 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
| 722 instruction_pending_deoptimization_environment_ = instr; | 724 instruction_pending_deoptimization_environment_ = instr; |
| 723 pending_deoptimization_ast_id_ = ast_id; | 725 pending_deoptimization_ast_id_ = ast_id; |
| (...skipping 262 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 | 2185 |
| 2182 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2186 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2183 LOperand* key = UseRegisterAtStart(instr->key()); | 2187 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2184 LOperand* object = UseRegisterAtStart(instr->object()); | 2188 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2185 LIn* result = new LIn(key, object); | 2189 LIn* result = new LIn(key, object); |
| 2186 return MarkAsCall(DefineFixed(result, r0), instr); | 2190 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2187 } | 2191 } |
| 2188 | 2192 |
| 2189 | 2193 |
| 2190 } } // namespace v8::internal | 2194 } } // namespace v8::internal |
| OLD | NEW |