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

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

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mjsunit/debug-scopes: Skip "this" the same as "arguments" Created 5 years, 10 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 | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/ast.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 7 #if V8_TARGET_ARCH_ARM
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 #ifdef DEBUG 119 #ifdef DEBUG
120 if (strlen(FLAG_stop_at) > 0 && 120 if (strlen(FLAG_stop_at) > 0 &&
121 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 121 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
122 __ stop("stop-at"); 122 __ stop("stop-at");
123 } 123 }
124 #endif 124 #endif
125 125
126 // Sloppy mode functions and builtins need to replace the receiver with the 126 // Sloppy mode functions and builtins need to replace the receiver with the
127 // global proxy when called as functions (without an explicit receiver 127 // global proxy when called as functions (without an explicit receiver
128 // object). 128 // object).
129 if (info->strict_mode() == SLOPPY && !info->is_native()) { 129 if (info->strict_mode() == SLOPPY && !info->is_native() &&
130 info->scope()->has_this_declaration()) {
130 Label ok; 131 Label ok;
131 int receiver_offset = info->scope()->num_parameters() * kPointerSize; 132 int receiver_offset = info->scope()->num_parameters() * kPointerSize;
132 __ ldr(r2, MemOperand(sp, receiver_offset)); 133 __ ldr(r2, MemOperand(sp, receiver_offset));
133 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); 134 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
134 __ b(ne, &ok); 135 __ b(ne, &ok);
135 136
136 __ ldr(r2, GlobalObjectOperand()); 137 __ ldr(r2, GlobalObjectOperand());
137 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalProxyOffset)); 138 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalProxyOffset));
138 139
139 __ str(r2, MemOperand(sp, receiver_offset)); 140 __ str(r2, MemOperand(sp, receiver_offset));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 __ push(r1); 209 __ push(r1);
209 __ CallRuntime(Runtime::kNewFunctionContext, 1); 210 __ CallRuntime(Runtime::kNewFunctionContext, 1);
210 } 211 }
211 function_in_register = false; 212 function_in_register = false;
212 // Context is returned in r0. It replaces the context passed to us. 213 // Context is returned in r0. It replaces the context passed to us.
213 // It's saved in the stack and kept live in cp. 214 // It's saved in the stack and kept live in cp.
214 __ mov(cp, r0); 215 __ mov(cp, r0);
215 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 216 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset));
216 // Copy any necessary parameters into the context. 217 // Copy any necessary parameters into the context.
217 int num_parameters = info->scope()->num_parameters(); 218 int num_parameters = info->scope()->num_parameters();
218 for (int i = 0; i < num_parameters; i++) { 219 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
219 Variable* var = scope()->parameter(i); 220 for (int i = first_parameter; i < num_parameters; i++) {
221 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
220 if (var->IsContextSlot()) { 222 if (var->IsContextSlot()) {
221 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 223 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
222 (num_parameters - 1 - i) * kPointerSize; 224 (num_parameters - 1 - i) * kPointerSize;
223 // Load parameter from stack. 225 // Load parameter from stack.
224 __ ldr(r0, MemOperand(fp, parameter_offset)); 226 __ ldr(r0, MemOperand(fp, parameter_offset));
225 // Store it in the context. 227 // Store it in the context.
226 MemOperand target = ContextOperand(cp, var->index()); 228 MemOperand target = ContextOperand(cp, var->index());
227 __ str(r0, target); 229 __ str(r0, target);
228 230
229 // Update the write barrier. 231 // Update the write barrier.
(...skipping 5175 matching lines...) Expand 10 before | Expand all | Expand 10 after
5405 5407
5406 DCHECK(interrupt_address == 5408 DCHECK(interrupt_address ==
5407 isolate->builtins()->OsrAfterStackCheck()->entry()); 5409 isolate->builtins()->OsrAfterStackCheck()->entry());
5408 return OSR_AFTER_STACK_CHECK; 5410 return OSR_AFTER_STACK_CHECK;
5409 } 5411 }
5410 5412
5411 5413
5412 } } // namespace v8::internal 5414 } } // namespace v8::internal
5413 5415
5414 #endif // V8_TARGET_ARCH_ARM 5416 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/ast.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698