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 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 } | 2545 } |
2546 if (NeedsEagerFrame()) { | 2546 if (NeedsEagerFrame()) { |
2547 __ movq(rsp, rbp); | 2547 __ movq(rsp, rbp); |
2548 __ pop(rbp); | 2548 __ pop(rbp); |
2549 } | 2549 } |
2550 if (instr->has_constant_parameter_count()) { | 2550 if (instr->has_constant_parameter_count()) { |
2551 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, | 2551 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, |
2552 rcx); | 2552 rcx); |
2553 } else { | 2553 } else { |
2554 Register reg = ToRegister(instr->parameter_count()); | 2554 Register reg = ToRegister(instr->parameter_count()); |
| 2555 __ SmiToInteger32(reg, reg); |
2555 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; | 2556 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
2556 __ pop(return_addr_reg); | 2557 __ pop(return_addr_reg); |
2557 __ shl(reg, Immediate(kPointerSizeLog2)); | 2558 __ shl(reg, Immediate(kPointerSizeLog2)); |
2558 __ addq(rsp, reg); | 2559 __ addq(rsp, reg); |
2559 __ jmp(return_addr_reg); | 2560 __ jmp(return_addr_reg); |
2560 } | 2561 } |
2561 } | 2562 } |
2562 | 2563 |
2563 | 2564 |
2564 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2565 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 } | 3893 } |
3893 | 3894 |
3894 | 3895 |
3895 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3896 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3896 ASSERT(ToRegister(instr->constructor()).is(rdi)); | 3897 ASSERT(ToRegister(instr->constructor()).is(rdi)); |
3897 ASSERT(ToRegister(instr->result()).is(rax)); | 3898 ASSERT(ToRegister(instr->result()).is(rax)); |
3898 ASSERT(FLAG_optimize_constructed_arrays); | 3899 ASSERT(FLAG_optimize_constructed_arrays); |
3899 | 3900 |
3900 __ Set(rax, instr->arity()); | 3901 __ Set(rax, instr->arity()); |
3901 __ Move(rbx, instr->hydrogen()->property_cell()); | 3902 __ Move(rbx, instr->hydrogen()->property_cell()); |
3902 Handle<Code> array_construct_code = | 3903 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
3903 isolate()->builtins()->ArrayConstructCode(); | 3904 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
3904 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 3905 if (instr->arity() == 0) { |
| 3906 ArrayNoArgumentConstructorStub stub(kind); |
| 3907 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3908 } else if (instr->arity() == 1) { |
| 3909 ArraySingleArgumentConstructorStub stub(kind); |
| 3910 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3911 } else { |
| 3912 ArrayNArgumentsConstructorStub stub(kind); |
| 3913 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3914 } |
3905 } | 3915 } |
3906 | 3916 |
3907 | 3917 |
3908 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3918 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
3909 CallRuntime(instr->function(), instr->arity(), instr); | 3919 CallRuntime(instr->function(), instr->arity(), instr); |
3910 } | 3920 } |
3911 | 3921 |
3912 | 3922 |
3913 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3923 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3914 Register result = ToRegister(instr->result()); | 3924 Register result = ToRegister(instr->result()); |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5679 FixedArray::kHeaderSize - kPointerSize)); | 5689 FixedArray::kHeaderSize - kPointerSize)); |
5680 __ bind(&done); | 5690 __ bind(&done); |
5681 } | 5691 } |
5682 | 5692 |
5683 | 5693 |
5684 #undef __ | 5694 #undef __ |
5685 | 5695 |
5686 } } // namespace v8::internal | 5696 } } // namespace v8::internal |
5687 | 5697 |
5688 #endif // V8_TARGET_ARCH_X64 | 5698 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |