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 LAllocateObject* result = new LAllocateObject(); |
| 2099 return AssignPointerMap(DefineAsRegister(result)); |
| 2100 } |
| 2101 |
| 2102 |
2096 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2103 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
2097 return MarkAsCall(DefineFixed(new LArrayLiteral, r0), instr); | 2104 return MarkAsCall(DefineFixed(new LArrayLiteral, r0), instr); |
2098 } | 2105 } |
2099 | 2106 |
2100 | 2107 |
2101 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) { | 2108 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) { |
2102 return MarkAsCall(DefineFixed(new LObjectLiteralFast, r0), instr); | 2109 return MarkAsCall(DefineFixed(new LObjectLiteralFast, r0), instr); |
2103 } | 2110 } |
2104 | 2111 |
2105 | 2112 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 } | 2246 } |
2240 | 2247 |
2241 | 2248 |
2242 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2249 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2243 HEnvironment* outer = current_block_->last_environment(); | 2250 HEnvironment* outer = current_block_->last_environment(); |
2244 HConstant* undefined = graph()->GetConstantUndefined(); | 2251 HConstant* undefined = graph()->GetConstantUndefined(); |
2245 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2252 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2246 instr->arguments_count(), | 2253 instr->arguments_count(), |
2247 instr->function(), | 2254 instr->function(), |
2248 undefined, | 2255 undefined, |
2249 instr->call_kind()); | 2256 instr->call_kind(), |
| 2257 instr->is_construct()); |
2250 current_block_->UpdateEnvironment(inner); | 2258 current_block_->UpdateEnvironment(inner); |
2251 chunk_->AddInlinedClosure(instr->closure()); | 2259 chunk_->AddInlinedClosure(instr->closure()); |
2252 return NULL; | 2260 return NULL; |
2253 } | 2261 } |
2254 | 2262 |
2255 | 2263 |
2256 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2264 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2257 HEnvironment* outer = current_block_->last_environment()-> | 2265 HEnvironment* outer = current_block_->last_environment()-> |
2258 DiscardInlined(false); | 2266 DiscardInlined(false); |
2259 current_block_->UpdateEnvironment(outer); | 2267 current_block_->UpdateEnvironment(outer); |
2260 return NULL; | 2268 return NULL; |
2261 } | 2269 } |
2262 | 2270 |
2263 | 2271 |
2264 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2272 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2265 LOperand* key = UseRegisterAtStart(instr->key()); | 2273 LOperand* key = UseRegisterAtStart(instr->key()); |
2266 LOperand* object = UseRegisterAtStart(instr->object()); | 2274 LOperand* object = UseRegisterAtStart(instr->object()); |
2267 LIn* result = new LIn(key, object); | 2275 LIn* result = new LIn(key, object); |
2268 return MarkAsCall(DefineFixed(result, r0), instr); | 2276 return MarkAsCall(DefineFixed(result, r0), instr); |
2269 } | 2277 } |
2270 | 2278 |
2271 | 2279 |
2272 } } // namespace v8::internal | 2280 } } // namespace v8::internal |
OLD | NEW |