| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 #endif | 145 #endif |
| 146 | 146 |
| 147 // Strict mode functions need to replace the receiver with undefined | 147 // Strict mode functions need to replace the receiver with undefined |
| 148 // when called as functions (without an explicit receiver | 148 // when called as functions (without an explicit receiver |
| 149 // object). rcx is zero for method calls and non-zero for function | 149 // object). rcx is zero for method calls and non-zero for function |
| 150 // calls. | 150 // calls. |
| 151 if (!info_->is_classic_mode() || info_->is_native()) { | 151 if (!info_->is_classic_mode() || info_->is_native()) { |
| 152 Label ok; | 152 Label ok; |
| 153 __ testq(rcx, rcx); | 153 __ testq(rcx, rcx); |
| 154 __ j(zero, &ok, Label::kNear); | 154 __ j(zero, &ok, Label::kNear); |
| 155 // +1 for return address. | 155 StackArgumentsAccessor args(rsp, scope()->num_parameters()); |
| 156 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | |
| 157 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 156 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 158 __ movq(Operand(rsp, receiver_offset), kScratchRegister); | 157 __ movq(args.GetReceiverOperand(), kScratchRegister); |
| 159 __ bind(&ok); | 158 __ bind(&ok); |
| 160 } | 159 } |
| 161 } | 160 } |
| 162 | 161 |
| 163 info()->set_prologue_offset(masm_->pc_offset()); | 162 info()->set_prologue_offset(masm_->pc_offset()); |
| 164 if (NeedsEagerFrame()) { | 163 if (NeedsEagerFrame()) { |
| 165 ASSERT(!frame_is_built_); | 164 ASSERT(!frame_is_built_); |
| 166 frame_is_built_ = true; | 165 frame_is_built_ = true; |
| 167 __ push(rbp); // Caller's frame pointer. | 166 __ push(rbp); // Caller's frame pointer. |
| 168 __ movq(rbp, rsp); | 167 __ movq(rbp, rsp); |
| (...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 | 2887 |
| 2889 | 2888 |
| 2890 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { | 2889 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
| 2891 Register arguments = ToRegister(instr->arguments()); | 2890 Register arguments = ToRegister(instr->arguments()); |
| 2892 Register result = ToRegister(instr->result()); | 2891 Register result = ToRegister(instr->result()); |
| 2893 | 2892 |
| 2894 if (instr->length()->IsConstantOperand() && | 2893 if (instr->length()->IsConstantOperand() && |
| 2895 instr->index()->IsConstantOperand()) { | 2894 instr->index()->IsConstantOperand()) { |
| 2896 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 2895 int32_t const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
| 2897 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length())); | 2896 int32_t const_length = ToInteger32(LConstantOperand::cast(instr->length())); |
| 2898 int index = (const_length - const_index) + 1; | 2897 StackArgumentsAccessor args(arguments, const_length, |
| 2899 __ movq(result, Operand(arguments, index * kPointerSize)); | 2898 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
| 2899 __ movq(result, args.GetArgumentOperand(const_index)); |
| 2900 } else { | 2900 } else { |
| 2901 Register length = ToRegister(instr->length()); | 2901 Register length = ToRegister(instr->length()); |
| 2902 // There are two words between the frame pointer and the last argument. | 2902 // There are two words between the frame pointer and the last argument. |
| 2903 // Subtracting from length accounts for one of them add one more. | 2903 // Subtracting from length accounts for one of them add one more. |
| 2904 if (instr->index()->IsRegister()) { | 2904 if (instr->index()->IsRegister()) { |
| 2905 __ subl(length, ToRegister(instr->index())); | 2905 __ subl(length, ToRegister(instr->index())); |
| 2906 } else { | 2906 } else { |
| 2907 __ subl(length, ToOperand(instr->index())); | 2907 __ subl(length, ToOperand(instr->index())); |
| 2908 } | 2908 } |
| 2909 __ movq(result, | 2909 StackArgumentsAccessor args(arguments, length, |
| 2910 Operand(arguments, length, times_pointer_size, kPointerSize)); | 2910 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
| 2911 __ movq(result, args.GetArgumentOperand(0)); |
| 2911 } | 2912 } |
| 2912 } | 2913 } |
| 2913 | 2914 |
| 2914 | 2915 |
| 2915 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { | 2916 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { |
| 2916 ElementsKind elements_kind = instr->elements_kind(); | 2917 ElementsKind elements_kind = instr->elements_kind(); |
| 2917 LOperand* key = instr->key(); | 2918 LOperand* key = instr->key(); |
| 2918 if (!key->IsConstantOperand()) { | 2919 if (!key->IsConstantOperand()) { |
| 2919 Register key_reg = ToRegister(key); | 2920 Register key_reg = ToRegister(key); |
| 2920 // Even though the HLoad/StoreKeyed (in this case) instructions force | 2921 // Even though the HLoad/StoreKeyed (in this case) instructions force |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3104 | 3105 |
| 3105 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 3106 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| 3106 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3107 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3107 } | 3108 } |
| 3108 | 3109 |
| 3109 | 3110 |
| 3110 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 3111 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
| 3111 Register result = ToRegister(instr->result()); | 3112 Register result = ToRegister(instr->result()); |
| 3112 | 3113 |
| 3113 if (instr->hydrogen()->from_inlined()) { | 3114 if (instr->hydrogen()->from_inlined()) { |
| 3114 __ lea(result, Operand(rsp, -2 * kPointerSize)); | 3115 __ lea(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); |
| 3115 } else { | 3116 } else { |
| 3116 // Check for arguments adapter frame. | 3117 // Check for arguments adapter frame. |
| 3117 Label done, adapted; | 3118 Label done, adapted; |
| 3118 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 3119 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 3119 __ Cmp(Operand(result, StandardFrameConstants::kContextOffset), | 3120 __ Cmp(Operand(result, StandardFrameConstants::kContextOffset), |
| 3120 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 3121 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
| 3121 __ j(equal, &adapted, Label::kNear); | 3122 __ j(equal, &adapted, Label::kNear); |
| 3122 | 3123 |
| 3123 // No arguments adaptor frame. | 3124 // No arguments adaptor frame. |
| 3124 __ movq(result, rbp); | 3125 __ movq(result, rbp); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3226 __ push(receiver); | 3227 __ push(receiver); |
| 3227 __ movq(receiver, length); | 3228 __ movq(receiver, length); |
| 3228 | 3229 |
| 3229 // Loop through the arguments pushing them onto the execution | 3230 // Loop through the arguments pushing them onto the execution |
| 3230 // stack. | 3231 // stack. |
| 3231 Label invoke, loop; | 3232 Label invoke, loop; |
| 3232 // length is a small non-negative integer, due to the test above. | 3233 // length is a small non-negative integer, due to the test above. |
| 3233 __ testl(length, length); | 3234 __ testl(length, length); |
| 3234 __ j(zero, &invoke, Label::kNear); | 3235 __ j(zero, &invoke, Label::kNear); |
| 3235 __ bind(&loop); | 3236 __ bind(&loop); |
| 3236 __ push(Operand(elements, length, times_pointer_size, 1 * kPointerSize)); | 3237 StackArgumentsAccessor args(elements, length, |
| 3238 ARGUMENTS_DONT_CONTAIN_RECEIVER); |
| 3239 __ push(args.GetArgumentOperand(0)); |
| 3237 __ decl(length); | 3240 __ decl(length); |
| 3238 __ j(not_zero, &loop); | 3241 __ j(not_zero, &loop); |
| 3239 | 3242 |
| 3240 // Invoke the function. | 3243 // Invoke the function. |
| 3241 __ bind(&invoke); | 3244 __ bind(&invoke); |
| 3242 ASSERT(instr->HasPointerMap()); | 3245 ASSERT(instr->HasPointerMap()); |
| 3243 LPointerMap* pointers = instr->pointer_map(); | 3246 LPointerMap* pointers = instr->pointer_map(); |
| 3244 RecordPosition(pointers->position()); | 3247 RecordPosition(pointers->position()); |
| 3245 SafepointGenerator safepoint_generator( | 3248 SafepointGenerator safepoint_generator( |
| 3246 this, pointers, Safepoint::kLazyDeopt); | 3249 this, pointers, Safepoint::kLazyDeopt); |
| (...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5563 FixedArray::kHeaderSize - kPointerSize)); | 5566 FixedArray::kHeaderSize - kPointerSize)); |
| 5564 __ bind(&done); | 5567 __ bind(&done); |
| 5565 } | 5568 } |
| 5566 | 5569 |
| 5567 | 5570 |
| 5568 #undef __ | 5571 #undef __ |
| 5569 | 5572 |
| 5570 } } // namespace v8::internal | 5573 } } // namespace v8::internal |
| 5571 | 5574 |
| 5572 #endif // V8_TARGET_ARCH_X64 | 5575 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |