Chromium Code Reviews| 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 | 993 |
| 994 | 994 |
| 995 LEnvironment* LChunkBuilder::CreateEnvironment( | 995 LEnvironment* LChunkBuilder::CreateEnvironment( |
| 996 HEnvironment* hydrogen_env, | 996 HEnvironment* hydrogen_env, |
| 997 int* argument_index_accumulator) { | 997 int* argument_index_accumulator) { |
| 998 if (hydrogen_env == NULL) return NULL; | 998 if (hydrogen_env == NULL) return NULL; |
| 999 | 999 |
| 1000 LEnvironment* outer = | 1000 LEnvironment* outer = |
| 1001 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); | 1001 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); |
| 1002 int ast_id = hydrogen_env->ast_id(); | 1002 int ast_id = hydrogen_env->ast_id(); |
| 1003 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor()); | 1003 ASSERT(ast_id != AstNode::kNoNumber || |
| 1004 hydrogen_env->frame_type() != JS_FUNCTION); | |
| 1004 int value_count = hydrogen_env->length(); | 1005 int value_count = hydrogen_env->length(); |
| 1005 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1006 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 1006 hydrogen_env->is_arguments_adaptor(), | 1007 hydrogen_env->frame_type(), |
| 1007 ast_id, | 1008 ast_id, |
| 1008 hydrogen_env->parameter_count(), | 1009 hydrogen_env->parameter_count(), |
| 1009 argument_count_, | 1010 argument_count_, |
| 1010 value_count, | 1011 value_count, |
| 1011 outer); | 1012 outer); |
| 1012 int argument_index = *argument_index_accumulator; | 1013 int argument_index = *argument_index_accumulator; |
| 1013 for (int i = 0; i < value_count; ++i) { | 1014 for (int i = 0; i < value_count; ++i) { |
| 1014 if (hydrogen_env->is_special_index(i)) continue; | 1015 if (hydrogen_env->is_special_index(i)) continue; |
| 1015 | 1016 |
| 1016 HValue* value = hydrogen_env->values()->at(i); | 1017 HValue* value = hydrogen_env->values()->at(i); |
| 1017 LOperand* op = NULL; | 1018 LOperand* op = NULL; |
| 1018 if (value->IsArgumentsObject()) { | 1019 if (value->IsArgumentsObject()) { |
| 1019 op = NULL; | 1020 op = NULL; |
| 1020 } else if (value->IsPushArgument()) { | 1021 } else if (value->IsPushArgument()) { |
| 1021 op = new LArgument(argument_index++); | 1022 op = new LArgument(argument_index++); |
| 1022 } else { | 1023 } else { |
| 1023 op = UseAny(value); | 1024 op = UseAny(value); |
| 1024 } | 1025 } |
| 1025 result->AddValue(op, value->representation()); | 1026 result->AddValue(op, value->representation()); |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 if (!hydrogen_env->is_arguments_adaptor()) { | 1029 if (hydrogen_env->frame_type() == JS_FUNCTION) { |
| 1029 *argument_index_accumulator = argument_index; | 1030 *argument_index_accumulator = argument_index; |
| 1030 } | 1031 } |
| 1031 | 1032 |
| 1032 return result; | 1033 return result; |
| 1033 } | 1034 } |
| 1034 | 1035 |
| 1035 | 1036 |
| 1036 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1037 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 1037 return new LGoto(instr->FirstSuccessor()->block_id()); | 1038 return new LGoto(instr->FirstSuccessor()->block_id()); |
| 1038 } | 1039 } |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2086 return AssignPointerMap(DefineAsRegister(result)); | 2087 return AssignPointerMap(DefineAsRegister(result)); |
| 2087 } | 2088 } |
| 2088 | 2089 |
| 2089 | 2090 |
| 2090 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 2091 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
| 2091 LOperand* string = UseRegisterAtStart(instr->value()); | 2092 LOperand* string = UseRegisterAtStart(instr->value()); |
| 2092 return DefineAsRegister(new LStringLength(string)); | 2093 return DefineAsRegister(new LStringLength(string)); |
| 2093 } | 2094 } |
| 2094 | 2095 |
| 2095 | 2096 |
| 2097 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { | |
| 2098 LOperand* function = UseRegister(instr->function()); | |
|
Vyacheslav Egorov (Chromium)
2012/02/13 15:01:39
do we really need a register for this constant?
Michael Starzinger
2012/02/27 14:16:32
Done.
| |
| 2099 LAllocateObject* result = new LAllocateObject(function); | |
| 2100 return AssignPointerMap(DefineAsRegister(result)); | |
| 2101 } | |
| 2102 | |
| 2103 | |
| 2096 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2104 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
| 2097 return MarkAsCall(DefineFixed(new LArrayLiteral, r0), instr); | 2105 return MarkAsCall(DefineFixed(new LArrayLiteral, r0), instr); |
| 2098 } | 2106 } |
| 2099 | 2107 |
| 2100 | 2108 |
| 2101 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) { | 2109 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) { |
| 2102 return MarkAsCall(DefineFixed(new LObjectLiteralFast, r0), instr); | 2110 return MarkAsCall(DefineFixed(new LObjectLiteralFast, r0), instr); |
| 2103 } | 2111 } |
| 2104 | 2112 |
| 2105 | 2113 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2239 } | 2247 } |
| 2240 | 2248 |
| 2241 | 2249 |
| 2242 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2250 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2243 HEnvironment* outer = current_block_->last_environment(); | 2251 HEnvironment* outer = current_block_->last_environment(); |
| 2244 HConstant* undefined = graph()->GetConstantUndefined(); | 2252 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2245 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2253 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2246 instr->arguments_count(), | 2254 instr->arguments_count(), |
| 2247 instr->function(), | 2255 instr->function(), |
| 2248 undefined, | 2256 undefined, |
| 2249 instr->call_kind()); | 2257 instr->call_kind(), |
| 2258 instr->is_construct()); | |
| 2250 current_block_->UpdateEnvironment(inner); | 2259 current_block_->UpdateEnvironment(inner); |
| 2251 chunk_->AddInlinedClosure(instr->closure()); | 2260 chunk_->AddInlinedClosure(instr->closure()); |
| 2252 return NULL; | 2261 return NULL; |
| 2253 } | 2262 } |
| 2254 | 2263 |
| 2255 | 2264 |
| 2256 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2265 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2257 HEnvironment* outer = current_block_->last_environment()-> | 2266 HEnvironment* outer = current_block_->last_environment()-> |
| 2258 DiscardInlined(false); | 2267 DiscardInlined(false); |
| 2259 current_block_->UpdateEnvironment(outer); | 2268 current_block_->UpdateEnvironment(outer); |
| 2260 return NULL; | 2269 return NULL; |
| 2261 } | 2270 } |
| 2262 | 2271 |
| 2263 | 2272 |
| 2264 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2273 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2265 LOperand* key = UseRegisterAtStart(instr->key()); | 2274 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2266 LOperand* object = UseRegisterAtStart(instr->object()); | 2275 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2267 LIn* result = new LIn(key, object); | 2276 LIn* result = new LIn(key, object); |
| 2268 return MarkAsCall(DefineFixed(result, r0), instr); | 2277 return MarkAsCall(DefineFixed(result, r0), instr); |
| 2269 } | 2278 } |
| 2270 | 2279 |
| 2271 | 2280 |
| 2272 } } // namespace v8::internal | 2281 } } // namespace v8::internal |
| OLD | NEW |