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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 template<int I, int T> | 700 template<int I, int T> |
701 LInstruction* LChunkBuilder::DefineFixedDouble( | 701 LInstruction* LChunkBuilder::DefineFixedDouble( |
702 LTemplateInstruction<1, I, T>* instr, | 702 LTemplateInstruction<1, I, T>* instr, |
703 XMMRegister reg) { | 703 XMMRegister reg) { |
704 return Define(instr, ToUnallocated(reg)); | 704 return Define(instr, ToUnallocated(reg)); |
705 } | 705 } |
706 | 706 |
707 | 707 |
708 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 708 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
709 HEnvironment* hydrogen_env = current_block_->last_environment(); | 709 HEnvironment* hydrogen_env = current_block_->last_environment(); |
710 instr->set_environment(CreateEnvironment(hydrogen_env)); | 710 int argument_index_accumulator = 0; |
| 711 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 712 &argument_index_accumulator)); |
711 return instr; | 713 return instr; |
712 } | 714 } |
713 | 715 |
714 | 716 |
715 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 717 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
716 LInstruction* instr, int ast_id) { | 718 LInstruction* instr, int ast_id) { |
717 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 719 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
718 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 720 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
719 instruction_pending_deoptimization_environment_ = instr; | 721 instruction_pending_deoptimization_environment_ = instr; |
720 pending_deoptimization_ast_id_ = ast_id; | 722 pending_deoptimization_ast_id_ = ast_id; |
(...skipping 266 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 LOperand* key = UseOrConstantAtStart(instr->key()); | 2262 LOperand* key = UseOrConstantAtStart(instr->key()); |
2259 LOperand* object = UseOrConstantAtStart(instr->object()); | 2263 LOperand* object = UseOrConstantAtStart(instr->object()); |
2260 LIn* result = new LIn(context, key, object); | 2264 LIn* result = new LIn(context, key, object); |
2261 return MarkAsCall(DefineFixed(result, eax), instr); | 2265 return MarkAsCall(DefineFixed(result, eax), instr); |
2262 } | 2266 } |
2263 | 2267 |
2264 | 2268 |
2265 } } // namespace v8::internal | 2269 } } // namespace v8::internal |
2266 | 2270 |
2267 #endif // V8_TARGET_ARCH_IA32 | 2271 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |