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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 // Call the target. | 3601 // Call the target. |
3602 __ mov(eax, Immediate(argc)); | 3602 __ mov(eax, Immediate(argc)); |
3603 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3603 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3604 // Restore context register. | 3604 // Restore context register. |
3605 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3605 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3606 // Discard the function left on TOS. | 3606 // Discard the function left on TOS. |
3607 context()->DropAndPlug(1, eax); | 3607 context()->DropAndPlug(1, eax); |
3608 } | 3608 } |
3609 | 3609 |
3610 | 3610 |
3611 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
3612 ZoneList<Expression*>* args = expr->arguments(); | |
3613 DCHECK(args->length() == 2); | |
3614 | |
3615 // Evaluate new.target and super constructor. | |
3616 VisitForStackValue(args->at(0)); | |
3617 VisitForStackValue(args->at(1)); | |
3618 | |
3619 // Call the construct call builtin that handles allocation and | |
3620 // constructor invocation. | |
3621 SetConstructCallPosition(expr); | |
3622 | |
3623 // Check if the calling frame is an arguments adaptor frame. | |
3624 Label adaptor_frame, args_set_up, runtime; | |
3625 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | |
3626 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); | |
3627 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | |
3628 __ j(equal, &adaptor_frame); | |
3629 // default constructor has no arguments, so no adaptor frame means no args. | |
3630 __ mov(eax, Immediate(0)); | |
3631 __ jmp(&args_set_up); | |
3632 | |
3633 // Copy arguments from adaptor frame. | |
3634 { | |
3635 __ bind(&adaptor_frame); | |
3636 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
3637 __ SmiUntag(ebx); | |
3638 | |
3639 __ mov(eax, ebx); | |
3640 __ lea(edx, Operand(edx, ebx, times_pointer_size, | |
3641 StandardFrameConstants::kCallerSPOffset)); | |
3642 Label loop; | |
3643 __ bind(&loop); | |
3644 __ push(Operand(edx, -1 * kPointerSize)); | |
3645 __ sub(edx, Immediate(kPointerSize)); | |
3646 __ dec(ebx); | |
3647 __ j(not_zero, &loop); | |
3648 } | |
3649 | |
3650 __ bind(&args_set_up); | |
3651 | |
3652 __ mov(edx, Operand(esp, eax, times_pointer_size, 1 * kPointerSize)); | |
3653 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); | |
3654 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
3655 | |
3656 // Restore context register. | |
3657 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
3658 | |
3659 context()->DropAndPlug(1, eax); | |
3660 } | |
3661 | |
3662 | |
3663 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3611 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3664 ZoneList<Expression*>* args = expr->arguments(); | 3612 ZoneList<Expression*>* args = expr->arguments(); |
3665 DCHECK(args->length() == 1); | 3613 DCHECK(args->length() == 1); |
3666 | 3614 |
3667 VisitForAccumulatorValue(args->at(0)); | 3615 VisitForAccumulatorValue(args->at(0)); |
3668 | 3616 |
3669 __ AssertString(eax); | 3617 __ AssertString(eax); |
3670 | 3618 |
3671 Label materialize_true, materialize_false; | 3619 Label materialize_true, materialize_false; |
3672 Label* if_true = NULL; | 3620 Label* if_true = NULL; |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4817 Assembler::target_address_at(call_target_address, | 4765 Assembler::target_address_at(call_target_address, |
4818 unoptimized_code)); | 4766 unoptimized_code)); |
4819 return OSR_AFTER_STACK_CHECK; | 4767 return OSR_AFTER_STACK_CHECK; |
4820 } | 4768 } |
4821 | 4769 |
4822 | 4770 |
4823 } // namespace internal | 4771 } // namespace internal |
4824 } // namespace v8 | 4772 } // namespace v8 |
4825 | 4773 |
4826 #endif // V8_TARGET_ARCH_X87 | 4774 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |