OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 if (info()->IsOptimizing()) { | 635 if (info()->IsOptimizing()) { |
636 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 636 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
637 | 637 |
638 // TODO(all): Add support for stop_t FLAG in DEBUG mode. | 638 // TODO(all): Add support for stop_t FLAG in DEBUG mode. |
639 | 639 |
640 // Sloppy mode functions and builtins need to replace the receiver with the | 640 // Sloppy mode functions and builtins need to replace the receiver with the |
641 // global proxy when called as functions (without an explicit receiver | 641 // global proxy when called as functions (without an explicit receiver |
642 // object). | 642 // object). |
643 if (info_->this_has_uses() && | 643 if (info_->this_has_uses() && |
644 info_->strict_mode() == SLOPPY && | 644 info_->strict_mode() == SLOPPY && |
645 !info_->is_native()) { | 645 !info_->is_native() && |
| 646 info_->scope()->has_this_declaration()) { |
646 Label ok; | 647 Label ok; |
647 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; | 648 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; |
648 __ Peek(x10, receiver_offset); | 649 __ Peek(x10, receiver_offset); |
649 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); | 650 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); |
650 | 651 |
651 __ Ldr(x10, GlobalObjectMemOperand()); | 652 __ Ldr(x10, GlobalObjectMemOperand()); |
652 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); | 653 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); |
653 __ Poke(x10, receiver_offset); | 654 __ Poke(x10, receiver_offset); |
654 | 655 |
655 __ Bind(&ok); | 656 __ Bind(&ok); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 __ Push(x1); | 694 __ Push(x1); |
694 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 695 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
695 } | 696 } |
696 RecordSafepoint(Safepoint::kNoLazyDeopt); | 697 RecordSafepoint(Safepoint::kNoLazyDeopt); |
697 // Context is returned in x0. It replaces the context passed to us. It's | 698 // Context is returned in x0. It replaces the context passed to us. It's |
698 // saved in the stack and kept live in cp. | 699 // saved in the stack and kept live in cp. |
699 __ Mov(cp, x0); | 700 __ Mov(cp, x0); |
700 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 701 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
701 // Copy any necessary parameters into the context. | 702 // Copy any necessary parameters into the context. |
702 int num_parameters = scope()->num_parameters(); | 703 int num_parameters = scope()->num_parameters(); |
703 for (int i = 0; i < num_parameters; i++) { | 704 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
704 Variable* var = scope()->parameter(i); | 705 for (int i = first_parameter; i < num_parameters; i++) { |
| 706 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
705 if (var->IsContextSlot()) { | 707 if (var->IsContextSlot()) { |
706 Register value = x0; | 708 Register value = x0; |
707 Register scratch = x3; | 709 Register scratch = x3; |
708 | 710 |
709 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 711 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
710 (num_parameters - 1 - i) * kPointerSize; | 712 (num_parameters - 1 - i) * kPointerSize; |
711 // Load parameter from stack. | 713 // Load parameter from stack. |
712 __ Ldr(value, MemOperand(fp, parameter_offset)); | 714 __ Ldr(value, MemOperand(fp, parameter_offset)); |
713 // Store it in the context. | 715 // Store it in the context. |
714 MemOperand target = ContextMemOperand(cp, var->index()); | 716 MemOperand target = ContextMemOperand(cp, var->index()); |
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6063 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6065 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6064 __ Push(scope_info); | 6066 __ Push(scope_info); |
6065 __ Push(ToRegister(instr->function())); | 6067 __ Push(ToRegister(instr->function())); |
6066 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6068 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6067 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6069 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6068 } | 6070 } |
6069 | 6071 |
6070 | 6072 |
6071 | 6073 |
6072 } } // namespace v8::internal | 6074 } } // namespace v8::internal |
OLD | NEW |