| 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 | 988 |
| 989 | 989 |
| 990 LEnvironment* LChunkBuilder::CreateEnvironment( | 990 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 991 HEnvironment* hydrogen_env, | 991 HEnvironment* hydrogen_env, |
| 992 int* argument_index_accumulator) { | 992 int* argument_index_accumulator) { |
| 993 if (hydrogen_env == NULL) return NULL; | 993 if (hydrogen_env == NULL) return NULL; |
| 994 | 994 |
| 995 LEnvironment* outer = | 995 LEnvironment* outer = |
| 996 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 996 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
| 997 int ast_id = hydrogen_env->ast_id(); | 997 int ast_id = hydrogen_env->ast_id(); |
| 998 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor()); | 998 ASSERT(ast_id != AstNode::kNoNumber || |
| 999 hydrogen_env->frame_type() != JS_FUNCTION); |
| 999 int value_count = hydrogen_env->length(); | 1000 int value_count = hydrogen_env->length(); |
| 1000 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1001 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 1001 hydrogen_env->is_arguments_adaptor(), | 1002 hydrogen_env->frame_type(), |
| 1002 ast_id, | 1003 ast_id, |
| 1003 hydrogen_env->parameter_count(), | 1004 hydrogen_env->parameter_count(), |
| 1004 argument_count_, | 1005 argument_count_, |
| 1005 value_count, | 1006 value_count, |
| 1006 outer); | 1007 outer); |
| 1007 int argument_index = *argument_index_accumulator; | 1008 int argument_index = *argument_index_accumulator; |
| 1008 for (int i = 0; i < value_count; ++i) { | 1009 for (int i = 0; i < value_count; ++i) { |
| 1009 if (hydrogen_env->is_special_index(i)) continue; | 1010 if (hydrogen_env->is_special_index(i)) continue; |
| 1010 | 1011 |
| 1011 HValue* value = hydrogen_env->values()->at(i); | 1012 HValue* value = hydrogen_env->values()->at(i); |
| 1012 LOperand* op = NULL; | 1013 LOperand* op = NULL; |
| 1013 if (value->IsArgumentsObject()) { | 1014 if (value->IsArgumentsObject()) { |
| 1014 op = NULL; | 1015 op = NULL; |
| 1015 } else if (value->IsPushArgument()) { | 1016 } else if (value->IsPushArgument()) { |
| 1016 op = new LArgument(argument_index++); | 1017 op = new LArgument(argument_index++); |
| 1017 } else { | 1018 } else { |
| 1018 op = UseAny(value); | 1019 op = UseAny(value); |
| 1019 } | 1020 } |
| 1020 result->AddValue(op, value->representation()); | 1021 result->AddValue(op, value->representation()); |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 if (!hydrogen_env->is_arguments_adaptor()) { | 1024 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
| 1024 *argument_index_accumulator = argument_index; | 1025 *argument_index_accumulator = argument_index; |
| 1025 } | 1026 } |
| 1026 | 1027 |
| 1027 return result; | 1028 return result; |
| 1028 } | 1029 } |
| 1029 | 1030 |
| 1030 | 1031 |
| 1031 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1032 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 1032 return new LGoto(instr->FirstSuccessor()->block_id()); | 1033 return new LGoto(instr->FirstSuccessor()->block_id()); |
| 1033 } | 1034 } |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 } | 2250 } |
| 2250 | 2251 |
| 2251 | 2252 |
| 2252 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2253 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2253 HEnvironment* outer = current_block_->last_environment(); | 2254 HEnvironment* outer = current_block_->last_environment(); |
| 2254 HConstant* undefined = graph()->GetConstantUndefined(); | 2255 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2255 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2256 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2256 instr->arguments_count(), | 2257 instr->arguments_count(), |
| 2257 instr->function(), | 2258 instr->function(), |
| 2258 undefined, | 2259 undefined, |
| 2259 instr->call_kind()); | 2260 instr->call_kind(), |
| 2261 instr->is_construct()); |
| 2260 current_block_->UpdateEnvironment(inner); | 2262 current_block_->UpdateEnvironment(inner); |
| 2261 chunk_->AddInlinedClosure(instr->closure()); | 2263 chunk_->AddInlinedClosure(instr->closure()); |
| 2262 return NULL; | 2264 return NULL; |
| 2263 } | 2265 } |
| 2264 | 2266 |
| 2265 | 2267 |
| 2266 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2268 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2267 HEnvironment* outer = current_block_->last_environment()-> | 2269 HEnvironment* outer = current_block_->last_environment()-> |
| 2268 DiscardInlined(false); | 2270 DiscardInlined(false); |
| 2269 current_block_->UpdateEnvironment(outer); | 2271 current_block_->UpdateEnvironment(outer); |
| 2270 return NULL; | 2272 return NULL; |
| 2271 } | 2273 } |
| 2272 | 2274 |
| 2273 | 2275 |
| 2274 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2276 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2275 LOperand* key = UseRegisterAtStart(instr->key()); | 2277 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2276 LOperand* object = UseRegisterAtStart(instr->object()); | 2278 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2277 LIn* result = new LIn(key, object); | 2279 LIn* result = new LIn(key, object); |
| 2278 return MarkAsCall(DefineFixed(result, v0), instr); | 2280 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2279 } | 2281 } |
| 2280 | 2282 |
| 2281 | 2283 |
| 2282 } } // namespace v8::internal | 2284 } } // namespace v8::internal |
| OLD | NEW |