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

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

Issue 8598014: Implement code stub for object literal creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Florian Schneider. Created 9 years, 1 month 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/full-codegen-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('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 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 4145 matching lines...) Expand 10 before | Expand all | Expand 10 after
4156 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS 4156 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS
4157 : FastCloneShallowArrayStub::CLONE_ELEMENTS; 4157 : FastCloneShallowArrayStub::CLONE_ELEMENTS;
4158 FastCloneShallowArrayStub stub(mode, length); 4158 FastCloneShallowArrayStub stub(mode, length);
4159 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4159 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4160 } 4160 }
4161 } 4161 }
4162 4162
4163 4163
4164 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 4164 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
4165 ASSERT(ToRegister(instr->context()).is(esi)); 4165 ASSERT(ToRegister(instr->context()).is(esi));
4166 Handle<FixedArray> constant_properties =
4167 instr->hydrogen()->constant_properties();
4168
4166 // Setup the parameters to the stub/runtime call. 4169 // Setup the parameters to the stub/runtime call.
4167 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 4170 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
4168 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset)); 4171 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset));
4169 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); 4172 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
4170 __ push(Immediate(instr->hydrogen()->constant_properties())); 4173 __ push(Immediate(constant_properties));
4171 int flags = instr->hydrogen()->fast_elements() 4174 int flags = instr->hydrogen()->fast_elements()
4172 ? ObjectLiteral::kFastElements 4175 ? ObjectLiteral::kFastElements
4173 : ObjectLiteral::kNoFlags; 4176 : ObjectLiteral::kNoFlags;
4174 flags |= instr->hydrogen()->has_function() 4177 flags |= instr->hydrogen()->has_function()
4175 ? ObjectLiteral::kHasFunction 4178 ? ObjectLiteral::kHasFunction
4176 : ObjectLiteral::kNoFlags; 4179 : ObjectLiteral::kNoFlags;
4177 __ push(Immediate(Smi::FromInt(flags))); 4180 __ push(Immediate(Smi::FromInt(flags)));
4178 4181
4179 // Pick the right runtime function to call. 4182 // Pick the right runtime function or stub to call.
4183 int properties_count = constant_properties->length() / 2;
4180 if (instr->hydrogen()->depth() > 1) { 4184 if (instr->hydrogen()->depth() > 1) {
4181 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 4185 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
4186 } else if (flags != ObjectLiteral::kFastElements ||
4187 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
4188 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
4182 } else { 4189 } else {
4183 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 4190 FastCloneShallowObjectStub stub(properties_count);
4191 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4184 } 4192 }
4185 } 4193 }
4186 4194
4187 4195
4188 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 4196 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
4189 ASSERT(ToRegister(instr->InputAt(0)).is(eax)); 4197 ASSERT(ToRegister(instr->InputAt(0)).is(eax));
4190 __ push(eax); 4198 __ push(eax);
4191 CallRuntime(Runtime::kToFastProperties, 1, instr); 4199 CallRuntime(Runtime::kToFastProperties, 1, instr);
4192 } 4200 }
4193 4201
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 this, pointers, Safepoint::kLazyDeopt); 4549 this, pointers, Safepoint::kLazyDeopt);
4542 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4550 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4543 } 4551 }
4544 4552
4545 4553
4546 #undef __ 4554 #undef __
4547 4555
4548 } } // namespace v8::internal 4556 } } // namespace v8::internal
4549 4557
4550 #endif // V8_TARGET_ARCH_IA32 4558 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698