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 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4234 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 4234 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
4235 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 4235 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
4236 FastCloneShallowArrayStub stub(mode, length); | 4236 FastCloneShallowArrayStub stub(mode, length); |
4237 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4237 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4238 } | 4238 } |
4239 } | 4239 } |
4240 | 4240 |
4241 | 4241 |
4242 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 4242 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
4243 ASSERT(ToRegister(instr->result()).is(v0)); | 4243 ASSERT(ToRegister(instr->result()).is(v0)); |
| 4244 |
| 4245 Handle<FixedArray> constant_properties = |
| 4246 instr->hydrogen()->constant_properties(); |
| 4247 |
4244 __ lw(t0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4248 __ lw(t0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
4245 __ lw(t0, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); | 4249 __ lw(t0, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); |
4246 __ li(a3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4250 __ li(a3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
4247 __ li(a2, Operand(instr->hydrogen()->constant_properties())); | 4251 __ li(a2, Operand(constant_properties)); |
4248 __ li(a1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0))); | 4252 int flags = instr->hydrogen()->fast_elements() |
| 4253 ? ObjectLiteral::kFastElements |
| 4254 : ObjectLiteral::kNoFlags; |
| 4255 __ li(a1, Operand(Smi::FromInt(flags))); |
4249 __ Push(t0, a3, a2, a1); | 4256 __ Push(t0, a3, a2, a1); |
4250 | 4257 |
4251 // Pick the right runtime function to call. | 4258 // Pick the right runtime function to call. |
| 4259 int properties_count = constant_properties->length() / 2; |
4252 if (instr->hydrogen()->depth() > 1) { | 4260 if (instr->hydrogen()->depth() > 1) { |
4253 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 4261 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 4262 } else if (flags != ObjectLiteral::kFastElements || |
| 4263 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 4264 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
4254 } else { | 4265 } else { |
4255 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 4266 FastCloneShallowObjectStub stub(properties_count); |
| 4267 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4256 } | 4268 } |
4257 } | 4269 } |
4258 | 4270 |
4259 | 4271 |
4260 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 4272 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
4261 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); | 4273 ASSERT(ToRegister(instr->InputAt(0)).is(a0)); |
4262 ASSERT(ToRegister(instr->result()).is(v0)); | 4274 ASSERT(ToRegister(instr->result()).is(v0)); |
4263 __ push(a0); | 4275 __ push(a0); |
4264 CallRuntime(Runtime::kToFastProperties, 1, instr); | 4276 CallRuntime(Runtime::kToFastProperties, 1, instr); |
4265 } | 4277 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4631 ASSERT(!environment->HasBeenRegistered()); | 4643 ASSERT(!environment->HasBeenRegistered()); |
4632 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4644 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4633 ASSERT(osr_pc_offset_ == -1); | 4645 ASSERT(osr_pc_offset_ == -1); |
4634 osr_pc_offset_ = masm()->pc_offset(); | 4646 osr_pc_offset_ = masm()->pc_offset(); |
4635 } | 4647 } |
4636 | 4648 |
4637 | 4649 |
4638 #undef __ | 4650 #undef __ |
4639 | 4651 |
4640 } } // namespace v8::internal | 4652 } } // namespace v8::internal |
OLD | NEW |