Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 867153003: new classes: special construct stub for derived classs and TDZ for `this`. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CHECK_OK fixed Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scopes.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { 491 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
492 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); 492 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new);
493 } 493 }
494 494
495 495
496 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { 496 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
497 Generate_JSConstructStubHelper(masm, true, false); 497 Generate_JSConstructStubHelper(masm, true, false);
498 } 498 }
499 499
500 500
501 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
502 // ----------- S t a t e -------------
503 // -- rax: number of arguments
504 // -- rdi: constructor function
505 // -- rbx: allocation site or undefined
506 // -- rdx: original constructor
507 // -----------------------------------
508 // TODO(dslomov): support pretenuring
509 CHECK(!FLAG_pretenuring_call_new);
510
511 {
512 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
513
514 // Store a smi-tagged arguments count on the stack.
515 __ Integer32ToSmi(rax, rax);
516 __ Push(rax);
517 __ SmiToInteger32(rax, rax);
518
519 // receiver is the hole.
520 __ Push(masm->isolate()->factory()->the_hole_value());
521
522 // Set up pointer to last argument.
523 __ leap(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset));
524
525 // Copy arguments and receiver to the expression stack.
526 Label loop, entry;
527 __ movp(rcx, rax);
528 __ jmp(&entry);
529 __ bind(&loop);
530 __ Push(Operand(rbx, rcx, times_pointer_size, 0));
531 __ bind(&entry);
532 __ decp(rcx);
533 __ j(greater_equal, &loop);
534
535 // Call the function.
536 ParameterCount actual(rax);
537 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper());
538
539 // Restore context from the frame.
540 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
541
542 __ movp(rbx, Operand(rsp, 0)); // Get arguments count.
543 } // Leave construct frame.
544
545 // Remove caller arguments from the stack and return.
546 __ PopReturnAddressTo(rcx);
547 SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
548 __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
549 __ PushReturnAddressFrom(rcx);
550 __ ret(0);
551 }
552
553
501 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 554 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
502 bool is_construct) { 555 bool is_construct) {
503 ProfileEntryHookStub::MaybeCallEntryHook(masm); 556 ProfileEntryHookStub::MaybeCallEntryHook(masm);
504 557
505 // Expects five C++ function parameters. 558 // Expects five C++ function parameters.
506 // - Address entry (ignored) 559 // - Address entry (ignored)
507 // - JSFunction* function ( 560 // - JSFunction* function (
508 // - Object* receiver 561 // - Object* receiver
509 // - int argc 562 // - int argc
510 // - Object*** argv 563 // - Object*** argv
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 __ bind(&ok); 1592 __ bind(&ok);
1540 __ ret(0); 1593 __ ret(0);
1541 } 1594 }
1542 1595
1543 1596
1544 #undef __ 1597 #undef __
1545 1598
1546 } } // namespace v8::internal 1599 } } // namespace v8::internal
1547 1600
1548 #endif // V8_TARGET_ARCH_X64 1601 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698