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

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

Issue 6240012: Optimize calls to object literal properties that are initialized with a funct... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: added x64 and arm code. Created 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 } 3339 }
3340 } 3340 }
3341 3341
3342 3342
3343 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 3343 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
3344 // Setup the parameters to the stub/runtime call. 3344 // Setup the parameters to the stub/runtime call.
3345 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 3345 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
3346 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset)); 3346 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset));
3347 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); 3347 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
3348 __ push(Immediate(instr->hydrogen()->constant_properties())); 3348 __ push(Immediate(instr->hydrogen()->constant_properties()));
3349 __ push(Immediate(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0))); 3349 int flags = instr->hydrogen()->fast_elements()
3350 ? ObjectLiteral::kFastElements
3351 : ObjectLiteral::kNoFlags;
3352 flags |= instr->hydrogen()->has_function()
3353 ? ObjectLiteral::kHasFunction
3354 : ObjectLiteral::kNoFlags;
3355 __ push(Immediate(Smi::FromInt(flags)));
3350 3356
3351 // Pick the right runtime function to call. 3357 // Pick the right runtime function to call.
3352 if (instr->hydrogen()->depth() > 1) { 3358 if (instr->hydrogen()->depth() > 1) {
3353 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 3359 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
3354 } else { 3360 } else {
3355 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 3361 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
3356 } 3362 }
3357 } 3363 }
3358 3364
3359 3365
3366 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
3367 ASSERT(ToRegister(instr->InputAt(0)).is(eax));
3368 __ push(eax);
3369 CallRuntime(Runtime::kToFastProperties, 1, instr);
3370 }
3371
3372
3360 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { 3373 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
3361 NearLabel materialized; 3374 NearLabel materialized;
3362 // Registers will be used as follows: 3375 // Registers will be used as follows:
3363 // edi = JS function. 3376 // edi = JS function.
3364 // ecx = literals array. 3377 // ecx = literals array.
3365 // ebx = regexp literal. 3378 // ebx = regexp literal.
3366 // eax = regexp literal clone. 3379 // eax = regexp literal clone.
3367 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 3380 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
3368 __ mov(ecx, FieldOperand(edi, JSFunction::kLiteralsOffset)); 3381 __ mov(ecx, FieldOperand(edi, JSFunction::kLiteralsOffset));
3369 int literal_offset = FixedArray::kHeaderSize + 3382 int literal_offset = FixedArray::kHeaderSize +
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 ASSERT(osr_pc_offset_ == -1); 3624 ASSERT(osr_pc_offset_ == -1);
3612 osr_pc_offset_ = masm()->pc_offset(); 3625 osr_pc_offset_ = masm()->pc_offset();
3613 } 3626 }
3614 3627
3615 3628
3616 #undef __ 3629 #undef __
3617 3630
3618 } } // namespace v8::internal 3631 } } // namespace v8::internal
3619 3632
3620 #endif // V8_TARGET_ARCH_IA32 3633 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698