OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2549 } |
2550 if (NeedsEagerFrame()) { | 2550 if (NeedsEagerFrame()) { |
2551 __ movq(rsp, rbp); | 2551 __ movq(rsp, rbp); |
2552 __ pop(rbp); | 2552 __ pop(rbp); |
2553 } | 2553 } |
2554 if (instr->has_constant_parameter_count()) { | 2554 if (instr->has_constant_parameter_count()) { |
2555 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, | 2555 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, |
2556 rcx); | 2556 rcx); |
2557 } else { | 2557 } else { |
2558 Register reg = ToRegister(instr->parameter_count()); | 2558 Register reg = ToRegister(instr->parameter_count()); |
| 2559 // The argument count parameter is a smi |
| 2560 __ SmiToInteger32(reg, reg); |
2559 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; | 2561 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
2560 __ pop(return_addr_reg); | 2562 __ pop(return_addr_reg); |
2561 __ shl(reg, Immediate(kPointerSizeLog2)); | 2563 __ shl(reg, Immediate(kPointerSizeLog2)); |
2562 __ addq(rsp, reg); | 2564 __ addq(rsp, reg); |
2563 __ jmp(return_addr_reg); | 2565 __ jmp(return_addr_reg); |
2564 } | 2566 } |
2565 } | 2567 } |
2566 | 2568 |
2567 | 2569 |
2568 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2570 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3905 } | 3907 } |
3906 | 3908 |
3907 | 3909 |
3908 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3910 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3909 ASSERT(ToRegister(instr->constructor()).is(rdi)); | 3911 ASSERT(ToRegister(instr->constructor()).is(rdi)); |
3910 ASSERT(ToRegister(instr->result()).is(rax)); | 3912 ASSERT(ToRegister(instr->result()).is(rax)); |
3911 ASSERT(FLAG_optimize_constructed_arrays); | 3913 ASSERT(FLAG_optimize_constructed_arrays); |
3912 | 3914 |
3913 __ Set(rax, instr->arity()); | 3915 __ Set(rax, instr->arity()); |
3914 __ Move(rbx, instr->hydrogen()->property_cell()); | 3916 __ Move(rbx, instr->hydrogen()->property_cell()); |
3915 Handle<Code> array_construct_code = | 3917 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
3916 isolate()->builtins()->ArrayConstructCode(); | 3918 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
3917 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 3919 if (instr->arity() == 0) { |
| 3920 ArrayNoArgumentConstructorStub stub(kind); |
| 3921 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3922 } else if (instr->arity() == 1) { |
| 3923 ArraySingleArgumentConstructorStub stub(kind); |
| 3924 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3925 } else { |
| 3926 ArrayNArgumentsConstructorStub stub(kind); |
| 3927 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3928 } |
3918 } | 3929 } |
3919 | 3930 |
3920 | 3931 |
3921 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3932 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
3922 CallRuntime(instr->function(), instr->arity(), instr); | 3933 CallRuntime(instr->function(), instr->arity(), instr); |
3923 } | 3934 } |
3924 | 3935 |
3925 | 3936 |
3926 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3937 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3927 Register result = ToRegister(instr->result()); | 3938 Register result = ToRegister(instr->result()); |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5687 FixedArray::kHeaderSize - kPointerSize)); | 5698 FixedArray::kHeaderSize - kPointerSize)); |
5688 __ bind(&done); | 5699 __ bind(&done); |
5689 } | 5700 } |
5690 | 5701 |
5691 | 5702 |
5692 #undef __ | 5703 #undef __ |
5693 | 5704 |
5694 } } // namespace v8::internal | 5705 } } // namespace v8::internal |
5695 | 5706 |
5696 #endif // V8_TARGET_ARCH_X64 | 5707 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |