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 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2779 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
2780 if (dynamic_frame_alignment && FLAG_debug_code) { | 2780 if (dynamic_frame_alignment && FLAG_debug_code) { |
2781 __ cmp(Operand(esp, | 2781 __ cmp(Operand(esp, |
2782 (parameter_count + extra_value_count) * kPointerSize), | 2782 (parameter_count + extra_value_count) * kPointerSize), |
2783 Immediate(kAlignmentZapValue)); | 2783 Immediate(kAlignmentZapValue)); |
2784 __ Assert(equal, "expected alignment marker"); | 2784 __ Assert(equal, "expected alignment marker"); |
2785 } | 2785 } |
2786 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); | 2786 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); |
2787 } else { | 2787 } else { |
2788 Register reg = ToRegister(instr->parameter_count()); | 2788 Register reg = ToRegister(instr->parameter_count()); |
| 2789 __ SmiUntag(reg); // it is a smi |
2789 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; | 2790 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; |
2790 if (dynamic_frame_alignment && FLAG_debug_code) { | 2791 if (dynamic_frame_alignment && FLAG_debug_code) { |
2791 ASSERT(extra_value_count == 2); | 2792 ASSERT(extra_value_count == 2); |
2792 __ cmp(Operand(esp, reg, times_pointer_size, | 2793 __ cmp(Operand(esp, reg, times_pointer_size, |
2793 extra_value_count * kPointerSize), | 2794 extra_value_count * kPointerSize), |
2794 Immediate(kAlignmentZapValue)); | 2795 Immediate(kAlignmentZapValue)); |
2795 __ Assert(equal, "expected alignment marker"); | 2796 __ Assert(equal, "expected alignment marker"); |
2796 } | 2797 } |
2797 | 2798 |
2798 // emit code to restore stack based on instr->parameter_count() | 2799 // emit code to restore stack based on instr->parameter_count() |
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4193 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4194 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
4194 } | 4195 } |
4195 | 4196 |
4196 | 4197 |
4197 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4198 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
4198 ASSERT(ToRegister(instr->context()).is(esi)); | 4199 ASSERT(ToRegister(instr->context()).is(esi)); |
4199 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4200 ASSERT(ToRegister(instr->constructor()).is(edi)); |
4200 ASSERT(ToRegister(instr->result()).is(eax)); | 4201 ASSERT(ToRegister(instr->result()).is(eax)); |
4201 ASSERT(FLAG_optimize_constructed_arrays); | 4202 ASSERT(FLAG_optimize_constructed_arrays); |
4202 | 4203 |
| 4204 __ Set(eax, Immediate(instr->arity())); |
4203 __ mov(ebx, instr->hydrogen()->property_cell()); | 4205 __ mov(ebx, instr->hydrogen()->property_cell()); |
4204 Handle<Code> array_construct_code = | 4206 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
4205 isolate()->builtins()->ArrayConstructCode(); | 4207 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
4206 __ Set(eax, Immediate(instr->arity())); | 4208 if (instr->arity() == 0) { |
4207 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 4209 ArrayNoArgumentConstructorStub stub(kind); |
| 4210 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4211 } else if (instr->arity() == 1) { |
| 4212 ArraySingleArgumentConstructorStub stub(kind); |
| 4213 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4214 } else { |
| 4215 ArrayNArgumentsConstructorStub stub(kind); |
| 4216 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4217 } |
4208 } | 4218 } |
4209 | 4219 |
4210 | 4220 |
4211 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4221 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
4212 CallRuntime(instr->function(), instr->arity(), instr); | 4222 CallRuntime(instr->function(), instr->arity(), instr); |
4213 } | 4223 } |
4214 | 4224 |
4215 | 4225 |
4216 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4226 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
4217 Register result = ToRegister(instr->result()); | 4227 Register result = ToRegister(instr->result()); |
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6551 FixedArray::kHeaderSize - kPointerSize)); | 6561 FixedArray::kHeaderSize - kPointerSize)); |
6552 __ bind(&done); | 6562 __ bind(&done); |
6553 } | 6563 } |
6554 | 6564 |
6555 | 6565 |
6556 #undef __ | 6566 #undef __ |
6557 | 6567 |
6558 } } // namespace v8::internal | 6568 } } // namespace v8::internal |
6559 | 6569 |
6560 #endif // V8_TARGET_ARCH_IA32 | 6570 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |