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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 662 |
663 if (info()->IsOptimizing()) { | 663 if (info()->IsOptimizing()) { |
664 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 664 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
665 | 665 |
666 // TODO(all): Add support for stop_t FLAG in DEBUG mode. | 666 // TODO(all): Add support for stop_t FLAG in DEBUG mode. |
667 | 667 |
668 // Sloppy mode functions and builtins need to replace the receiver with the | 668 // Sloppy mode functions and builtins need to replace the receiver with the |
669 // global proxy when called as functions (without an explicit receiver | 669 // global proxy when called as functions (without an explicit receiver |
670 // object). | 670 // object). |
671 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && | 671 if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && |
672 !info()->is_native() && info()->scope()->has_this_declaration()) { | 672 !info_->is_native()) { |
673 Label ok; | 673 Label ok; |
674 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; | 674 int receiver_offset = info_->scope()->num_parameters() * kXRegSize; |
675 __ Peek(x10, receiver_offset); | 675 __ Peek(x10, receiver_offset); |
676 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); | 676 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); |
677 | 677 |
678 __ Ldr(x10, GlobalObjectMemOperand()); | 678 __ Ldr(x10, GlobalObjectMemOperand()); |
679 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); | 679 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); |
680 __ Poke(x10, receiver_offset); | 680 __ Poke(x10, receiver_offset); |
681 | 681 |
682 __ Bind(&ok); | 682 __ Bind(&ok); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 __ Push(x1); | 721 __ Push(x1); |
722 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 722 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
723 } | 723 } |
724 RecordSafepoint(Safepoint::kNoLazyDeopt); | 724 RecordSafepoint(Safepoint::kNoLazyDeopt); |
725 // Context is returned in x0. It replaces the context passed to us. It's | 725 // Context is returned in x0. It replaces the context passed to us. It's |
726 // saved in the stack and kept live in cp. | 726 // saved in the stack and kept live in cp. |
727 __ Mov(cp, x0); | 727 __ Mov(cp, x0); |
728 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 728 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
729 // Copy any necessary parameters into the context. | 729 // Copy any necessary parameters into the context. |
730 int num_parameters = scope()->num_parameters(); | 730 int num_parameters = scope()->num_parameters(); |
731 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 731 for (int i = 0; i < num_parameters; i++) { |
732 for (int i = first_parameter; i < num_parameters; i++) { | 732 Variable* var = scope()->parameter(i); |
733 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | |
734 if (var->IsContextSlot()) { | 733 if (var->IsContextSlot()) { |
735 Register value = x0; | 734 Register value = x0; |
736 Register scratch = x3; | 735 Register scratch = x3; |
737 | 736 |
738 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 737 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
739 (num_parameters - 1 - i) * kPointerSize; | 738 (num_parameters - 1 - i) * kPointerSize; |
740 // Load parameter from stack. | 739 // Load parameter from stack. |
741 __ Ldr(value, MemOperand(fp, parameter_offset)); | 740 __ Ldr(value, MemOperand(fp, parameter_offset)); |
742 // Store it in the context. | 741 // Store it in the context. |
743 MemOperand target = ContextMemOperand(cp, var->index()); | 742 MemOperand target = ContextMemOperand(cp, var->index()); |
(...skipping 5360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6104 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6103 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6105 __ Push(scope_info); | 6104 __ Push(scope_info); |
6106 __ Push(ToRegister(instr->function())); | 6105 __ Push(ToRegister(instr->function())); |
6107 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6106 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6108 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6107 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6109 } | 6108 } |
6110 | 6109 |
6111 | 6110 |
6112 | 6111 |
6113 } } // namespace v8::internal | 6112 } } // namespace v8::internal |
OLD | NEW |