OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2770 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2770 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
2771 if (dynamic_frame_alignment && FLAG_debug_code) { | 2771 if (dynamic_frame_alignment && FLAG_debug_code) { |
2772 __ cmp(Operand(esp, | 2772 __ cmp(Operand(esp, |
2773 (parameter_count + extra_value_count) * kPointerSize), | 2773 (parameter_count + extra_value_count) * kPointerSize), |
2774 Immediate(kAlignmentZapValue)); | 2774 Immediate(kAlignmentZapValue)); |
2775 __ Assert(equal, "expected alignment marker"); | 2775 __ Assert(equal, "expected alignment marker"); |
2776 } | 2776 } |
2777 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); | 2777 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); |
2778 } else { | 2778 } else { |
2779 Register reg = ToRegister(instr->parameter_count()); | 2779 Register reg = ToRegister(instr->parameter_count()); |
| 2780 // The argument count parameter is a smi |
| 2781 __ SmiUntag(reg); |
2780 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; | 2782 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; |
2781 if (dynamic_frame_alignment && FLAG_debug_code) { | 2783 if (dynamic_frame_alignment && FLAG_debug_code) { |
2782 ASSERT(extra_value_count == 2); | 2784 ASSERT(extra_value_count == 2); |
2783 __ cmp(Operand(esp, reg, times_pointer_size, | 2785 __ cmp(Operand(esp, reg, times_pointer_size, |
2784 extra_value_count * kPointerSize), | 2786 extra_value_count * kPointerSize), |
2785 Immediate(kAlignmentZapValue)); | 2787 Immediate(kAlignmentZapValue)); |
2786 __ Assert(equal, "expected alignment marker"); | 2788 __ Assert(equal, "expected alignment marker"); |
2787 } | 2789 } |
2788 | 2790 |
2789 // emit code to restore stack based on instr->parameter_count() | 2791 // emit code to restore stack based on instr->parameter_count() |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4204 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
4203 } | 4205 } |
4204 | 4206 |
4205 | 4207 |
4206 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4208 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4207 ASSERT(ToRegister(instr->context()).is(esi)); | 4209 ASSERT(ToRegister(instr->context()).is(esi)); |
4208 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4210 ASSERT(ToRegister(instr->constructor()).is(edi)); |
4209 ASSERT(ToRegister(instr->result()).is(eax)); | 4211 ASSERT(ToRegister(instr->result()).is(eax)); |
4210 ASSERT(FLAG_optimize_constructed_arrays); | 4212 ASSERT(FLAG_optimize_constructed_arrays); |
4211 | 4213 |
| 4214 __ Set(eax, Immediate(instr->arity())); |
4212 __ mov(ebx, instr->hydrogen()->property_cell()); | 4215 __ mov(ebx, instr->hydrogen()->property_cell()); |
4213 Handle<Code> array_construct_code = | 4216 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
4214 isolate()->builtins()->ArrayConstructCode(); | 4217 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
4215 __ Set(eax, Immediate(instr->arity())); | 4218 if (instr->arity() == 0) { |
4216 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 4219 ArrayNoArgumentConstructorStub stub(kind); |
| 4220 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4221 } else if (instr->arity() == 1) { |
| 4222 ArraySingleArgumentConstructorStub stub(kind); |
| 4223 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4224 } else { |
| 4225 ArrayNArgumentsConstructorStub stub(kind); |
| 4226 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4227 } |
4217 } | 4228 } |
4218 | 4229 |
4219 | 4230 |
4220 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4231 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
4221 CallRuntime(instr->function(), instr->arity(), instr); | 4232 CallRuntime(instr->function(), instr->arity(), instr); |
4222 } | 4233 } |
4223 | 4234 |
4224 | 4235 |
4225 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4236 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
4226 Register result = ToRegister(instr->result()); | 4237 Register result = ToRegister(instr->result()); |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6572 FixedArray::kHeaderSize - kPointerSize)); | 6583 FixedArray::kHeaderSize - kPointerSize)); |
6573 __ bind(&done); | 6584 __ bind(&done); |
6574 } | 6585 } |
6575 | 6586 |
6576 | 6587 |
6577 #undef __ | 6588 #undef __ |
6578 | 6589 |
6579 } } // namespace v8::internal | 6590 } } // namespace v8::internal |
6580 | 6591 |
6581 #endif // V8_TARGET_ARCH_IA32 | 6592 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |