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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 704 |
705 template<int I, int T> | 705 template<int I, int T> |
706 LInstruction* LChunkBuilder::DefineFixedDouble( | 706 LInstruction* LChunkBuilder::DefineFixedDouble( |
707 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { | 707 LTemplateInstruction<1, I, T>* instr, DoubleRegister reg) { |
708 return Define(instr, ToUnallocated(reg)); | 708 return Define(instr, ToUnallocated(reg)); |
709 } | 709 } |
710 | 710 |
711 | 711 |
712 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 712 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
713 HEnvironment* hydrogen_env = current_block_->last_environment(); | 713 HEnvironment* hydrogen_env = current_block_->last_environment(); |
714 instr->set_environment(CreateEnvironment(hydrogen_env)); | 714 int argument_index_accumulator = 0; |
| 715 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 716 &argument_index_accumulator)); |
715 return instr; | 717 return instr; |
716 } | 718 } |
717 | 719 |
718 | 720 |
719 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 721 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
720 LInstruction* instr, int ast_id) { | 722 LInstruction* instr, int ast_id) { |
721 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 723 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
722 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 724 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
723 instruction_pending_deoptimization_environment_ = instr; | 725 instruction_pending_deoptimization_environment_ = instr; |
724 pending_deoptimization_ast_id_ = ast_id; | 726 pending_deoptimization_ast_id_ = ast_id; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 989 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
988 instr = AssignEnvironment(instr); | 990 instr = AssignEnvironment(instr); |
989 } | 991 } |
990 instr->set_hydrogen_value(current); | 992 instr->set_hydrogen_value(current); |
991 chunk_->AddInstruction(instr, current_block_); | 993 chunk_->AddInstruction(instr, current_block_); |
992 } | 994 } |
993 current_instruction_ = old_current; | 995 current_instruction_ = old_current; |
994 } | 996 } |
995 | 997 |
996 | 998 |
997 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { | 999 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 1000 HEnvironment* hydrogen_env, |
| 1001 int* argument_index_accumulator) { |
998 if (hydrogen_env == NULL) return NULL; | 1002 if (hydrogen_env == NULL) return NULL; |
999 | 1003 |
1000 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); | 1004 LEnvironment* outer = |
| 1005 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
1001 int ast_id = hydrogen_env->ast_id(); | 1006 int ast_id = hydrogen_env->ast_id(); |
1002 ASSERT(ast_id != AstNode::kNoNumber); | 1007 ASSERT(ast_id != AstNode::kNoNumber); |
1003 int value_count = hydrogen_env->length(); | 1008 int value_count = hydrogen_env->length(); |
1004 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1009 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
1005 ast_id, | 1010 ast_id, |
1006 hydrogen_env->parameter_count(), | 1011 hydrogen_env->parameter_count(), |
1007 argument_count_, | 1012 argument_count_, |
1008 value_count, | 1013 value_count, |
1009 outer); | 1014 outer); |
1010 int argument_index = 0; | |
1011 for (int i = 0; i < value_count; ++i) { | 1015 for (int i = 0; i < value_count; ++i) { |
1012 if (hydrogen_env->is_special_index(i)) continue; | 1016 if (hydrogen_env->is_special_index(i)) continue; |
1013 | 1017 |
1014 HValue* value = hydrogen_env->values()->at(i); | 1018 HValue* value = hydrogen_env->values()->at(i); |
1015 LOperand* op = NULL; | 1019 LOperand* op = NULL; |
1016 if (value->IsArgumentsObject()) { | 1020 if (value->IsArgumentsObject()) { |
1017 op = NULL; | 1021 op = NULL; |
1018 } else if (value->IsPushArgument()) { | 1022 } else if (value->IsPushArgument()) { |
1019 op = new LArgument(argument_index++); | 1023 op = new LArgument((*argument_index_accumulator)++); |
1020 } else { | 1024 } else { |
1021 op = UseAny(value); | 1025 op = UseAny(value); |
1022 } | 1026 } |
1023 result->AddValue(op, value->representation()); | 1027 result->AddValue(op, value->representation()); |
1024 } | 1028 } |
1025 | 1029 |
1026 return result; | 1030 return result; |
1027 } | 1031 } |
1028 | 1032 |
1029 | 1033 |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 | 2186 |
2183 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2187 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2184 LOperand* key = UseRegisterAtStart(instr->key()); | 2188 LOperand* key = UseRegisterAtStart(instr->key()); |
2185 LOperand* object = UseRegisterAtStart(instr->object()); | 2189 LOperand* object = UseRegisterAtStart(instr->object()); |
2186 LIn* result = new LIn(key, object); | 2190 LIn* result = new LIn(key, object); |
2187 return MarkAsCall(DefineFixed(result, r0), instr); | 2191 return MarkAsCall(DefineFixed(result, r0), instr); |
2188 } | 2192 } |
2189 | 2193 |
2190 | 2194 |
2191 } } // namespace v8::internal | 2195 } } // namespace v8::internal |
OLD | NEW |