| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 template<int I, int T> | 698 template<int I, int T> |
| 699 LInstruction* LChunkBuilder::DefineFixedDouble( | 699 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 700 LTemplateInstruction<1, I, T>* instr, | 700 LTemplateInstruction<1, I, T>* instr, |
| 701 XMMRegister reg) { | 701 XMMRegister reg) { |
| 702 return Define(instr, ToUnallocated(reg)); | 702 return Define(instr, ToUnallocated(reg)); |
| 703 } | 703 } |
| 704 | 704 |
| 705 | 705 |
| 706 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 706 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 707 HEnvironment* hydrogen_env = current_block_->last_environment(); | 707 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 708 instr->set_environment(CreateEnvironment(hydrogen_env)); | 708 int argument_index_accumulator = 0; |
| 709 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 710 &argument_index_accumulator)); |
| 709 return instr; | 711 return instr; |
| 710 } | 712 } |
| 711 | 713 |
| 712 | 714 |
| 713 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( | 715 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( |
| 714 LInstruction* instr, int ast_id) { | 716 LInstruction* instr, int ast_id) { |
| 715 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 717 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
| 716 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); | 718 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); |
| 717 instruction_pending_deoptimization_environment_ = instr; | 719 instruction_pending_deoptimization_environment_ = instr; |
| 718 pending_deoptimization_ast_id_ = ast_id; | 720 pending_deoptimization_ast_id_ = ast_id; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 983 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
| 982 instr = AssignEnvironment(instr); | 984 instr = AssignEnvironment(instr); |
| 983 } | 985 } |
| 984 instr->set_hydrogen_value(current); | 986 instr->set_hydrogen_value(current); |
| 985 chunk_->AddInstruction(instr, current_block_); | 987 chunk_->AddInstruction(instr, current_block_); |
| 986 } | 988 } |
| 987 current_instruction_ = old_current; | 989 current_instruction_ = old_current; |
| 988 } | 990 } |
| 989 | 991 |
| 990 | 992 |
| 991 LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { | 993 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 994 HEnvironment* hydrogen_env, |
| 995 int* argument_index_accumulator) { |
| 992 if (hydrogen_env == NULL) return NULL; | 996 if (hydrogen_env == NULL) return NULL; |
| 993 | 997 |
| 994 LEnvironment* outer = CreateEnvironment(hydrogen_env->outer()); | 998 LEnvironment* outer = |
| 999 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
| 995 int ast_id = hydrogen_env->ast_id(); | 1000 int ast_id = hydrogen_env->ast_id(); |
| 996 ASSERT(ast_id != AstNode::kNoNumber); | 1001 ASSERT(ast_id != AstNode::kNoNumber); |
| 997 int value_count = hydrogen_env->length(); | 1002 int value_count = hydrogen_env->length(); |
| 998 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1003 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 999 ast_id, | 1004 ast_id, |
| 1000 hydrogen_env->parameter_count(), | 1005 hydrogen_env->parameter_count(), |
| 1001 argument_count_, | 1006 argument_count_, |
| 1002 value_count, | 1007 value_count, |
| 1003 outer); | 1008 outer); |
| 1004 int argument_index = 0; | |
| 1005 for (int i = 0; i < value_count; ++i) { | 1009 for (int i = 0; i < value_count; ++i) { |
| 1006 if (hydrogen_env->is_special_index(i)) continue; | 1010 if (hydrogen_env->is_special_index(i)) continue; |
| 1007 | 1011 |
| 1008 HValue* value = hydrogen_env->values()->at(i); | 1012 HValue* value = hydrogen_env->values()->at(i); |
| 1009 LOperand* op = NULL; | 1013 LOperand* op = NULL; |
| 1010 if (value->IsArgumentsObject()) { | 1014 if (value->IsArgumentsObject()) { |
| 1011 op = NULL; | 1015 op = NULL; |
| 1012 } else if (value->IsPushArgument()) { | 1016 } else if (value->IsPushArgument()) { |
| 1013 op = new LArgument(argument_index++); | 1017 op = new LArgument((*argument_index_accumulator)++); |
| 1014 } else { | 1018 } else { |
| 1015 op = UseAny(value); | 1019 op = UseAny(value); |
| 1016 } | 1020 } |
| 1017 result->AddValue(op, value->representation()); | 1021 result->AddValue(op, value->representation()); |
| 1018 } | 1022 } |
| 1019 | 1023 |
| 1020 return result; | 1024 return result; |
| 1021 } | 1025 } |
| 1022 | 1026 |
| 1023 | 1027 |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 LOperand* key = UseOrConstantAtStart(instr->key()); | 2177 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2174 LOperand* object = UseOrConstantAtStart(instr->object()); | 2178 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2175 LIn* result = new LIn(key, object); | 2179 LIn* result = new LIn(key, object); |
| 2176 return MarkAsCall(DefineFixed(result, rax), instr); | 2180 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2177 } | 2181 } |
| 2178 | 2182 |
| 2179 | 2183 |
| 2180 } } // namespace v8::internal | 2184 } } // namespace v8::internal |
| 2181 | 2185 |
| 2182 #endif // V8_TARGET_ARCH_X64 | 2186 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |