OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 998 |
999 | 999 |
1000 LEnvironment* LChunkBuilder::CreateEnvironment( | 1000 LEnvironment* LChunkBuilder::CreateEnvironment( |
1001 HEnvironment* hydrogen_env, | 1001 HEnvironment* hydrogen_env, |
1002 int* argument_index_accumulator) { | 1002 int* argument_index_accumulator) { |
1003 if (hydrogen_env == NULL) return NULL; | 1003 if (hydrogen_env == NULL) return NULL; |
1004 | 1004 |
1005 LEnvironment* outer = | 1005 LEnvironment* outer = |
1006 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 1006 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
1007 int ast_id = hydrogen_env->ast_id(); | 1007 int ast_id = hydrogen_env->ast_id(); |
1008 ASSERT(ast_id != AstNode::kNoNumber); | 1008 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor()); |
1009 int value_count = hydrogen_env->length(); | 1009 int value_count = hydrogen_env->length(); |
1010 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1010 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 1011 hydrogen_env->is_arguments_adaptor(), |
1011 ast_id, | 1012 ast_id, |
1012 hydrogen_env->parameter_count(), | 1013 hydrogen_env->parameter_count(), |
1013 argument_count_, | 1014 argument_count_, |
1014 value_count, | 1015 value_count, |
1015 outer); | 1016 outer); |
| 1017 int argument_index = *argument_index_accumulator; |
1016 for (int i = 0; i < value_count; ++i) { | 1018 for (int i = 0; i < value_count; ++i) { |
1017 if (hydrogen_env->is_special_index(i)) continue; | 1019 if (hydrogen_env->is_special_index(i)) continue; |
1018 | 1020 |
1019 HValue* value = hydrogen_env->values()->at(i); | 1021 HValue* value = hydrogen_env->values()->at(i); |
1020 LOperand* op = NULL; | 1022 LOperand* op = NULL; |
1021 if (value->IsArgumentsObject()) { | 1023 if (value->IsArgumentsObject()) { |
1022 op = NULL; | 1024 op = NULL; |
1023 } else if (value->IsPushArgument()) { | 1025 } else if (value->IsPushArgument()) { |
1024 op = new LArgument((*argument_index_accumulator)++); | 1026 op = new LArgument(argument_index++); |
1025 } else { | 1027 } else { |
1026 op = UseAny(value); | 1028 op = UseAny(value); |
1027 } | 1029 } |
1028 result->AddValue(op, value->representation()); | 1030 result->AddValue(op, value->representation()); |
1029 } | 1031 } |
1030 | 1032 |
| 1033 if (!hydrogen_env->is_arguments_adaptor()) { |
| 1034 *argument_index_accumulator = argument_index; |
| 1035 } |
| 1036 |
1031 return result; | 1037 return result; |
1032 } | 1038 } |
1033 | 1039 |
1034 | 1040 |
1035 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1041 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
1036 return new LGoto(instr->FirstSuccessor()->block_id()); | 1042 return new LGoto(instr->FirstSuccessor()->block_id()); |
1037 } | 1043 } |
1038 | 1044 |
1039 | 1045 |
1040 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1046 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 ASSERT(instr->is_backwards_branch()); | 2246 ASSERT(instr->is_backwards_branch()); |
2241 return AssignEnvironment(AssignPointerMap(new LStackCheck)); | 2247 return AssignEnvironment(AssignPointerMap(new LStackCheck)); |
2242 } | 2248 } |
2243 } | 2249 } |
2244 | 2250 |
2245 | 2251 |
2246 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2252 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2247 HEnvironment* outer = current_block_->last_environment(); | 2253 HEnvironment* outer = current_block_->last_environment(); |
2248 HConstant* undefined = graph()->GetConstantUndefined(); | 2254 HConstant* undefined = graph()->GetConstantUndefined(); |
2249 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2255 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2256 instr->arguments_count(), |
2250 instr->function(), | 2257 instr->function(), |
2251 undefined, | 2258 undefined, |
2252 instr->call_kind()); | 2259 instr->call_kind()); |
2253 current_block_->UpdateEnvironment(inner); | 2260 current_block_->UpdateEnvironment(inner); |
2254 chunk_->AddInlinedClosure(instr->closure()); | 2261 chunk_->AddInlinedClosure(instr->closure()); |
2255 return NULL; | 2262 return NULL; |
2256 } | 2263 } |
2257 | 2264 |
2258 | 2265 |
2259 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2266 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2260 HEnvironment* outer = current_block_->last_environment()->outer(); | 2267 HEnvironment* outer = current_block_->last_environment()-> |
| 2268 DiscardInlined(false); |
2261 current_block_->UpdateEnvironment(outer); | 2269 current_block_->UpdateEnvironment(outer); |
2262 return NULL; | 2270 return NULL; |
2263 } | 2271 } |
2264 | 2272 |
2265 | 2273 |
2266 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2274 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2267 LOperand* key = UseRegisterAtStart(instr->key()); | 2275 LOperand* key = UseRegisterAtStart(instr->key()); |
2268 LOperand* object = UseRegisterAtStart(instr->object()); | 2276 LOperand* object = UseRegisterAtStart(instr->object()); |
2269 LIn* result = new LIn(key, object); | 2277 LIn* result = new LIn(key, object); |
2270 return MarkAsCall(DefineFixed(result, v0), instr); | 2278 return MarkAsCall(DefineFixed(result, v0), instr); |
2271 } | 2279 } |
2272 | 2280 |
2273 | 2281 |
2274 } } // namespace v8::internal | 2282 } } // namespace v8::internal |
OLD | NEW |