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

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

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 10 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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 1001
1002 1002
1003 LEnvironment* LChunkBuilder::CreateEnvironment( 1003 LEnvironment* LChunkBuilder::CreateEnvironment(
1004 HEnvironment* hydrogen_env, 1004 HEnvironment* hydrogen_env,
1005 int* argument_index_accumulator) { 1005 int* argument_index_accumulator) {
1006 if (hydrogen_env == NULL) return NULL; 1006 if (hydrogen_env == NULL) return NULL;
1007 1007
1008 LEnvironment* outer = 1008 LEnvironment* outer =
1009 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); 1009 CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator);
1010 int ast_id = hydrogen_env->ast_id(); 1010 int ast_id = hydrogen_env->ast_id();
1011 ASSERT(ast_id != AstNode::kNoNumber || hydrogen_env->is_arguments_adaptor()); 1011 ASSERT(ast_id != AstNode::kNoNumber ||
1012 hydrogen_env->frame_type() != JS_FUNCTION);
1012 int value_count = hydrogen_env->length(); 1013 int value_count = hydrogen_env->length();
1013 LEnvironment* result = 1014 LEnvironment* result =
1014 new(zone()) LEnvironment(hydrogen_env->closure(), 1015 new(zone()) LEnvironment(hydrogen_env->closure(),
1015 hydrogen_env->is_arguments_adaptor(), 1016 hydrogen_env->frame_type(),
1016 ast_id, 1017 ast_id,
1017 hydrogen_env->parameter_count(), 1018 hydrogen_env->parameter_count(),
1018 argument_count_, 1019 argument_count_,
1019 value_count, 1020 value_count,
1020 outer); 1021 outer);
1021 int argument_index = *argument_index_accumulator; 1022 int argument_index = *argument_index_accumulator;
1022 for (int i = 0; i < value_count; ++i) { 1023 for (int i = 0; i < value_count; ++i) {
1023 if (hydrogen_env->is_special_index(i)) continue; 1024 if (hydrogen_env->is_special_index(i)) continue;
1024 1025
1025 HValue* value = hydrogen_env->values()->at(i); 1026 HValue* value = hydrogen_env->values()->at(i);
1026 LOperand* op = NULL; 1027 LOperand* op = NULL;
1027 if (value->IsArgumentsObject()) { 1028 if (value->IsArgumentsObject()) {
1028 op = NULL; 1029 op = NULL;
1029 } else if (value->IsPushArgument()) { 1030 } else if (value->IsPushArgument()) {
1030 op = new(zone()) LArgument(argument_index++); 1031 op = new(zone()) LArgument(argument_index++);
1031 } else { 1032 } else {
1032 op = UseAny(value); 1033 op = UseAny(value);
1033 } 1034 }
1034 result->AddValue(op, value->representation()); 1035 result->AddValue(op, value->representation());
1035 } 1036 }
1036 1037
1037 if (!hydrogen_env->is_arguments_adaptor()) { 1038 if (hydrogen_env->frame_type() == JS_FUNCTION) {
1038 *argument_index_accumulator = argument_index; 1039 *argument_index_accumulator = argument_index;
1039 } 1040 }
1040 1041
1041 return result; 1042 return result;
1042 } 1043 }
1043 1044
1044 1045
1045 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1046 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1046 return new(zone()) LGoto(instr->FirstSuccessor()->block_id()); 1047 return new(zone()) LGoto(instr->FirstSuccessor()->block_id());
1047 } 1048 }
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 return AssignPointerMap(DefineAsRegister(result)); 2203 return AssignPointerMap(DefineAsRegister(result));
2203 } 2204 }
2204 2205
2205 2206
2206 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { 2207 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) {
2207 LOperand* string = UseRegisterAtStart(instr->value()); 2208 LOperand* string = UseRegisterAtStart(instr->value());
2208 return DefineAsRegister(new(zone()) LStringLength(string)); 2209 return DefineAsRegister(new(zone()) LStringLength(string));
2209 } 2210 }
2210 2211
2211 2212
2213 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
2214 LOperand* context = UseFixed(instr->context(), esi);
2215 LAllocateObject* result = new(zone()) LAllocateObject(context);
2216 return AssignPointerMap(DefineAsRegister(result));
2217 }
2218
2219
2212 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { 2220 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) {
2213 LOperand* context = UseFixed(instr->context(), esi); 2221 LOperand* context = UseFixed(instr->context(), esi);
2214 return MarkAsCall( 2222 return MarkAsCall(
2215 DefineFixed(new(zone()) LArrayLiteral(context), eax), instr); 2223 DefineFixed(new(zone()) LArrayLiteral(context), eax), instr);
2216 } 2224 }
2217 2225
2218 2226
2219 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) { 2227 LInstruction* LChunkBuilder::DoObjectLiteralFast(HObjectLiteralFast* instr) {
2220 LOperand* context = UseFixed(instr->context(), esi); 2228 LOperand* context = UseFixed(instr->context(), esi);
2221 return MarkAsCall( 2229 return MarkAsCall(
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 } 2383 }
2376 2384
2377 2385
2378 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2386 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2379 HEnvironment* outer = current_block_->last_environment(); 2387 HEnvironment* outer = current_block_->last_environment();
2380 HConstant* undefined = graph()->GetConstantUndefined(); 2388 HConstant* undefined = graph()->GetConstantUndefined();
2381 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2389 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2382 instr->arguments_count(), 2390 instr->arguments_count(),
2383 instr->function(), 2391 instr->function(),
2384 undefined, 2392 undefined,
2385 instr->call_kind()); 2393 instr->call_kind(),
2394 instr->is_construct());
2386 current_block_->UpdateEnvironment(inner); 2395 current_block_->UpdateEnvironment(inner);
2387 chunk_->AddInlinedClosure(instr->closure()); 2396 chunk_->AddInlinedClosure(instr->closure());
2388 return NULL; 2397 return NULL;
2389 } 2398 }
2390 2399
2391 2400
2392 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 2401 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
2393 HEnvironment* outer = current_block_->last_environment()-> 2402 HEnvironment* outer = current_block_->last_environment()->
2394 DiscardInlined(false); 2403 DiscardInlined(false);
2395 current_block_->UpdateEnvironment(outer); 2404 current_block_->UpdateEnvironment(outer);
2396 return NULL; 2405 return NULL;
2397 } 2406 }
2398 2407
2399 2408
2400 LInstruction* LChunkBuilder::DoIn(HIn* instr) { 2409 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2401 LOperand* context = UseFixed(instr->context(), esi); 2410 LOperand* context = UseFixed(instr->context(), esi);
2402 LOperand* key = UseOrConstantAtStart(instr->key()); 2411 LOperand* key = UseOrConstantAtStart(instr->key());
2403 LOperand* object = UseOrConstantAtStart(instr->object()); 2412 LOperand* object = UseOrConstantAtStart(instr->object());
2404 LIn* result = new(zone()) LIn(context, key, object); 2413 LIn* result = new(zone()) LIn(context, key, object);
2405 return MarkAsCall(DefineFixed(result, eax), instr); 2414 return MarkAsCall(DefineFixed(result, eax), instr);
2406 } 2415 }
2407 2416
2408 2417
2409 } } // namespace v8::internal 2418 } } // namespace v8::internal
2410 2419
2411 #endif // V8_TARGET_ARCH_IA32 2420 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/lithium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698