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