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

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

Issue 1229023003: X87: Fix memento initialization when constructing from new call (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | no next file » | 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_X87 7 #if V8_TARGET_ARCH_X87
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // -- edx: original constructor 110 // -- edx: original constructor
111 // ----------------------------------- 111 // -----------------------------------
112 112
113 // Should never create mementos for api functions. 113 // Should never create mementos for api functions.
114 DCHECK(!is_api_function || !create_memento); 114 DCHECK(!is_api_function || !create_memento);
115 115
116 // Enter a construct frame. 116 // Enter a construct frame.
117 { 117 {
118 FrameScope scope(masm, StackFrame::CONSTRUCT); 118 FrameScope scope(masm, StackFrame::CONSTRUCT);
119 119
120 if (create_memento) {
121 __ AssertUndefinedOrAllocationSite(ebx);
122 __ push(ebx);
123 }
124
125 // Preserve the incoming parameters on the stack. 120 // Preserve the incoming parameters on the stack.
121 __ AssertUndefinedOrAllocationSite(ebx);
122 __ push(ebx);
126 __ SmiTag(eax); 123 __ SmiTag(eax);
127 __ push(eax); 124 __ push(eax);
128 __ push(edi); 125 __ push(edi);
129 __ push(edx); 126 __ push(edx);
130 127
131 // Try to allocate the object without transitioning into C code. If any of 128 // Try to allocate the object without transitioning into C code. If any of
132 // the preconditions is not met, the code bails out to the runtime call. 129 // the preconditions is not met, the code bails out to the runtime call.
133 Label rt_call, allocated; 130 Label rt_call, allocated;
134 if (FLAG_inline_new) { 131 if (FLAG_inline_new) {
135 ExternalReference debug_step_in_fp = 132 ExternalReference debug_step_in_fp =
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 244
248 if (create_memento) { 245 if (create_memento) {
249 __ lea(esi, Operand(edi, -AllocationMemento::kSize)); 246 __ lea(esi, Operand(edi, -AllocationMemento::kSize));
250 __ InitializeFieldsWithFiller(ecx, esi, edx); 247 __ InitializeFieldsWithFiller(ecx, esi, edx);
251 248
252 // Fill in memento fields if necessary. 249 // Fill in memento fields if necessary.
253 // esi: points to the allocated but uninitialized memento. 250 // esi: points to the allocated but uninitialized memento.
254 __ mov(Operand(esi, AllocationMemento::kMapOffset), 251 __ mov(Operand(esi, AllocationMemento::kMapOffset),
255 factory->allocation_memento_map()); 252 factory->allocation_memento_map());
256 // Get the cell or undefined. 253 // Get the cell or undefined.
257 __ mov(edx, Operand(esp, kPointerSize*2)); 254 __ mov(edx, Operand(esp, 3 * kPointerSize));
255 __ AssertUndefinedOrAllocationSite(edx);
258 __ mov(Operand(esi, AllocationMemento::kAllocationSiteOffset), 256 __ mov(Operand(esi, AllocationMemento::kAllocationSiteOffset),
259 edx); 257 edx);
260 } else { 258 } else {
261 __ InitializeFieldsWithFiller(ecx, edi, edx); 259 __ InitializeFieldsWithFiller(ecx, edi, edx);
262 } 260 }
263 261
264 // Add the object tag to make the JSObject real, so that we can continue 262 // Add the object tag to make the JSObject real, so that we can continue
265 // and jump into the continuation code at any time from now on. 263 // and jump into the continuation code at any time from now on.
266 // ebx: JSObject (untagged) 264 // ebx: JSObject (untagged)
267 __ or_(ebx, Immediate(kHeapObjectTag)); 265 __ or_(ebx, Immediate(kHeapObjectTag));
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 413
416 414
417 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { 415 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
418 // ----------- S t a t e ------------- 416 // ----------- S t a t e -------------
419 // -- eax: number of arguments 417 // -- eax: number of arguments
420 // -- edi: constructor function 418 // -- edi: constructor function
421 // -- ebx: allocation site or undefined 419 // -- ebx: allocation site or undefined
422 // -- edx: original constructor 420 // -- edx: original constructor
423 // ----------------------------------- 421 // -----------------------------------
424 422
425 // TODO(dslomov): support pretenuring
426 CHECK(!FLAG_pretenuring_call_new);
427
428 { 423 {
429 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); 424 FrameScope frame_scope(masm, StackFrame::CONSTRUCT);
430 425
426 // Preserve allocation site.
427 __ AssertUndefinedOrAllocationSite(ebx);
428 __ push(ebx);
429
431 // Preserve actual arguments count. 430 // Preserve actual arguments count.
432 __ SmiTag(eax); 431 __ SmiTag(eax);
433 __ push(eax); 432 __ push(eax);
434 __ SmiUntag(eax); 433 __ SmiUntag(eax);
435 434
436 // Push new.target. 435 // Push new.target.
437 __ push(edx); 436 __ push(edx);
438 437
439 // receiver is the hole. 438 // receiver is the hole.
440 __ push(Immediate(masm->isolate()->factory()->the_hole_value())); 439 __ push(Immediate(masm->isolate()->factory()->the_hole_value()));
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 1626
1628 __ bind(&ok); 1627 __ bind(&ok);
1629 __ ret(0); 1628 __ ret(0);
1630 } 1629 }
1631 1630
1632 #undef __ 1631 #undef __
1633 } // namespace internal 1632 } // namespace internal
1634 } // namespace v8 1633 } // namespace v8
1635 1634
1636 #endif // V8_TARGET_ARCH_X87 1635 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698