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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 984 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
983 instr = AssignEnvironment(instr); | 985 instr = AssignEnvironment(instr); |
984 } | 986 } |
985 instr->set_hydrogen_value(current); | 987 instr->set_hydrogen_value(current); |
986 chunk_->AddInstruction(instr, current_block_); | 988 chunk_->AddInstruction(instr, current_block_); |
987 } | 989 } |
988 current_instruction_ = old_current; | 990 current_instruction_ = old_current; |
989 } | 991 } |
990 | 992 |
991 | 993 |
992 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { | 994 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 995 HEnvironment* hydrogen_env, |
| 996 int* argument_index_accumulator) { |
993 if (hydrogen_env == NULL) return NULL; | 997 if (hydrogen_env == NULL) return NULL; |
994 | 998 |
995 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); | 999 LEnvironment* outer = |
| 1000 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
996 int ast_id = hydrogen_env->ast_id(); | 1001 int ast_id = hydrogen_env->ast_id(); |
997 ASSERT(ast_id != AstNode::kNoNumber); | 1002 ASSERT(ast_id != AstNode::kNoNumber); |
998 int value_count = hydrogen_env->length(); | 1003 int value_count = hydrogen_env->length(); |
999 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1004 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
1000 ast_id, | 1005 ast_id, |
1001 hydrogen_env->parameter_count(), | 1006 hydrogen_env->parameter_count(), |
1002 argument_count_, | 1007 argument_count_, |
1003 value_count, | 1008 value_count, |
1004 outer); | 1009 outer); |
1005 int argument_index = 0; | |
1006 for (int i = 0; i < value_count; ++i) { | 1010 for (int i = 0; i < value_count; ++i) { |
1007 if (hydrogen_env->is_special_index(i)) continue; | 1011 if (hydrogen_env->is_special_index(i)) continue; |
1008 | 1012 |
1009 HValue* value = hydrogen_env->values()->at(i); | 1013 HValue* value = hydrogen_env->values()->at(i); |
1010 LOperand* op = NULL; | 1014 LOperand* op = NULL; |
1011 if (value->IsArgumentsObject()) { | 1015 if (value->IsArgumentsObject()) { |
1012 op = NULL; | 1016 op = NULL; |
1013 } else if (value->IsPushArgument()) { | 1017 } else if (value->IsPushArgument()) { |
1014 op = new LArgument(argument_index++); | 1018 op = new LArgument((*argument_index_accumulator)++); |
1015 } else { | 1019 } else { |
1016 op = UseAny(value); | 1020 op = UseAny(value); |
1017 } | 1021 } |
1018 result->AddValue(op, value->representation()); | 1022 result->AddValue(op, value->representation()); |
1019 } | 1023 } |
1020 | 1024 |
1021 return result; | 1025 return result; |
1022 } | 1026 } |
1023 | 1027 |
1024 | 1028 |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 LOperand* key = UseOrConstantAtStart(instr->key()); | 2173 LOperand* key = UseOrConstantAtStart(instr->key()); |
2170 LOperand* object = UseOrConstantAtStart(instr->object()); | 2174 LOperand* object = UseOrConstantAtStart(instr->object()); |
2171 LIn* result = new LIn(key, object); | 2175 LIn* result = new LIn(key, object); |
2172 return MarkAsCall(DefineFixed(result, rax), instr); | 2176 return MarkAsCall(DefineFixed(result, rax), instr); |
2173 } | 2177 } |
2174 | 2178 |
2175 | 2179 |
2176 } } // namespace v8::internal | 2180 } } // namespace v8::internal |
2177 | 2181 |
2178 #endif // V8_TARGET_ARCH_X64 | 2182 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |