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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if (info()->IsOptimizing()) { | 657 if (info()->IsOptimizing()) { |
658 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 658 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
659 | 659 |
660 // TODO(all): Add support for stop_t FLAG in DEBUG mode. | 660 // TODO(all): Add support for stop_t FLAG in DEBUG mode. |
661 | 661 |
662 // Sloppy mode functions and builtins need to replace the receiver with the | 662 // Sloppy mode functions and builtins need to replace the receiver with the |
663 // global proxy when called as functions (without an explicit receiver | 663 // global proxy when called as functions (without an explicit receiver |
664 // object). | 664 // object). |
665 if (info_->this_has_uses() && | 665 if (info_->this_has_uses() && |
666 info_->strict_mode() == SLOPPY && | 666 info_->strict_mode() == SLOPPY && |
667 !info_->is_native()) { | 667 !info_->is_native() && |
| 668 info_->scope()->has_this_declaration()) { |
668 Label ok; | 669 Label ok; |
669 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; | 670 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; |
670 __ Peek(x10, receiver_offset); | 671 __ Peek(x10, receiver_offset); |
671 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); | 672 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); |
672 | 673 |
673 __ Ldr(x10, GlobalObjectMemOperand()); | 674 __ Ldr(x10, GlobalObjectMemOperand()); |
674 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); | 675 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); |
675 __ Poke(x10, receiver_offset); | 676 __ Poke(x10, receiver_offset); |
676 | 677 |
677 __ Bind(&ok); | 678 __ Bind(&ok); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 __ Push(x1); | 716 __ Push(x1); |
716 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 717 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
717 } | 718 } |
718 RecordSafepoint(Safepoint::kNoLazyDeopt); | 719 RecordSafepoint(Safepoint::kNoLazyDeopt); |
719 // Context is returned in x0. It replaces the context passed to us. It's | 720 // Context is returned in x0. It replaces the context passed to us. It's |
720 // saved in the stack and kept live in cp. | 721 // saved in the stack and kept live in cp. |
721 __ Mov(cp, x0); | 722 __ Mov(cp, x0); |
722 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 723 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
723 // Copy any necessary parameters into the context. | 724 // Copy any necessary parameters into the context. |
724 int num_parameters = scope()->num_parameters(); | 725 int num_parameters = scope()->num_parameters(); |
725 for (int i = 0; i < num_parameters; i++) { | 726 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
726 Variable* var = scope()->parameter(i); | 727 for (int i = first_parameter; i < num_parameters; i++) { |
| 728 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
727 if (var->IsContextSlot()) { | 729 if (var->IsContextSlot()) { |
728 Register value = x0; | 730 Register value = x0; |
729 Register scratch = x3; | 731 Register scratch = x3; |
730 | 732 |
731 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 733 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
732 (num_parameters - 1 - i) * kPointerSize; | 734 (num_parameters - 1 - i) * kPointerSize; |
733 // Load parameter from stack. | 735 // Load parameter from stack. |
734 __ Ldr(value, MemOperand(fp, parameter_offset)); | 736 __ Ldr(value, MemOperand(fp, parameter_offset)); |
735 // Store it in the context. | 737 // Store it in the context. |
736 MemOperand target = ContextMemOperand(cp, var->index()); | 738 MemOperand target = ContextMemOperand(cp, var->index()); |
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6085 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6087 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6086 __ Push(scope_info); | 6088 __ Push(scope_info); |
6087 __ Push(ToRegister(instr->function())); | 6089 __ Push(ToRegister(instr->function())); |
6088 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6090 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6089 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6091 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6090 } | 6092 } |
6091 | 6093 |
6092 | 6094 |
6093 | 6095 |
6094 } } // namespace v8::internal | 6096 } } // namespace v8::internal |
OLD | NEW |