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 4112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4123 | 4123 |
4124 // Check the holder map. | 4124 // Check the holder map. |
4125 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 4125 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
4126 Handle<Map>(current_prototype->map())); | 4126 Handle<Map>(current_prototype->map())); |
4127 DeoptimizeIf(not_equal, instr->environment()); | 4127 DeoptimizeIf(not_equal, instr->environment()); |
4128 } | 4128 } |
4129 | 4129 |
4130 | 4130 |
4131 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4131 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
4132 ASSERT(ToRegister(instr->context()).is(esi)); | 4132 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4133 |
| 4134 Handle<FixedArray> constant_elements = instr->hydrogen()->constant_elements(); |
| 4135 ASSERT_EQ(2, constant_elements->length()); |
| 4136 ElementsKind constant_elements_kind = |
| 4137 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 4138 |
4133 // Setup the parameters to the stub/runtime call. | 4139 // Setup the parameters to the stub/runtime call. |
4134 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 4140 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
4135 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset)); | 4141 __ push(FieldOperand(eax, JSFunction::kLiteralsOffset)); |
4136 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 4142 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
4137 __ push(Immediate(instr->hydrogen()->constant_elements())); | 4143 __ push(Immediate(constant_elements)); |
4138 | 4144 |
4139 // Pick the right runtime function or stub to call. | 4145 // Pick the right runtime function or stub to call. |
4140 int length = instr->hydrogen()->length(); | 4146 int length = instr->hydrogen()->length(); |
4141 if (instr->hydrogen()->IsCopyOnWrite()) { | 4147 if (instr->hydrogen()->IsCopyOnWrite()) { |
4142 ASSERT(instr->hydrogen()->depth() == 1); | 4148 ASSERT(instr->hydrogen()->depth() == 1); |
4143 FastCloneShallowArrayStub::Mode mode = | 4149 FastCloneShallowArrayStub::Mode mode = |
4144 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 4150 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
4145 FastCloneShallowArrayStub stub(mode, length); | 4151 FastCloneShallowArrayStub stub(mode, length); |
4146 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4152 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4147 } else if (instr->hydrogen()->depth() > 1) { | 4153 } else if (instr->hydrogen()->depth() > 1) { |
4148 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 4154 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
4149 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 4155 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
4150 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 4156 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
4151 } else { | 4157 } else { |
4152 FastCloneShallowArrayStub::Mode mode = | 4158 FastCloneShallowArrayStub::Mode mode = |
4153 FastCloneShallowArrayStub::CLONE_ELEMENTS; | 4159 constant_elements_kind == FAST_DOUBLE_ELEMENTS |
| 4160 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 4161 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
4154 FastCloneShallowArrayStub stub(mode, length); | 4162 FastCloneShallowArrayStub stub(mode, length); |
4155 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4163 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4156 } | 4164 } |
4157 } | 4165 } |
4158 | 4166 |
4159 | 4167 |
4160 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 4168 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
4161 ASSERT(ToRegister(instr->context()).is(esi)); | 4169 ASSERT(ToRegister(instr->context()).is(esi)); |
4162 // Setup the parameters to the stub/runtime call. | 4170 // Setup the parameters to the stub/runtime call. |
4163 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 4171 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4520 env->deoptimization_index()); | 4528 env->deoptimization_index()); |
4521 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4529 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4522 } | 4530 } |
4523 | 4531 |
4524 | 4532 |
4525 #undef __ | 4533 #undef __ |
4526 | 4534 |
4527 } } // namespace v8::internal | 4535 } } // namespace v8::internal |
4528 | 4536 |
4529 #endif // V8_TARGET_ARCH_IA32 | 4537 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |