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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 Loading... | |
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) { | 120 // Always push a potential allocation site to preserve a fixed frame size. |
Michael Starzinger
2015/07/16 14:08:28
nit: Ideally this behavior will become the default
Michael Lippautz
2015/07/16 14:15:35
Done.
| |
121 __ AssertUndefinedOrAllocationSite(ebx); | 121 __ AssertUndefinedOrAllocationSite(ebx); |
122 __ push(ebx); | 122 __ push(ebx); |
123 } | |
124 | 123 |
125 // Preserve the incoming parameters on the stack. | 124 // Preserve the incoming parameters on the stack. |
126 __ SmiTag(eax); | 125 __ SmiTag(eax); |
127 __ push(eax); | 126 __ push(eax); |
128 __ push(edi); | 127 __ push(edi); |
129 __ push(edx); | 128 __ push(edx); |
130 | 129 |
131 // Try to allocate the object without transitioning into C code. If any of | 130 // 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. | 131 // the preconditions is not met, the code bails out to the runtime call. |
133 Label rt_call, allocated; | 132 Label rt_call, allocated; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 | 246 |
248 if (create_memento) { | 247 if (create_memento) { |
249 __ lea(esi, Operand(edi, -AllocationMemento::kSize)); | 248 __ lea(esi, Operand(edi, -AllocationMemento::kSize)); |
250 __ InitializeFieldsWithFiller(ecx, esi, edx); | 249 __ InitializeFieldsWithFiller(ecx, esi, edx); |
251 | 250 |
252 // Fill in memento fields if necessary. | 251 // Fill in memento fields if necessary. |
253 // esi: points to the allocated but uninitialized memento. | 252 // esi: points to the allocated but uninitialized memento. |
254 __ mov(Operand(esi, AllocationMemento::kMapOffset), | 253 __ mov(Operand(esi, AllocationMemento::kMapOffset), |
255 factory->allocation_memento_map()); | 254 factory->allocation_memento_map()); |
256 // Get the cell or undefined. | 255 // Get the cell or undefined. |
257 __ mov(edx, Operand(esp, kPointerSize*2)); | 256 __ mov(edx, Operand(esp, 3 * kPointerSize)); |
Michael Starzinger
2015/07/16 14:08:28
Nice catch!
Michael Lippautz
2015/07/16 14:15:35
Acknowledged.
| |
257 __ AssertUndefinedOrAllocationSite(edx); | |
258 __ mov(Operand(esi, AllocationMemento::kAllocationSiteOffset), | 258 __ mov(Operand(esi, AllocationMemento::kAllocationSiteOffset), |
259 edx); | 259 edx); |
260 } else { | 260 } else { |
261 __ InitializeFieldsWithFiller(ecx, edi, edx); | 261 __ InitializeFieldsWithFiller(ecx, edi, edx); |
262 } | 262 } |
263 | 263 |
264 // Add the object tag to make the JSObject real, so that we can continue | 264 // 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. | 265 // and jump into the continuation code at any time from now on. |
266 // ebx: JSObject (untagged) | 266 // ebx: JSObject (untagged) |
267 __ or_(ebx, Immediate(kHeapObjectTag)); | 267 __ or_(ebx, Immediate(kHeapObjectTag)); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 | 415 |
416 | 416 |
417 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 417 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
418 // ----------- S t a t e ------------- | 418 // ----------- S t a t e ------------- |
419 // -- eax: number of arguments | 419 // -- eax: number of arguments |
420 // -- edi: constructor function | 420 // -- edi: constructor function |
421 // -- ebx: allocation site or undefined | 421 // -- ebx: allocation site or undefined |
422 // -- edx: original constructor | 422 // -- edx: original constructor |
423 // ----------------------------------- | 423 // ----------------------------------- |
424 | 424 |
425 // TODO(dslomov): support pretenuring | |
426 CHECK(!FLAG_pretenuring_call_new); | |
427 | |
428 { | 425 { |
429 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 426 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
430 | 427 |
428 // Always push a potential allocation site to preserve a fixed frame size. | |
Michael Starzinger
2015/07/16 14:08:28
Likewise.
Michael Lippautz
2015/07/16 14:15:35
Done.
| |
429 __ AssertUndefinedOrAllocationSite(ebx); | |
430 __ push(ebx); | |
431 | |
431 // Preserve actual arguments count. | 432 // Preserve actual arguments count. |
432 __ SmiTag(eax); | 433 __ SmiTag(eax); |
433 __ push(eax); | 434 __ push(eax); |
434 __ SmiUntag(eax); | 435 __ SmiUntag(eax); |
435 | 436 |
436 // Push new.target. | 437 // Push new.target. |
437 __ push(edx); | 438 __ push(edx); |
438 | 439 |
439 // receiver is the hole. | 440 // receiver is the hole. |
440 __ push(Immediate(masm->isolate()->factory()->the_hole_value())); | 441 __ push(Immediate(masm->isolate()->factory()->the_hole_value())); |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 | 1630 |
1630 __ bind(&ok); | 1631 __ bind(&ok); |
1631 __ ret(0); | 1632 __ ret(0); |
1632 } | 1633 } |
1633 | 1634 |
1634 #undef __ | 1635 #undef __ |
1635 } // namespace internal | 1636 } // namespace internal |
1636 } // namespace v8 | 1637 } // namespace v8 |
1637 | 1638 |
1638 #endif // V8_TARGET_ARCH_IA32 | 1639 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |