| 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2237 ASSERT(instr->is_backwards_branch()); | 2243 ASSERT(instr->is_backwards_branch()); |
| 2238 return AssignEnvironment(AssignPointerMap(new LStackCheck)); | 2244 return AssignEnvironment(AssignPointerMap(new LStackCheck)); |
| 2239 } | 2245 } |
| 2240 } | 2246 } |
| 2241 | 2247 |
| 2242 | 2248 |
| 2243 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2249 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2244 HEnvironment* outer = current_block_->last_environment(); | 2250 HEnvironment* outer = current_block_->last_environment(); |
| 2245 HConstant* undefined = graph()->GetConstantUndefined(); | 2251 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2246 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2252 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2253 instr->arguments_count(), |
| 2247 instr->function(), | 2254 instr->function(), |
| 2248 undefined, | 2255 undefined, |
| 2249 instr->call_kind()); | 2256 instr->call_kind()); |
| 2250 current_block_->UpdateEnvironment(inner); | 2257 current_block_->UpdateEnvironment(inner); |
| 2251 chunk_->AddInlinedClosure(instr->closure()); | 2258 chunk_->AddInlinedClosure(instr->closure()); |
| 2252 return NULL; | 2259 return NULL; |
| 2253 } | 2260 } |
| 2254 | 2261 |
| 2255 | 2262 |
| 2256 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2263 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2257 HEnvironment* outer = current_block_->last_environment()->outer(); | 2264 HEnvironment* outer = current_block_->last_environment()-> |
| 2265 DiscardInlined(false); |
| 2258 current_block_->UpdateEnvironment(outer); | 2266 current_block_->UpdateEnvironment(outer); |
| 2259 return NULL; | 2267 return NULL; |
| 2260 } | 2268 } |
| 2261 | 2269 |
| 2262 | 2270 |
| 2263 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2271 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2264 LOperand* key = UseRegisterAtStart(instr->key()); | 2272 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2265 LOperand* object = UseRegisterAtStart(instr->object()); | 2273 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2266 LIn* result = new LIn(key, object); | 2274 LIn* result = new LIn(key, object); |
| 2267 return MarkAsCall(DefineFixed(result, r0), instr); | 2275 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2268 } | 2276 } |
| 2269 | 2277 |
| 2270 | 2278 |
| 2271 } } // namespace v8::internal | 2279 } } // namespace v8::internal |
| OLD | NEW |