| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3466 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { | 3466 void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) { |
| 3467 ASSERT(args->length() == 0); | 3467 ASSERT(args->length() == 0); |
| 3468 | 3468 |
| 3469 // Get the frame pointer for the calling frame. | 3469 // Get the frame pointer for the calling frame. |
| 3470 Result fp = allocator()->Allocate(); | 3470 Result fp = allocator()->Allocate(); |
| 3471 __ movq(fp.reg(), Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 3471 __ movq(fp.reg(), Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 3472 | 3472 |
| 3473 // Skip the arguments adaptor frame if it exists. | 3473 // Skip the arguments adaptor frame if it exists. |
| 3474 Label check_frame_marker; | 3474 Label check_frame_marker; |
| 3475 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset), | 3475 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset), |
| 3476 Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 3476 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 3477 __ j(not_equal, &check_frame_marker); | 3477 __ j(not_equal, &check_frame_marker); |
| 3478 __ movq(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset)); | 3478 __ movq(fp.reg(), Operand(fp.reg(), StandardFrameConstants::kCallerFPOffset)); |
| 3479 | 3479 |
| 3480 // Check the marker in the calling frame. | 3480 // Check the marker in the calling frame. |
| 3481 __ bind(&check_frame_marker); | 3481 __ bind(&check_frame_marker); |
| 3482 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset), | 3482 __ cmpq(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset), |
| 3483 Immediate(Smi::FromInt(StackFrame::CONSTRUCT))); | 3483 Immediate(Smi::FromInt(StackFrame::CONSTRUCT))); |
| 3484 fp.Unuse(); | 3484 fp.Unuse(); |
| 3485 destination()->Split(equal); | 3485 destination()->Split(equal); |
| 3486 } | 3486 } |
| (...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6611 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { | 6611 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { |
| 6612 // The displacement is used for skipping the return address and the | 6612 // The displacement is used for skipping the return address and the |
| 6613 // frame pointer on the stack. It is the offset of the last | 6613 // frame pointer on the stack. It is the offset of the last |
| 6614 // parameter (if any) relative to the frame pointer. | 6614 // parameter (if any) relative to the frame pointer. |
| 6615 static const int kDisplacement = 2 * kPointerSize; | 6615 static const int kDisplacement = 2 * kPointerSize; |
| 6616 | 6616 |
| 6617 // Check if the calling frame is an arguments adaptor frame. | 6617 // Check if the calling frame is an arguments adaptor frame. |
| 6618 Label runtime; | 6618 Label runtime; |
| 6619 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 6619 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 6620 __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 6620 __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
| 6621 __ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 6621 __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 6622 __ j(not_equal, &runtime); | 6622 __ j(not_equal, &runtime); |
| 6623 // Value in rcx is Smi encoded. | 6623 // Value in rcx is Smi encoded. |
| 6624 | 6624 |
| 6625 // Patch the arguments.length and the parameters pointer. | 6625 // Patch the arguments.length and the parameters pointer. |
| 6626 __ movq(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 6626 __ movq(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 6627 __ movq(Operand(rsp, 1 * kPointerSize), rcx); | 6627 __ movq(Operand(rsp, 1 * kPointerSize), rcx); |
| 6628 __ lea(rdx, Operand(rdx, rcx, times_4, kDisplacement)); | 6628 __ lea(rdx, Operand(rdx, rcx, times_4, kDisplacement)); |
| 6629 __ movq(Operand(rsp, 2 * kPointerSize), rdx); | 6629 __ movq(Operand(rsp, 2 * kPointerSize), rdx); |
| 6630 | 6630 |
| 6631 // Do the runtime call to allocate the arguments object. | 6631 // Do the runtime call to allocate the arguments object. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6644 | 6644 |
| 6645 // Check that the key is a smi. | 6645 // Check that the key is a smi. |
| 6646 Label slow; | 6646 Label slow; |
| 6647 __ testl(rdx, Immediate(kSmiTagMask)); | 6647 __ testl(rdx, Immediate(kSmiTagMask)); |
| 6648 __ j(not_zero, &slow); | 6648 __ j(not_zero, &slow); |
| 6649 | 6649 |
| 6650 // Check if the calling frame is an arguments adaptor frame. | 6650 // Check if the calling frame is an arguments adaptor frame. |
| 6651 Label adaptor; | 6651 Label adaptor; |
| 6652 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 6652 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 6653 __ movq(rcx, Operand(rbx, StandardFrameConstants::kContextOffset)); | 6653 __ movq(rcx, Operand(rbx, StandardFrameConstants::kContextOffset)); |
| 6654 __ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 6654 __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 6655 __ j(equal, &adaptor); | 6655 __ j(equal, &adaptor); |
| 6656 | 6656 |
| 6657 // Check index against formal parameters count limit passed in | 6657 // Check index against formal parameters count limit passed in |
| 6658 // through register rax. Use unsigned comparison to get negative | 6658 // through register rax. Use unsigned comparison to get negative |
| 6659 // check for free. | 6659 // check for free. |
| 6660 __ cmpq(rdx, rax); | 6660 __ cmpq(rdx, rax); |
| 6661 __ j(above_equal, &slow); | 6661 __ j(above_equal, &slow); |
| 6662 | 6662 |
| 6663 // Read the argument from the stack and return it. | 6663 // Read the argument from the stack and return it. |
| 6664 // Shifting code depends on SmiEncoding being equivalent to left shift: | 6664 // Shifting code depends on SmiEncoding being equivalent to left shift: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6694 __ push(rbx); | 6694 __ push(rbx); |
| 6695 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1); | 6695 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1); |
| 6696 } | 6696 } |
| 6697 | 6697 |
| 6698 | 6698 |
| 6699 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { | 6699 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { |
| 6700 // Check if the calling frame is an arguments adaptor frame. | 6700 // Check if the calling frame is an arguments adaptor frame. |
| 6701 Label adaptor; | 6701 Label adaptor; |
| 6702 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 6702 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 6703 __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 6703 __ movq(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
| 6704 __ cmpq(rcx, Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 6704 __ cmpq(rcx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 6705 __ j(equal, &adaptor); | 6705 __ j(equal, &adaptor); |
| 6706 | 6706 |
| 6707 // Nothing to do: The formal number of parameters has already been | 6707 // Nothing to do: The formal number of parameters has already been |
| 6708 // passed in register rax by calling function. Just return it. | 6708 // passed in register rax by calling function. Just return it. |
| 6709 __ ret(0); | 6709 __ ret(0); |
| 6710 | 6710 |
| 6711 // Arguments adaptor case: Read the arguments length from the | 6711 // Arguments adaptor case: Read the arguments length from the |
| 6712 // adaptor frame and return it. | 6712 // adaptor frame and return it. |
| 6713 __ bind(&adaptor); | 6713 __ bind(&adaptor); |
| 6714 __ movq(rax, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 6714 __ movq(rax, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7008 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 7008 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 7009 Label invoke, exit; | 7009 Label invoke, exit; |
| 7010 #ifdef ENABLE_LOGGING_AND_PROFILING | 7010 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 7011 Label not_outermost_js, not_outermost_js_2; | 7011 Label not_outermost_js, not_outermost_js_2; |
| 7012 #endif | 7012 #endif |
| 7013 | 7013 |
| 7014 // Setup frame. | 7014 // Setup frame. |
| 7015 __ push(rbp); | 7015 __ push(rbp); |
| 7016 __ movq(rbp, rsp); | 7016 __ movq(rbp, rsp); |
| 7017 | 7017 |
| 7018 // Push the stack frame type marker twice. |
| 7019 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
| 7020 __ push(Immediate(Smi::FromInt(marker))); // context slot |
| 7021 __ push(Immediate(Smi::FromInt(marker))); // function slot |
| 7018 // Save callee-saved registers (X64 calling conventions). | 7022 // Save callee-saved registers (X64 calling conventions). |
| 7019 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | |
| 7020 // Push something that is not an arguments adaptor. | |
| 7021 __ push(Immediate(ArgumentsAdaptorFrame::NON_SENTINEL)); | |
| 7022 __ push(Immediate(Smi::FromInt(marker))); // @ function offset | |
| 7023 __ push(r12); | 7023 __ push(r12); |
| 7024 __ push(r13); | 7024 __ push(r13); |
| 7025 __ push(r14); | 7025 __ push(r14); |
| 7026 __ push(r15); | 7026 __ push(r15); |
| 7027 __ push(rdi); | 7027 __ push(rdi); |
| 7028 __ push(rsi); | 7028 __ push(rsi); |
| 7029 __ push(rbx); | 7029 __ push(rbx); |
| 7030 // TODO(X64): Push XMM6-XMM15 (low 64 bits) as well, or make them | 7030 // TODO(X64): Push XMM6-XMM15 (low 64 bits) as well, or make them |
| 7031 // callee-save in JS code as well. | 7031 // callee-save in JS code as well. |
| 7032 | 7032 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7701 int CompareStub::MinorKey() { | 7701 int CompareStub::MinorKey() { |
| 7702 // Encode the two parameters in a unique 16 bit value. | 7702 // Encode the two parameters in a unique 16 bit value. |
| 7703 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 7703 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
| 7704 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 7704 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
| 7705 } | 7705 } |
| 7706 | 7706 |
| 7707 | 7707 |
| 7708 #undef __ | 7708 #undef __ |
| 7709 | 7709 |
| 7710 } } // namespace v8::internal | 7710 } } // namespace v8::internal |
| OLD | NEW |