OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // rdi: constructor | 269 // rdi: constructor |
270 // rdx: new target | 270 // rdx: new target |
271 // rbx: newly allocated object | 271 // rbx: newly allocated object |
272 __ bind(&allocated); | 272 __ bind(&allocated); |
273 | 273 |
274 // Retrieve smi-tagged arguments count from the stack. | 274 // Retrieve smi-tagged arguments count from the stack. |
275 __ movp(rax, Operand(rsp, 0)); | 275 __ movp(rax, Operand(rsp, 0)); |
276 __ SmiToInteger32(rax, rax); | 276 __ SmiToInteger32(rax, rax); |
277 } | 277 } |
278 | 278 |
279 // Push new.target onto the construct frame. This is stored just below the | |
280 // receiver on the stack. | |
281 __ Push(rdx); | |
282 | |
283 if (create_implicit_receiver) { | 279 if (create_implicit_receiver) { |
284 // Push the allocated receiver to the stack. We need two copies | 280 // Push the allocated receiver to the stack. We need two copies |
285 // because we may have to return the original one and the calling | 281 // because we may have to return the original one and the calling |
286 // conventions dictate that the called function pops the receiver. | 282 // conventions dictate that the called function pops the receiver. |
287 __ Push(rbx); | 283 __ Push(rbx); |
288 __ Push(rbx); | 284 __ Push(rbx); |
289 } else { | 285 } else { |
290 __ PushRoot(Heap::kTheHoleValueRootIndex); | 286 __ PushRoot(Heap::kTheHoleValueRootIndex); |
291 } | 287 } |
292 | 288 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 332 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
337 __ CmpObjectType(rax, FIRST_JS_RECEIVER_TYPE, rcx); | 333 __ CmpObjectType(rax, FIRST_JS_RECEIVER_TYPE, rcx); |
338 __ j(above_equal, &exit); | 334 __ j(above_equal, &exit); |
339 | 335 |
340 // Throw away the result of the constructor invocation and use the | 336 // Throw away the result of the constructor invocation and use the |
341 // on-stack receiver as the result. | 337 // on-stack receiver as the result. |
342 __ bind(&use_receiver); | 338 __ bind(&use_receiver); |
343 __ movp(rax, Operand(rsp, 0)); | 339 __ movp(rax, Operand(rsp, 0)); |
344 | 340 |
345 // Restore the arguments count and leave the construct frame. The | 341 // Restore the arguments count and leave the construct frame. The |
346 // arguments count is stored below the reciever and the new.target. | 342 // arguments count is stored below the receiver. |
347 __ bind(&exit); | 343 __ bind(&exit); |
348 __ movp(rbx, Operand(rsp, 2 * kPointerSize)); | 344 __ movp(rbx, Operand(rsp, 1 * kPointerSize)); |
349 } else { | 345 } else { |
350 __ movp(rbx, Operand(rsp, kPointerSize)); | 346 __ movp(rbx, Operand(rsp, 0)); |
351 } | 347 } |
352 | 348 |
353 // Leave construct frame. | 349 // Leave construct frame. |
354 } | 350 } |
355 | 351 |
356 // Remove caller arguments from the stack and return. | 352 // Remove caller arguments from the stack and return. |
357 __ PopReturnAddressTo(rcx); | 353 __ PopReturnAddressTo(rcx); |
358 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); | 354 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2); |
359 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); | 355 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize)); |
360 __ PushReturnAddressFrom(rcx); | 356 __ PushReturnAddressFrom(rcx); |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 __ ret(0); | 2036 __ ret(0); |
2041 } | 2037 } |
2042 | 2038 |
2043 | 2039 |
2044 #undef __ | 2040 #undef __ |
2045 | 2041 |
2046 } // namespace internal | 2042 } // namespace internal |
2047 } // namespace v8 | 2043 } // namespace v8 |
2048 | 2044 |
2049 #endif // V8_TARGET_ARCH_X64 | 2045 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |