| 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 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2766 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2766 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
| 2767 if (dynamic_frame_alignment && FLAG_debug_code) { | 2767 if (dynamic_frame_alignment && FLAG_debug_code) { |
| 2768 __ cmp(Operand(esp, | 2768 __ cmp(Operand(esp, |
| 2769 (parameter_count + extra_value_count) * kPointerSize), | 2769 (parameter_count + extra_value_count) * kPointerSize), |
| 2770 Immediate(kAlignmentZapValue)); | 2770 Immediate(kAlignmentZapValue)); |
| 2771 __ Assert(equal, "expected alignment marker"); | 2771 __ Assert(equal, "expected alignment marker"); |
| 2772 } | 2772 } |
| 2773 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); | 2773 __ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); |
| 2774 } else { | 2774 } else { |
| 2775 Register reg = ToRegister(instr->parameter_count()); | 2775 Register reg = ToRegister(instr->parameter_count()); |
| 2776 __ SmiUntag(reg); // it is a smi |
| 2776 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; | 2777 Register return_addr_reg = reg.is(ecx) ? ebx : ecx; |
| 2777 if (dynamic_frame_alignment && FLAG_debug_code) { | 2778 if (dynamic_frame_alignment && FLAG_debug_code) { |
| 2778 ASSERT(extra_value_count == 2); | 2779 ASSERT(extra_value_count == 2); |
| 2779 __ cmp(Operand(esp, reg, times_pointer_size, | 2780 __ cmp(Operand(esp, reg, times_pointer_size, |
| 2780 extra_value_count * kPointerSize), | 2781 extra_value_count * kPointerSize), |
| 2781 Immediate(kAlignmentZapValue)); | 2782 Immediate(kAlignmentZapValue)); |
| 2782 __ Assert(equal, "expected alignment marker"); | 2783 __ Assert(equal, "expected alignment marker"); |
| 2783 } | 2784 } |
| 2784 | 2785 |
| 2785 // emit code to restore stack based on instr->parameter_count() | 2786 // emit code to restore stack based on instr->parameter_count() |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4188 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4189 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4189 } | 4190 } |
| 4190 | 4191 |
| 4191 | 4192 |
| 4192 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4193 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
| 4193 ASSERT(ToRegister(instr->context()).is(esi)); | 4194 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4194 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4195 ASSERT(ToRegister(instr->constructor()).is(edi)); |
| 4195 ASSERT(ToRegister(instr->result()).is(eax)); | 4196 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4196 ASSERT(FLAG_optimize_constructed_arrays); | 4197 ASSERT(FLAG_optimize_constructed_arrays); |
| 4197 | 4198 |
| 4199 __ Set(eax, Immediate(instr->arity())); |
| 4198 __ mov(ebx, instr->hydrogen()->property_cell()); | 4200 __ mov(ebx, instr->hydrogen()->property_cell()); |
| 4199 Handle<Code> array_construct_code = | 4201 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
| 4200 isolate()->builtins()->ArrayConstructCode(); | 4202 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
| 4201 __ Set(eax, Immediate(instr->arity())); | 4203 if (instr->arity() == 0) { |
| 4202 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 4204 ArrayNoArgumentConstructorStub stub(kind); |
| 4205 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4206 } else if (instr->arity() == 1) { |
| 4207 ArraySingleArgumentConstructorStub stub(kind); |
| 4208 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4209 } else { |
| 4210 ArrayNArgumentsConstructorStub stub(kind); |
| 4211 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4212 } |
| 4203 } | 4213 } |
| 4204 | 4214 |
| 4205 | 4215 |
| 4206 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 4216 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
| 4207 CallRuntime(instr->function(), instr->arity(), instr); | 4217 CallRuntime(instr->function(), instr->arity(), instr); |
| 4208 } | 4218 } |
| 4209 | 4219 |
| 4210 | 4220 |
| 4211 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4221 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
| 4212 Register result = ToRegister(instr->result()); | 4222 Register result = ToRegister(instr->result()); |
| (...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6565 FixedArray::kHeaderSize - kPointerSize)); | 6575 FixedArray::kHeaderSize - kPointerSize)); |
| 6566 __ bind(&done); | 6576 __ bind(&done); |
| 6567 } | 6577 } |
| 6568 | 6578 |
| 6569 | 6579 |
| 6570 #undef __ | 6580 #undef __ |
| 6571 | 6581 |
| 6572 } } // namespace v8::internal | 6582 } } // namespace v8::internal |
| 6573 | 6583 |
| 6574 #endif // V8_TARGET_ARCH_IA32 | 6584 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |