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

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

Issue 1239593003: Fix memento initialization when constructing from new call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: readd deleted line 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
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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 // Should never create mementos for api functions. 331 // Should never create mementos for api functions.
332 DCHECK(!is_api_function || !create_memento); 332 DCHECK(!is_api_function || !create_memento);
333 333
334 Isolate* isolate = masm->isolate(); 334 Isolate* isolate = masm->isolate();
335 335
336 // Enter a construct frame. 336 // Enter a construct frame.
337 { 337 {
338 FrameScope scope(masm, StackFrame::CONSTRUCT); 338 FrameScope scope(masm, StackFrame::CONSTRUCT);
339 339
340 if (create_memento) {
341 __ AssertUndefinedOrAllocationSite(a2, t0);
342 __ push(a2);
343 }
344
345 // Preserve the incoming parameters on the stack. 340 // Preserve the incoming parameters on the stack.
341 __ AssertUndefinedOrAllocationSite(a2, t0);
342 __ push(a2);
346 __ SmiTag(a0); 343 __ SmiTag(a0);
347 __ Push(a0, a1, a3); 344 __ Push(a2, a0, a1, a3);
348 345
349 // Try to allocate the object without transitioning into C code. If any of 346 // Try to allocate the object without transitioning into C code. If any of
350 // the preconditions is not met, the code bails out to the runtime call. 347 // the preconditions is not met, the code bails out to the runtime call.
351 Label rt_call, allocated; 348 Label rt_call, allocated;
352 if (FLAG_inline_new) { 349 if (FLAG_inline_new) {
353 ExternalReference debug_step_in_fp = 350 ExternalReference debug_step_in_fp =
354 ExternalReference::debug_step_in_fp_address(isolate); 351 ExternalReference::debug_step_in_fp_address(isolate);
355 __ li(a2, Operand(debug_step_in_fp)); 352 __ li(a2, Operand(debug_step_in_fp));
356 __ lw(a2, MemOperand(a2)); 353 __ lw(a2, MemOperand(a2));
357 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); 354 __ Branch(&rt_call, ne, a2, Operand(zero_reg));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 __ Addu(a0, t4, Operand(a0)); // End of object. 466 __ Addu(a0, t4, Operand(a0)); // End of object.
470 __ InitializeFieldsWithFiller(t5, a0, t7); 467 __ InitializeFieldsWithFiller(t5, a0, t7);
471 468
472 // Fill in memento fields. 469 // Fill in memento fields.
473 // t5: points to the allocated but uninitialized memento. 470 // t5: points to the allocated but uninitialized memento.
474 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex); 471 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex);
475 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); 472 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset);
476 __ sw(t7, MemOperand(t5)); 473 __ sw(t7, MemOperand(t5));
477 __ Addu(t5, t5, kPointerSize); 474 __ Addu(t5, t5, kPointerSize);
478 // Load the AllocationSite. 475 // Load the AllocationSite.
479 __ lw(t7, MemOperand(sp, 2 * kPointerSize)); 476 __ lw(t7, MemOperand(sp, 3 * kPointerSize));
477 __ AssertUndefinedOrAllocationSite(a2, t0);
480 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); 478 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset);
481 __ sw(t7, MemOperand(t5)); 479 __ sw(t7, MemOperand(t5));
482 __ Addu(t5, t5, kPointerSize); 480 __ Addu(t5, t5, kPointerSize);
483 } else { 481 } else {
484 __ sll(at, a3, kPointerSizeLog2); 482 __ sll(at, a3, kPointerSizeLog2);
485 __ Addu(a0, t4, Operand(at)); // End of object. 483 __ Addu(a0, t4, Operand(at)); // End of object.
486 __ InitializeFieldsWithFiller(t5, a0, t7); 484 __ InitializeFieldsWithFiller(t5, a0, t7);
487 } 485 }
488 486
489 // Add the object tag to make the JSObject real, so that we can continue 487 // Add the object tag to make the JSObject real, so that we can continue
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { 650 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
653 // ----------- S t a t e ------------- 651 // ----------- S t a t e -------------
654 // -- a0 : number of arguments 652 // -- a0 : number of arguments
655 // -- a1 : constructor function 653 // -- a1 : constructor function
656 // -- a2 : allocation site or undefined 654 // -- a2 : allocation site or undefined
657 // -- a3 : original constructor 655 // -- a3 : original constructor
658 // -- ra : return address 656 // -- ra : return address
659 // -- sp[...]: constructor arguments 657 // -- sp[...]: constructor arguments
660 // ----------------------------------- 658 // -----------------------------------
661 659
662 // TODO(dslomov): support pretenuring
663 CHECK(!FLAG_pretenuring_call_new);
664
665 { 660 {
666 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); 661 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
667 662
663 __ AssertUndefinedOrAllocationSite(a2, t0);
664 __ push(a2);
665
668 __ mov(t0, a0); 666 __ mov(t0, a0);
669 __ SmiTag(t0); 667 __ SmiTag(t0);
670 __ push(t0); // Smi-tagged arguments count. 668 __ push(t0); // Smi-tagged arguments count.
671 669
672 // Push new.target. 670 // Push new.target.
673 __ push(a3); 671 __ push(a3);
674 672
675 // receiver is the hole. 673 // receiver is the hole.
676 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 674 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
677 __ push(at); 675 __ push(at);
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 } 1735 }
1738 } 1736 }
1739 1737
1740 1738
1741 #undef __ 1739 #undef __
1742 1740
1743 } // namespace internal 1741 } // namespace internal
1744 } // namespace v8 1742 } // namespace v8
1745 1743
1746 #endif // V8_TARGET_ARCH_MIPS 1744 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698