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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 CHECK(!FLAG_pretenuring_call_new); | 509 CHECK(!FLAG_pretenuring_call_new); |
510 | 510 |
511 { | 511 { |
512 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 512 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
513 | 513 |
514 // Store a smi-tagged arguments count on the stack. | 514 // Store a smi-tagged arguments count on the stack. |
515 __ Integer32ToSmi(rax, rax); | 515 __ Integer32ToSmi(rax, rax); |
516 __ Push(rax); | 516 __ Push(rax); |
517 __ SmiToInteger32(rax, rax); | 517 __ SmiToInteger32(rax, rax); |
518 | 518 |
519 // Push new.target | |
520 __ Push(rdx); | |
521 | |
522 // receiver is the hole. | 519 // receiver is the hole. |
523 __ Push(masm->isolate()->factory()->the_hole_value()); | 520 __ Push(masm->isolate()->factory()->the_hole_value()); |
524 | 521 |
525 // Set up pointer to last argument. | 522 // Set up pointer to last argument. |
526 __ leap(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset)); | 523 __ leap(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset)); |
527 | 524 |
528 // Copy arguments and receiver to the expression stack. | 525 // Copy arguments and receiver to the expression stack. |
529 Label loop, entry; | 526 Label loop, entry; |
530 __ movp(rcx, rax); | 527 __ movp(rcx, rax); |
531 __ jmp(&entry); | 528 __ jmp(&entry); |
532 __ bind(&loop); | 529 __ bind(&loop); |
533 __ Push(Operand(rbx, rcx, times_pointer_size, 0)); | 530 __ Push(Operand(rbx, rcx, times_pointer_size, 0)); |
534 __ bind(&entry); | 531 __ bind(&entry); |
535 __ decp(rcx); | 532 __ decp(rcx); |
536 __ j(greater_equal, &loop); | 533 __ j(greater_equal, &loop); |
537 | 534 |
538 // Call the function. | 535 // Call the function. |
539 __ incp(rax); // Pushed new.target. | |
540 ParameterCount actual(rax); | 536 ParameterCount actual(rax); |
541 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); | 537 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); |
542 | 538 |
543 // Restore context from the frame. | 539 // Restore context from the frame. |
544 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 540 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
545 | 541 |
546 __ movp(rbx, Operand(rsp, 0)); // Get arguments count. | 542 __ movp(rbx, Operand(rsp, 0)); // Get arguments count. |
547 } // Leave construct frame. | 543 } // Leave construct frame. |
548 | 544 |
549 // Remove caller arguments from the stack and return. | 545 // Remove caller arguments from the stack and return. |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 __ bind(&ok); | 1592 __ bind(&ok); |
1597 __ ret(0); | 1593 __ ret(0); |
1598 } | 1594 } |
1599 | 1595 |
1600 | 1596 |
1601 #undef __ | 1597 #undef __ |
1602 | 1598 |
1603 } } // namespace v8::internal | 1599 } } // namespace v8::internal |
1604 | 1600 |
1605 #endif // V8_TARGET_ARCH_X64 | 1601 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |