Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: src/arm64/lithium-codegen-arm64.cc

Issue 1136073002: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: "this" should never be looked up dynamically Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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()) { 672 !info()->is_native() && info()->scope()->has_this_declaration()) {
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
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 for (int i = 0; i < num_parameters; i++) { 731 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
732 Variable* var = scope()->parameter(i); 732 for (int i = first_parameter; i < num_parameters; i++) {
733 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
733 if (var->IsContextSlot()) { 734 if (var->IsContextSlot()) {
734 Register value = x0; 735 Register value = x0;
735 Register scratch = x3; 736 Register scratch = x3;
736 737
737 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 738 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
738 (num_parameters - 1 - i) * kPointerSize; 739 (num_parameters - 1 - i) * kPointerSize;
739 // Load parameter from stack. 740 // Load parameter from stack.
740 __ Ldr(value, MemOperand(fp, parameter_offset)); 741 __ Ldr(value, MemOperand(fp, parameter_offset));
741 // Store it in the context. 742 // Store it in the context.
742 MemOperand target = ContextMemOperand(cp, var->index()); 743 MemOperand target = ContextMemOperand(cp, var->index());
(...skipping 5306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6049 Handle<ScopeInfo> scope_info = instr->scope_info(); 6050 Handle<ScopeInfo> scope_info = instr->scope_info();
6050 __ Push(scope_info); 6051 __ Push(scope_info);
6051 __ Push(ToRegister(instr->function())); 6052 __ Push(ToRegister(instr->function()));
6052 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6053 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6053 RecordSafepoint(Safepoint::kNoLazyDeopt); 6054 RecordSafepoint(Safepoint::kNoLazyDeopt);
6054 } 6055 }
6055 6056
6056 6057
6057 6058
6058 } } // namespace v8::internal 6059 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698