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) { | |
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 Loading... |
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 Loading... |
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 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 | 1628 |
1630 __ bind(&ok); | 1629 __ bind(&ok); |
1631 __ ret(0); | 1630 __ ret(0); |
1632 } | 1631 } |
1633 | 1632 |
1634 #undef __ | 1633 #undef __ |
1635 } // namespace internal | 1634 } // namespace internal |
1636 } // namespace v8 | 1635 } // namespace v8 |
1637 | 1636 |
1638 #endif // V8_TARGET_ARCH_IA32 | 1637 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |