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

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

Issue 1130733003: Resolve references to "this" the same way as normal variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add mips/mips64. Fix expectation in nosnap deserialization test. Fix scratch regiser use on x64. 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/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('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 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (strlen(FLAG_stop_at) > 0 && 118 if (strlen(FLAG_stop_at) > 0 &&
119 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 119 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
120 __ Debug("stop-at", __LINE__, BREAK); 120 __ Debug("stop-at", __LINE__, BREAK);
121 } 121 }
122 #endif 122 #endif
123 123
124 // Sloppy mode functions and builtins need to replace the receiver with the 124 // Sloppy mode functions and builtins need to replace the receiver with the
125 // global proxy when called as functions (without an explicit receiver 125 // global proxy when called as functions (without an explicit receiver
126 // object). 126 // object).
127 if (is_sloppy(info->language_mode()) && !info->is_native() && 127 if (is_sloppy(info->language_mode()) && !info->is_native() &&
128 info->MayUseThis()) { 128 info->MayUseThis() && info->scope()->has_this_declaration()) {
129 Label ok; 129 Label ok;
130 int receiver_offset = info->scope()->num_parameters() * kXRegSize; 130 int receiver_offset = info->scope()->num_parameters() * kXRegSize;
131 __ Peek(x10, receiver_offset); 131 __ Peek(x10, receiver_offset);
132 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok); 132 __ JumpIfNotRoot(x10, Heap::kUndefinedValueRootIndex, &ok);
133 133
134 __ Ldr(x10, GlobalObjectMemOperand()); 134 __ Ldr(x10, GlobalObjectMemOperand());
135 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset)); 135 __ Ldr(x10, FieldMemOperand(x10, GlobalObject::kGlobalProxyOffset));
136 __ Poke(x10, receiver_offset); 136 __ Poke(x10, receiver_offset);
137 137
138 __ Bind(&ok); 138 __ Bind(&ok);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 __ Push(x1); 210 __ Push(x1);
211 __ CallRuntime(Runtime::kNewFunctionContext, 1); 211 __ CallRuntime(Runtime::kNewFunctionContext, 1);
212 } 212 }
213 function_in_register_x1 = false; 213 function_in_register_x1 = false;
214 // Context is returned in x0. It replaces the context passed to us. 214 // Context is returned in x0. It replaces the context passed to us.
215 // It's saved in the stack and kept live in cp. 215 // It's saved in the stack and kept live in cp.
216 __ Mov(cp, x0); 216 __ Mov(cp, x0);
217 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 217 __ Str(x0, MemOperand(fp, StandardFrameConstants::kContextOffset));
218 // Copy any necessary parameters into the context. 218 // Copy any necessary parameters into the context.
219 int num_parameters = info->scope()->num_parameters(); 219 int num_parameters = info->scope()->num_parameters();
220 for (int i = 0; i < num_parameters; i++) { 220 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
221 Variable* var = scope()->parameter(i); 221 for (int i = first_parameter; i < num_parameters; i++) {
222 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
222 if (var->IsContextSlot()) { 223 if (var->IsContextSlot()) {
223 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 224 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
224 (num_parameters - 1 - i) * kPointerSize; 225 (num_parameters - 1 - i) * kPointerSize;
225 // Load parameter from stack. 226 // Load parameter from stack.
226 __ Ldr(x10, MemOperand(fp, parameter_offset)); 227 __ Ldr(x10, MemOperand(fp, parameter_offset));
227 // Store it in the context. 228 // Store it in the context.
228 MemOperand target = ContextMemOperand(cp, var->index()); 229 MemOperand target = ContextMemOperand(cp, var->index());
229 __ Str(x10, target); 230 __ Str(x10, target);
230 231
231 // Update the write barrier. 232 // Update the write barrier.
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 // Prepare to push a copy of the first argument or undefined if it doesn't 2745 // Prepare to push a copy of the first argument or undefined if it doesn't
2745 // exist. 2746 // exist.
2746 if (arg_count > 0) { 2747 if (arg_count > 0) {
2747 __ Peek(x9, arg_count * kXRegSize); 2748 __ Peek(x9, arg_count * kXRegSize);
2748 } else { 2749 } else {
2749 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex); 2750 __ LoadRoot(x9, Heap::kUndefinedValueRootIndex);
2750 } 2751 }
2751 2752
2752 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2753 __ Ldr(x10, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2753 // Prepare to push the receiver of the enclosing function. 2754 // Prepare to push the receiver of the enclosing function.
2754 int receiver_offset = 2 + info_->scope()->num_parameters(); 2755 Variable* this_var = scope()->LookupThis();
2755 __ Ldr(x11, MemOperand(fp, receiver_offset * kPointerSize)); 2756 DCHECK_NOT_NULL(this_var);
2757 __ Ldr(x11, VarOperand(this_var, x11));
2756 2758
2757 // Prepare to push the language mode. 2759 // Prepare to push the language mode.
2758 __ Mov(x12, Smi::FromInt(language_mode())); 2760 __ Mov(x12, Smi::FromInt(language_mode()));
2759 // Prepare to push the start position of the scope the calls resides in. 2761 // Prepare to push the start position of the scope the calls resides in.
2760 __ Mov(x13, Smi::FromInt(scope()->start_position())); 2762 __ Mov(x13, Smi::FromInt(scope()->start_position()));
2761 2763
2762 // Push. 2764 // Push.
2763 __ Push(x9, x10, x11, x12, x13); 2765 __ Push(x9, x10, x11, x12, x13);
2764 2766
2765 // Do the runtime call. 2767 // Do the runtime call.
(...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after
5478 } 5480 }
5479 } 5481 }
5480 5482
5481 return INTERRUPT; 5483 return INTERRUPT;
5482 } 5484 }
5483 5485
5484 5486
5485 } } // namespace v8::internal 5487 } } // namespace v8::internal
5486 5488
5487 #endif // V8_TARGET_ARCH_ARM64 5489 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698