Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/x64/lithium-x64.cc

Issue 9265004: Support inlining at call-sites with mismatched number of arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: finished implementation, extended tests, ported to x64&arm Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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); 1003 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor());
1004 int value_count = hydrogen_env->length(); 1004 int value_count = hydrogen_env->length();
1005 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), 1005 LEnvironment* result = new LEnvironment(hydrogen_env->closure(),
1006 hydrogen_env->is_arguments_adaptor(),
1006 ast_id, 1007 ast_id,
1007 hydrogen_env->parameter_count(), 1008 hydrogen_env->parameter_count(),
1008 argument_count_, 1009 argument_count_,
1009 value_count, 1010 value_count,
1010 outer); 1011 outer);
1012 int argument_index = *argument_index_accumulator;
1011 for (int i = 0; i < value_count; ++i) { 1013 for (int i = 0; i < value_count; ++i) {
1012 if (hydrogen_env->is_special_index(i)) continue; 1014 if (hydrogen_env->is_special_index(i)) continue;
1013 1015
1014 HValue* value = hydrogen_env->values()->at(i); 1016 HValue* value = hydrogen_env->values()->at(i);
1015 LOperand* op = NULL; 1017 LOperand* op = NULL;
1016 if (value->IsArgumentsObject()) { 1018 if (value->IsArgumentsObject()) {
1017 op = NULL; 1019 op = NULL;
1018 } else if (value->IsPushArgument()) { 1020 } else if (value->IsPushArgument()) {
1019 op = new LArgument((*argument_index_accumulator)++); 1021 op = new LArgument(argument_index++);
1020 } else { 1022 } else {
1021 op = UseAny(value); 1023 op = UseAny(value);
1022 } 1024 }
1023 result->AddValue(op, value->representation()); 1025 result->AddValue(op, value->representation());
1024 } 1026 }
1025 1027
1028 if (!hydrogen_env->is_arguments_adaptor()) {
1029 *argument_index_accumulator = argument_index;
1030 }
1031
1026 return result; 1032 return result;
1027 } 1033 }
1028 1034
1029 1035
1030 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1036 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1031 return new LGoto(instr->FirstSuccessor()->block_id()); 1037 return new LGoto(instr->FirstSuccessor()->block_id());
1032 } 1038 }
1033 1039
1034 1040
1035 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { 1041 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 ASSERT(instr->is_backwards_branch()); 2244 ASSERT(instr->is_backwards_branch());
2239 return AssignEnvironment(AssignPointerMap(new LStackCheck)); 2245 return AssignEnvironment(AssignPointerMap(new LStackCheck));
2240 } 2246 }
2241 } 2247 }
2242 2248
2243 2249
2244 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2250 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2245 HEnvironment* outer = current_block_->last_environment(); 2251 HEnvironment* outer = current_block_->last_environment();
2246 HConstant* undefined = graph()->GetConstantUndefined(); 2252 HConstant* undefined = graph()->GetConstantUndefined();
2247 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2253 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2254 instr->arguments_count(),
2248 instr->function(), 2255 instr->function(),
2249 undefined, 2256 undefined,
2250 instr->call_kind()); 2257 instr->call_kind());
2251 current_block_->UpdateEnvironment(inner); 2258 current_block_->UpdateEnvironment(inner);
2252 chunk_->AddInlinedClosure(instr->closure()); 2259 chunk_->AddInlinedClosure(instr->closure());
2253 return NULL; 2260 return NULL;
2254 } 2261 }
2255 2262
2256 2263
2257 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2264 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2258 HEnvironment* outer = current_block_->last_environment()->outer(); 2265 HEnvironment* outer = current_block_->last_environment()->
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 = UseOrConstantAtStart(instr->key()); 2273 LOperand* key = UseOrConstantAtStart(instr->key());
2266 LOperand* object = UseOrConstantAtStart(instr->object()); 2274 LOperand* object = UseOrConstantAtStart(instr->object());
2267 LIn* result = new LIn(key, object); 2275 LIn* result = new LIn(key, object);
2268 return MarkAsCall(DefineFixed(result, rax), instr); 2276 return MarkAsCall(DefineFixed(result, rax), instr);
2269 } 2277 }
2270 2278
2271 2279
2272 } } // namespace v8::internal 2280 } } // namespace v8::internal
2273 2281
2274 #endif // V8_TARGET_ARCH_X64 2282 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698