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

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

Issue 9388007: Allow inlining of functions containing object literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test case. 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/mips/lithium-codegen-mips.cc ('k') | test/mjsunit/compiler/inline-literals.js » ('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 4010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 4021
4022 __ bind(&allocated); 4022 __ bind(&allocated);
4023 int offset = 0; 4023 int offset = 0;
4024 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate()); 4024 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate());
4025 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset); 4025 EmitDeepCopy(instr->hydrogen()->boilerplate(), rax, rbx, &offset);
4026 ASSERT_EQ(size, offset); 4026 ASSERT_EQ(size, offset);
4027 } 4027 }
4028 4028
4029 4029
4030 void LCodeGen::DoObjectLiteralGeneric(LObjectLiteralGeneric* instr) { 4030 void LCodeGen::DoObjectLiteralGeneric(LObjectLiteralGeneric* instr) {
4031 Handle<FixedArray> literals(instr->environment()->closure()->literals());
4031 Handle<FixedArray> constant_properties = 4032 Handle<FixedArray> constant_properties =
4032 instr->hydrogen()->constant_properties(); 4033 instr->hydrogen()->constant_properties();
4033 4034
4034 // Set up the parameters to the stub/runtime call. 4035 // Set up the parameters to the stub/runtime call.
4035 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 4036 __ PushHeapObject(literals);
4036 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset));
4037 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); 4037 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
4038 __ Push(constant_properties); 4038 __ Push(constant_properties);
4039 int flags = instr->hydrogen()->fast_elements() 4039 int flags = instr->hydrogen()->fast_elements()
4040 ? ObjectLiteral::kFastElements 4040 ? ObjectLiteral::kFastElements
4041 : ObjectLiteral::kNoFlags; 4041 : ObjectLiteral::kNoFlags;
4042 flags |= instr->hydrogen()->has_function() 4042 flags |= instr->hydrogen()->has_function()
4043 ? ObjectLiteral::kHasFunction 4043 ? ObjectLiteral::kHasFunction
4044 : ObjectLiteral::kNoFlags; 4044 : ObjectLiteral::kNoFlags;
4045 __ Push(Smi::FromInt(flags)); 4045 __ Push(Smi::FromInt(flags));
4046 4046
4047 // Pick the right runtime function to call. 4047 // Pick the right runtime function or stub to call.
4048 int properties_count = constant_properties->length() / 2; 4048 int properties_count = constant_properties->length() / 2;
4049 if (instr->hydrogen()->depth() > 1) { 4049 if (instr->hydrogen()->depth() > 1) {
4050 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 4050 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
4051 } else if (flags != ObjectLiteral::kFastElements || 4051 } else if (flags != ObjectLiteral::kFastElements ||
4052 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 4052 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
4053 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 4053 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
4054 } else { 4054 } else {
4055 FastCloneShallowObjectStub stub(properties_count); 4055 FastCloneShallowObjectStub stub(properties_count);
4056 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4056 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4057 } 4057 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 4404 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
4405 ASSERT(osr_pc_offset_ == -1); 4405 ASSERT(osr_pc_offset_ == -1);
4406 osr_pc_offset_ = masm()->pc_offset(); 4406 osr_pc_offset_ = masm()->pc_offset();
4407 } 4407 }
4408 4408
4409 #undef __ 4409 #undef __
4410 4410
4411 } } // namespace v8::internal 4411 } } // namespace v8::internal
4412 4412
4413 #endif // V8_TARGET_ARCH_X64 4413 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | test/mjsunit/compiler/inline-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698