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 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 } | 2554 } |
2555 if (NeedsEagerFrame()) { | 2555 if (NeedsEagerFrame()) { |
2556 __ movq(rsp, rbp); | 2556 __ movq(rsp, rbp); |
2557 __ pop(rbp); | 2557 __ pop(rbp); |
2558 } | 2558 } |
2559 if (instr->has_constant_parameter_count()) { | 2559 if (instr->has_constant_parameter_count()) { |
2560 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, | 2560 __ Ret((ToInteger32(instr->constant_parameter_count()) + 1) * kPointerSize, |
2561 rcx); | 2561 rcx); |
2562 } else { | 2562 } else { |
2563 Register reg = ToRegister(instr->parameter_count()); | 2563 Register reg = ToRegister(instr->parameter_count()); |
| 2564 __ SmiToInteger32(reg, reg); |
2564 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; | 2565 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
2565 __ pop(return_addr_reg); | 2566 __ pop(return_addr_reg); |
2566 __ shl(reg, Immediate(kPointerSizeLog2)); | 2567 __ shl(reg, Immediate(kPointerSizeLog2)); |
2567 __ addq(rsp, reg); | 2568 __ addq(rsp, reg); |
2568 __ jmp(return_addr_reg); | 2569 __ jmp(return_addr_reg); |
2569 } | 2570 } |
2570 } | 2571 } |
2571 | 2572 |
2572 | 2573 |
2573 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | 2574 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { |
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 } | 3892 } |
3892 | 3893 |
3893 | 3894 |
3894 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 3895 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
3895 ASSERT(ToRegister(instr->constructor()).is(rdi)); | 3896 ASSERT(ToRegister(instr->constructor()).is(rdi)); |
3896 ASSERT(ToRegister(instr->result()).is(rax)); | 3897 ASSERT(ToRegister(instr->result()).is(rax)); |
3897 ASSERT(FLAG_optimize_constructed_arrays); | 3898 ASSERT(FLAG_optimize_constructed_arrays); |
3898 | 3899 |
3899 __ Set(rax, instr->arity()); | 3900 __ Set(rax, instr->arity()); |
3900 __ Move(rbx, instr->hydrogen()->property_cell()); | 3901 __ Move(rbx, instr->hydrogen()->property_cell()); |
3901 Handle<Code> array_construct_code = | 3902 Object* cell_value = instr->hydrogen()->property_cell()->value(); |
3902 isolate()->builtins()->ArrayConstructCode(); | 3903 ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
3903 CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); | 3904 if (instr->arity() == 0) { |
| 3905 ArrayNoArgumentConstructorStub stub(kind); |
| 3906 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3907 } else if (instr->arity() == 1) { |
| 3908 ArraySingleArgumentConstructorStub stub(kind); |
| 3909 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3910 } else { |
| 3911 ArrayNArgumentsConstructorStub stub(kind); |
| 3912 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 3913 } |
3904 } | 3914 } |
3905 | 3915 |
3906 | 3916 |
3907 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { | 3917 void LCodeGen::DoCallRuntime(LCallRuntime* instr) { |
3908 CallRuntime(instr->function(), instr->arity(), instr); | 3918 CallRuntime(instr->function(), instr->arity(), instr); |
3909 } | 3919 } |
3910 | 3920 |
3911 | 3921 |
3912 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 3922 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
3913 Register result = ToRegister(instr->result()); | 3923 Register result = ToRegister(instr->result()); |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5661 FixedArray::kHeaderSize - kPointerSize)); | 5671 FixedArray::kHeaderSize - kPointerSize)); |
5662 __ bind(&done); | 5672 __ bind(&done); |
5663 } | 5673 } |
5664 | 5674 |
5665 | 5675 |
5666 #undef __ | 5676 #undef __ |
5667 | 5677 |
5668 } } // namespace v8::internal | 5678 } } // namespace v8::internal |
5669 | 5679 |
5670 #endif // V8_TARGET_ARCH_X64 | 5680 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |