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 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4228 } | 4228 } |
4229 | 4229 |
4230 // Check the holder map. | 4230 // Check the holder map. |
4231 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); | 4231 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); |
4232 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); | 4232 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); |
4233 DeoptimizeIf(ne, instr->environment()); | 4233 DeoptimizeIf(ne, instr->environment()); |
4234 } | 4234 } |
4235 | 4235 |
4236 | 4236 |
4237 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4237 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| 4238 Handle<FixedArray> constant_elements = instr->hydrogen()->constant_elements(); |
| 4239 ASSERT_EQ(2, constant_elements->length()); |
| 4240 ElementsKind constant_elements_kind = |
| 4241 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 4242 |
4238 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4243 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
4239 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 4244 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
4240 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4245 __ mov(r2, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
4241 __ mov(r1, Operand(instr->hydrogen()->constant_elements())); | 4246 __ mov(r1, Operand(constant_elements)); |
4242 __ Push(r3, r2, r1); | 4247 __ Push(r3, r2, r1); |
4243 | 4248 |
4244 // Pick the right runtime function or stub to call. | 4249 // Pick the right runtime function or stub to call. |
4245 int length = instr->hydrogen()->length(); | 4250 int length = instr->hydrogen()->length(); |
4246 if (instr->hydrogen()->IsCopyOnWrite()) { | 4251 if (instr->hydrogen()->IsCopyOnWrite()) { |
4247 ASSERT(instr->hydrogen()->depth() == 1); | 4252 ASSERT(instr->hydrogen()->depth() == 1); |
4248 FastCloneShallowArrayStub::Mode mode = | 4253 FastCloneShallowArrayStub::Mode mode = |
4249 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 4254 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
4250 FastCloneShallowArrayStub stub(mode, length); | 4255 FastCloneShallowArrayStub stub(mode, length); |
4251 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4256 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4252 } else if (instr->hydrogen()->depth() > 1) { | 4257 } else if (instr->hydrogen()->depth() > 1) { |
4253 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 4258 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
4254 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 4259 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
4255 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 4260 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
4256 } else { | 4261 } else { |
4257 FastCloneShallowArrayStub::Mode mode = | 4262 FastCloneShallowArrayStub::Mode mode = |
4258 FastCloneShallowArrayStub::CLONE_ELEMENTS; | 4263 constant_elements_kind == FAST_DOUBLE_ELEMENTS |
| 4264 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 4265 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
4259 FastCloneShallowArrayStub stub(mode, length); | 4266 FastCloneShallowArrayStub stub(mode, length); |
4260 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4267 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4261 } | 4268 } |
4262 } | 4269 } |
4263 | 4270 |
4264 | 4271 |
4265 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 4272 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
4266 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4273 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
4267 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); | 4274 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); |
4268 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4275 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4597 ASSERT(osr_pc_offset_ == -1); | 4604 ASSERT(osr_pc_offset_ == -1); |
4598 osr_pc_offset_ = masm()->pc_offset(); | 4605 osr_pc_offset_ = masm()->pc_offset(); |
4599 } | 4606 } |
4600 | 4607 |
4601 | 4608 |
4602 | 4609 |
4603 | 4610 |
4604 #undef __ | 4611 #undef __ |
4605 | 4612 |
4606 } } // namespace v8::internal | 4613 } } // namespace v8::internal |
OLD | NEW |