OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5205 FastCloneShallowArrayStub::Mode mode = | 5205 FastCloneShallowArrayStub::Mode mode = |
5206 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 5206 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
5207 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 5207 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
5208 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 5208 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
5209 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 5209 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
5210 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 5210 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
5211 } | 5211 } |
5212 } | 5212 } |
5213 | 5213 |
5214 | 5214 |
5215 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | |
5216 Handle<FixedArray> literals = instr->hydrogen()->literals(); | |
5217 Handle<FixedArray> constant_properties = | |
5218 instr->hydrogen()->constant_properties(); | |
5219 | |
5220 int flags = instr->hydrogen()->fast_elements() | |
5221 ? ObjectLiteral::kFastElements | |
5222 : ObjectLiteral::kNoFlags; | |
5223 flags |= instr->hydrogen()->has_function() | |
5224 ? ObjectLiteral::kHasFunction | |
5225 : ObjectLiteral::kNoFlags; | |
5226 | |
5227 // Set up the parameters to the stub/runtime call and pick the right | |
5228 // runtime function or stub to call. | |
5229 int properties_count = instr->hydrogen()->constant_properties_length() / 2; | |
5230 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) || | |
5231 instr->hydrogen()->depth() > 1) { | |
5232 __ PushHeapObject(literals); | |
5233 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | |
5234 __ Push(constant_properties); | |
5235 __ Push(Smi::FromInt(flags)); | |
5236 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | |
5237 } else if (flags != ObjectLiteral::kFastElements || | |
5238 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | |
5239 __ PushHeapObject(literals); | |
5240 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | |
5241 __ Push(constant_properties); | |
5242 __ Push(Smi::FromInt(flags)); | |
5243 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | |
5244 } else { | |
5245 __ LoadHeapObject(rax, literals); | |
5246 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index())); | |
5247 __ Move(rcx, constant_properties); | |
5248 __ Move(rdx, Smi::FromInt(flags)); | |
5249 FastCloneShallowObjectStub stub(properties_count); | |
5250 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
5251 } | |
5252 } | |
5253 | |
5254 | |
5255 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 5215 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
5256 ASSERT(ToRegister(instr->value()).is(rax)); | 5216 ASSERT(ToRegister(instr->value()).is(rax)); |
5257 __ push(rax); | 5217 __ push(rax); |
5258 CallRuntime(Runtime::kToFastProperties, 1, instr); | 5218 CallRuntime(Runtime::kToFastProperties, 1, instr); |
5259 } | 5219 } |
5260 | 5220 |
5261 | 5221 |
5262 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | 5222 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
5263 Label materialized; | 5223 Label materialized; |
5264 // Registers will be used as follows: | 5224 // Registers will be used as follows: |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5697 FixedArray::kHeaderSize - kPointerSize)); | 5657 FixedArray::kHeaderSize - kPointerSize)); |
5698 __ bind(&done); | 5658 __ bind(&done); |
5699 } | 5659 } |
5700 | 5660 |
5701 | 5661 |
5702 #undef __ | 5662 #undef __ |
5703 | 5663 |
5704 } } // namespace v8::internal | 5664 } } // namespace v8::internal |
5705 | 5665 |
5706 #endif // V8_TARGET_ARCH_X64 | 5666 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |