OLD | NEW |
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 4309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4320 constant_elements_kind == FAST_DOUBLE_ELEMENTS | 4320 constant_elements_kind == FAST_DOUBLE_ELEMENTS |
4321 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 4321 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
4322 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 4322 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
4323 FastCloneShallowArrayStub stub(mode, length); | 4323 FastCloneShallowArrayStub stub(mode, length); |
4324 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4324 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4325 } | 4325 } |
4326 } | 4326 } |
4327 | 4327 |
4328 | 4328 |
4329 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 4329 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 4330 Handle<FixedArray> constant_properties = |
| 4331 instr->hydrogen()->constant_properties(); |
| 4332 |
4330 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4333 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
4331 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); | 4334 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); |
4332 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4335 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
4333 __ mov(r2, Operand(instr->hydrogen()->constant_properties())); | 4336 __ mov(r2, Operand(constant_properties)); |
4334 __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0))); | 4337 int flags = instr->hydrogen()->fast_elements() |
| 4338 ? ObjectLiteral::kFastElements |
| 4339 : ObjectLiteral::kNoFlags; |
| 4340 __ mov(r1, Operand(Smi::FromInt(flags))); |
4335 __ Push(r4, r3, r2, r1); | 4341 __ Push(r4, r3, r2, r1); |
4336 | 4342 |
4337 // Pick the right runtime function to call. | 4343 // Pick the right runtime function to call. |
| 4344 int properties_count = constant_properties->length() / 2; |
4338 if (instr->hydrogen()->depth() > 1) { | 4345 if (instr->hydrogen()->depth() > 1) { |
4339 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 4346 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 4347 } else if (flags != ObjectLiteral::kFastElements || |
| 4348 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 4349 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
4340 } else { | 4350 } else { |
4341 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 4351 FastCloneShallowObjectStub stub(properties_count); |
| 4352 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4342 } | 4353 } |
4343 } | 4354 } |
4344 | 4355 |
4345 | 4356 |
4346 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 4357 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
4347 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); | 4358 ASSERT(ToRegister(instr->InputAt(0)).is(r0)); |
4348 __ push(r0); | 4359 __ push(r0); |
4349 CallRuntime(Runtime::kToFastProperties, 1, instr); | 4360 CallRuntime(Runtime::kToFastProperties, 1, instr); |
4350 } | 4361 } |
4351 | 4362 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 ASSERT(osr_pc_offset_ == -1); | 4693 ASSERT(osr_pc_offset_ == -1); |
4683 osr_pc_offset_ = masm()->pc_offset(); | 4694 osr_pc_offset_ = masm()->pc_offset(); |
4684 } | 4695 } |
4685 | 4696 |
4686 | 4697 |
4687 | 4698 |
4688 | 4699 |
4689 #undef __ | 4700 #undef __ |
4690 | 4701 |
4691 } } // namespace v8::internal | 4702 } } // namespace v8::internal |
OLD | NEW |