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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 __ Push(rbx); | 136 __ Push(rbx); |
137 __ Integer32ToSmi(rax, rax); | 137 __ Integer32ToSmi(rax, rax); |
138 __ Push(rax); | 138 __ Push(rax); |
139 __ Push(rdi); | 139 __ Push(rdi); |
140 __ Push(rdx); | 140 __ Push(rdx); |
141 | 141 |
142 // Try to allocate the object without transitioning into C code. If any of | 142 // Try to allocate the object without transitioning into C code. If any of |
143 // the preconditions is not met, the code bails out to the runtime call. | 143 // the preconditions is not met, the code bails out to the runtime call. |
144 Label rt_call, allocated; | 144 Label rt_call, allocated; |
145 if (FLAG_inline_new) { | 145 if (FLAG_inline_new) { |
146 ExternalReference debug_step_in_fp = | |
147 ExternalReference::debug_step_in_fp_address(masm->isolate()); | |
148 __ Move(kScratchRegister, debug_step_in_fp); | |
149 __ cmpp(Operand(kScratchRegister, 0), Immediate(0)); | |
150 __ j(not_equal, &rt_call); | |
151 | |
152 // Verify that the new target is a JSFunction. | 146 // Verify that the new target is a JSFunction. |
153 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rbx); | 147 __ CmpObjectType(rdx, JS_FUNCTION_TYPE, rbx); |
154 __ j(not_equal, &rt_call); | 148 __ j(not_equal, &rt_call); |
155 | 149 |
156 // Load the initial map and verify that it is in fact a map. | 150 // Load the initial map and verify that it is in fact a map. |
157 // rdx: new target | 151 // rdx: new target |
158 __ movp(rax, FieldOperand(rdx, JSFunction::kPrototypeOrInitialMapOffset)); | 152 __ movp(rax, FieldOperand(rdx, JSFunction::kPrototypeOrInitialMapOffset)); |
159 // Will both indicate a NULL and a Smi | 153 // Will both indicate a NULL and a Smi |
160 DCHECK(kSmiTag == 0); | 154 DCHECK(kSmiTag == 0); |
161 __ JumpIfSmi(rax, &rt_call); | 155 __ JumpIfSmi(rax, &rt_call); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // Copy arguments and receiver to the expression stack. | 413 // Copy arguments and receiver to the expression stack. |
420 Label loop, entry; | 414 Label loop, entry; |
421 __ movp(rcx, rax); | 415 __ movp(rcx, rax); |
422 __ jmp(&entry); | 416 __ jmp(&entry); |
423 __ bind(&loop); | 417 __ bind(&loop); |
424 __ Push(Operand(rbx, rcx, times_pointer_size, 0)); | 418 __ Push(Operand(rbx, rcx, times_pointer_size, 0)); |
425 __ bind(&entry); | 419 __ bind(&entry); |
426 __ decp(rcx); | 420 __ decp(rcx); |
427 __ j(greater_equal, &loop); | 421 __ j(greater_equal, &loop); |
428 | 422 |
429 // Handle step in. | |
430 Label skip_step_in; | |
431 ExternalReference debug_step_in_fp = | |
432 ExternalReference::debug_step_in_fp_address(masm->isolate()); | |
433 __ Move(kScratchRegister, debug_step_in_fp); | |
434 __ cmpp(Operand(kScratchRegister, 0), Immediate(0)); | |
435 __ j(equal, &skip_step_in); | |
436 | |
437 __ Push(rax); | |
438 __ Push(rdi); | |
439 __ Push(rdi); | |
440 __ CallRuntime(Runtime::kHandleStepInForDerivedConstructors, 1); | |
441 __ Pop(rdi); | |
442 __ Pop(rax); | |
443 | |
444 __ bind(&skip_step_in); | |
445 | |
446 // Call the function. | 423 // Call the function. |
447 ParameterCount actual(rax); | 424 ParameterCount actual(rax); |
448 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); | 425 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); |
449 | 426 |
450 // Restore context from the frame. | 427 // Restore context from the frame. |
451 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 428 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
452 | 429 |
453 // Get arguments count, skipping over new.target. | 430 // Get arguments count, skipping over new.target. |
454 __ movp(rbx, Operand(rsp, kPointerSize)); // Get arguments count. | 431 __ movp(rbx, Operand(rsp, kPointerSize)); // Get arguments count. |
455 } // Leave construct frame. | 432 } // Leave construct frame. |
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 __ ret(0); | 1978 __ ret(0); |
2002 } | 1979 } |
2003 | 1980 |
2004 | 1981 |
2005 #undef __ | 1982 #undef __ |
2006 | 1983 |
2007 } // namespace internal | 1984 } // namespace internal |
2008 } // namespace v8 | 1985 } // namespace v8 |
2009 | 1986 |
2010 #endif // V8_TARGET_ARCH_X64 | 1987 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |