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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 | 1006 |
1007 | 1007 |
1008 LEnvironment* LChunkBuilder::CreateEnvironment( | 1008 LEnvironment* LChunkBuilder::CreateEnvironment( |
1009 HEnvironment* hydrogen_env, | 1009 HEnvironment* hydrogen_env, |
1010 int* argument_index_accumulator) { | 1010 int* argument_index_accumulator) { |
1011 if (hydrogen_env == NULL) return NULL; | 1011 if (hydrogen_env == NULL) return NULL; |
1012 | 1012 |
1013 LEnvironment* outer = | 1013 LEnvironment* outer = |
1014 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 1014 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
1015 int ast_id = hydrogen_env->ast_id(); | 1015 int ast_id = hydrogen_env->ast_id(); |
1016 ASSERT(ast_id != AstNode::kNoNumber); | 1016 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor()); |
1017 int value_count = hydrogen_env->length(); | 1017 int value_count = hydrogen_env->length(); |
1018 LEnvironment* result = | 1018 LEnvironment* result = |
1019 new(zone()) LEnvironment(hydrogen_env->closure(), | 1019 new(zone()) LEnvironment(hydrogen_env->closure(), |
| 1020 hydrogen_env->is_arguments_adaptor(), |
1020 ast_id, | 1021 ast_id, |
1021 hydrogen_env->parameter_count(), | 1022 hydrogen_env->parameter_count(), |
1022 argument_count_, | 1023 argument_count_, |
1023 value_count, | 1024 value_count, |
1024 outer); | 1025 outer); |
| 1026 int argument_index = *argument_index_accumulator; |
1025 for (int i = 0; i < value_count; ++i) { | 1027 for (int i = 0; i < value_count; ++i) { |
1026 if (hydrogen_env->is_special_index(i)) continue; | 1028 if (hydrogen_env->is_special_index(i)) continue; |
1027 | 1029 |
1028 HValue* value = hydrogen_env->values()->at(i); | 1030 HValue* value = hydrogen_env->values()->at(i); |
1029 LOperand* op = NULL; | 1031 LOperand* op = NULL; |
1030 if (value->IsArgumentsObject()) { | 1032 if (value->IsArgumentsObject()) { |
1031 op = NULL; | 1033 op = NULL; |
1032 } else if (value->IsPushArgument()) { | 1034 } else if (value->IsPushArgument()) { |
1033 op = new(zone()) LArgument((*argument_index_accumulator)++); | 1035 op = new(zone()) LArgument(argument_index++); |
1034 } else { | 1036 } else { |
1035 op = UseAny(value); | 1037 op = UseAny(value); |
1036 } | 1038 } |
1037 result->AddValue(op, value->representation()); | 1039 result->AddValue(op, value->representation()); |
1038 } | 1040 } |
1039 | 1041 |
| 1042 if (!hydrogen_env->is_arguments_adaptor()) { |
| 1043 *argument_index_accumulator = argument_index; |
| 1044 } |
| 1045 |
1040 return result; | 1046 return result; |
1041 } | 1047 } |
1042 | 1048 |
1043 | 1049 |
1044 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1050 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
1045 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); | 1051 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); |
1046 } | 1052 } |
1047 | 1053 |
1048 | 1054 |
1049 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1055 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 return AssignEnvironment( | 2379 return AssignEnvironment( |
2374 AssignPointerMap(new(zone()) LStackCheck(context))); | 2380 AssignPointerMap(new(zone()) LStackCheck(context))); |
2375 } | 2381 } |
2376 } | 2382 } |
2377 | 2383 |
2378 | 2384 |
2379 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2385 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2380 HEnvironment* outer = current_block_->last_environment(); | 2386 HEnvironment* outer = current_block_->last_environment(); |
2381 HConstant* undefined = graph()->GetConstantUndefined(); | 2387 HConstant* undefined = graph()->GetConstantUndefined(); |
2382 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2388 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2389 instr->arguments_count(), |
2383 instr->function(), | 2390 instr->function(), |
2384 undefined, | 2391 undefined, |
2385 instr->call_kind()); | 2392 instr->call_kind()); |
2386 current_block_->UpdateEnvironment(inner); | 2393 current_block_->UpdateEnvironment(inner); |
2387 chunk_->AddInlinedClosure(instr->closure()); | 2394 chunk_->AddInlinedClosure(instr->closure()); |
2388 return NULL; | 2395 return NULL; |
2389 } | 2396 } |
2390 | 2397 |
2391 | 2398 |
2392 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2399 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2393 HEnvironment* outer = current_block_->last_environment()->outer(); | 2400 HEnvironment* outer = current_block_->last_environment()-> |
| 2401 DiscardInlined(false); |
2394 current_block_->UpdateEnvironment(outer); | 2402 current_block_->UpdateEnvironment(outer); |
2395 return NULL; | 2403 return NULL; |
2396 } | 2404 } |
2397 | 2405 |
2398 | 2406 |
2399 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2407 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2400 LOperand* context = UseFixed(instr->context(), esi); | 2408 LOperand* context = UseFixed(instr->context(), esi); |
2401 LOperand* key = UseOrConstantAtStart(instr->key()); | 2409 LOperand* key = UseOrConstantAtStart(instr->key()); |
2402 LOperand* object = UseOrConstantAtStart(instr->object()); | 2410 LOperand* object = UseOrConstantAtStart(instr->object()); |
2403 LIn* result = new(zone()) LIn(context, key, object); | 2411 LIn* result = new(zone()) LIn(context, key, object); |
2404 return MarkAsCall(DefineFixed(result, eax), instr); | 2412 return MarkAsCall(DefineFixed(result, eax), instr); |
2405 } | 2413 } |
2406 | 2414 |
2407 | 2415 |
2408 } } // namespace v8::internal | 2416 } } // namespace v8::internal |
2409 | 2417 |
2410 #endif // V8_TARGET_ARCH_IA32 | 2418 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |