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

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

Issue 1239593003: Fix memento initialization when constructing from new call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 5 years, 5 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/arm/builtins-arm.cc ('k') | src/deoptimizer.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); 317 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper");
318 // Should never create mementos for api functions. 318 // Should never create mementos for api functions.
319 DCHECK(!is_api_function || !create_memento); 319 DCHECK(!is_api_function || !create_memento);
320 320
321 Isolate* isolate = masm->isolate(); 321 Isolate* isolate = masm->isolate();
322 322
323 // Enter a construct frame. 323 // Enter a construct frame.
324 { 324 {
325 FrameScope scope(masm, StackFrame::CONSTRUCT); 325 FrameScope scope(masm, StackFrame::CONSTRUCT);
326 326
327 // Preserve the three incoming parameters on the stack. 327 // Preserve the four incoming parameters on the stack.
328 if (create_memento) {
329 __ AssertUndefinedOrAllocationSite(x2, x10);
330 __ Push(x2);
331 }
332
333 Register argc = x0; 328 Register argc = x0;
334 Register constructor = x1; 329 Register constructor = x1;
330 Register allocation_site = x2;
335 Register original_constructor = x3; 331 Register original_constructor = x3;
336 332
337 // Preserve the incoming parameters on the stack. 333 // Preserve the incoming parameters on the stack.
334 __ AssertUndefinedOrAllocationSite(allocation_site, x10);
338 __ SmiTag(argc); 335 __ SmiTag(argc);
339 __ Push(argc, constructor, original_constructor); 336 __ Push(allocation_site, argc, constructor, original_constructor);
340 // sp[0]: new.target 337 // sp[0]: new.target
341 // sp[1]: Constructor function. 338 // sp[1]: Constructor function.
342 // sp[2]: number of arguments (smi-tagged) 339 // sp[2]: number of arguments (smi-tagged)
340 // sp[3]: allocation site
343 341
344 // Try to allocate the object without transitioning into C code. If any of 342 // Try to allocate the object without transitioning into C code. If any of
345 // the preconditions is not met, the code bails out to the runtime call. 343 // the preconditions is not met, the code bails out to the runtime call.
346 Label rt_call, allocated; 344 Label rt_call, allocated;
347 if (FLAG_inline_new) { 345 if (FLAG_inline_new) {
348 ExternalReference debug_step_in_fp = 346 ExternalReference debug_step_in_fp =
349 ExternalReference::debug_step_in_fp_address(isolate); 347 ExternalReference::debug_step_in_fp_address(isolate);
350 __ Mov(x2, Operand(debug_step_in_fp)); 348 __ Mov(x2, Operand(debug_step_in_fp));
351 __ Ldr(x2, MemOperand(x2)); 349 __ Ldr(x2, MemOperand(x2));
352 __ Cbnz(x2, &rt_call); 350 __ Cbnz(x2, &rt_call);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 __ bind(&no_inobject_slack_tracking); 474 __ bind(&no_inobject_slack_tracking);
477 } 475 }
478 if (create_memento) { 476 if (create_memento) {
479 // Fill the pre-allocated fields with undef. 477 // Fill the pre-allocated fields with undef.
480 __ FillFields(first_prop, prop_fields, filler); 478 __ FillFields(first_prop, prop_fields, filler);
481 __ Add(first_prop, new_obj, Operand(obj_size, LSL, kPointerSizeLog2)); 479 __ Add(first_prop, new_obj, Operand(obj_size, LSL, kPointerSizeLog2));
482 __ LoadRoot(x14, Heap::kAllocationMementoMapRootIndex); 480 __ LoadRoot(x14, Heap::kAllocationMementoMapRootIndex);
483 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); 481 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset);
484 __ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex)); 482 __ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex));
485 // Load the AllocationSite 483 // Load the AllocationSite
486 __ Peek(x14, 2 * kXRegSize); 484 __ Peek(x14, 3 * kXRegSize);
485 __ AssertUndefinedOrAllocationSite(x14, x10);
487 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); 486 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
488 __ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex)); 487 __ Str(x14, MemOperand(first_prop, kPointerSize, PostIndex));
489 first_prop = NoReg; 488 first_prop = NoReg;
490 } else { 489 } else {
491 // Fill all of the property fields with undef. 490 // Fill all of the property fields with undef.
492 __ FillFields(first_prop, prop_fields, filler); 491 __ FillFields(first_prop, prop_fields, filler);
493 first_prop = NoReg; 492 first_prop = NoReg;
494 prop_fields = NoReg; 493 prop_fields = NoReg;
495 } 494 }
496 495
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // ----------- S t a t e ------------- 661 // ----------- S t a t e -------------
663 // -- x0 : number of arguments 662 // -- x0 : number of arguments
664 // -- x1 : constructor function 663 // -- x1 : constructor function
665 // -- x2 : allocation site or undefined 664 // -- x2 : allocation site or undefined
666 // -- x3 : original constructor 665 // -- x3 : original constructor
667 // -- lr : return address 666 // -- lr : return address
668 // -- sp[...]: constructor arguments 667 // -- sp[...]: constructor arguments
669 // ----------------------------------- 668 // -----------------------------------
670 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived"); 669 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived");
671 670
672 // TODO(dslomov): support pretenuring
673 CHECK(!FLAG_pretenuring_call_new);
674
675 { 671 {
676 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); 672 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
673
674 __ AssertUndefinedOrAllocationSite(x2, x10);
677 __ Mov(x4, x0); 675 __ Mov(x4, x0);
678 __ SmiTag(x4); 676 __ SmiTag(x4);
679 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex); 677 __ LoadRoot(x10, Heap::kTheHoleValueRootIndex);
680 __ Push(x4, x3, x10); 678 __ Push(x2, x4, x3, x10);
681 // sp[0]: number of arguments 679 // sp[0]: receiver (the hole)
682 // sp[1]: new.target 680 // sp[1]: new.target
683 // sp[2]: receiver (the hole) 681 // sp[2]: number of arguments
682 // sp[3]: allocation site
684 683
685 // Set up pointer to last argument. 684 // Set up pointer to last argument.
686 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); 685 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset);
687 686
688 // Copy arguments and receiver to the expression stack. 687 // Copy arguments and receiver to the expression stack.
689 // Copy 2 values every loop to use ldp/stp. 688 // Copy 2 values every loop to use ldp/stp.
690 // x0: number of arguments 689 // x0: number of arguments
691 // x1: constructor function 690 // x1: constructor function
692 // x2: address of last argument (caller sp) 691 // x2: address of last argument (caller sp)
693 // jssp[0]: receiver 692 // jssp[0]: receiver
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 } 1788 }
1790 } 1789 }
1791 1790
1792 1791
1793 #undef __ 1792 #undef __
1794 1793
1795 } // namespace internal 1794 } // namespace internal
1796 } // namespace v8 1795 } // namespace v8
1797 1796
1798 #endif // V8_TARGET_ARCH_ARM 1797 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698