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/full-codegen/arm/full-codegen-arm.cc

Issue 2212383003: Revert of Separate Scope into DeclarationScope and Scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/crankshaft/x87/lithium-codegen-x87.cc ('k') | src/full-codegen/arm64/full-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 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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 function_in_register_r1 = false; 196 function_in_register_r1 = false;
197 // Context is returned in r0. It replaces the context passed to us. 197 // Context is returned in r0. It replaces the context passed to us.
198 // It's saved in the stack and kept live in cp. 198 // It's saved in the stack and kept live in cp.
199 __ mov(cp, r0); 199 __ mov(cp, r0);
200 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 200 __ str(r0, MemOperand(fp, StandardFrameConstants::kContextOffset));
201 // Copy any necessary parameters into the context. 201 // Copy any necessary parameters into the context.
202 int num_parameters = info->scope()->num_parameters(); 202 int num_parameters = info->scope()->num_parameters();
203 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; 203 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
204 for (int i = first_parameter; i < num_parameters; i++) { 204 for (int i = first_parameter; i < num_parameters; i++) {
205 Variable* var = 205 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
206 (i == -1) ? info->scope()->receiver() : info->scope()->parameter(i);
207 if (var->IsContextSlot()) { 206 if (var->IsContextSlot()) {
208 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 207 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
209 (num_parameters - 1 - i) * kPointerSize; 208 (num_parameters - 1 - i) * kPointerSize;
210 // Load parameter from stack. 209 // Load parameter from stack.
211 __ ldr(r0, MemOperand(fp, parameter_offset)); 210 __ ldr(r0, MemOperand(fp, parameter_offset));
212 // Store it in the context. 211 // Store it in the context.
213 MemOperand target = ContextMemOperand(cp, var->index()); 212 MemOperand target = ContextMemOperand(cp, var->index());
214 __ str(r0, target); 213 __ str(r0, target);
215 214
216 // Update the write barrier. 215 // Update the write barrier.
(...skipping 11 matching lines...) Expand all
228 } 227 }
229 228
230 // Register holding this function and new target are both trashed in case we 229 // Register holding this function and new target are both trashed in case we
231 // bailout here. But since that can happen only when new target is not used 230 // bailout here. But since that can happen only when new target is not used
232 // and we allocate a context, the value of |function_in_register| is correct. 231 // and we allocate a context, the value of |function_in_register| is correct.
233 PrepareForBailoutForId(BailoutId::FunctionContext(), 232 PrepareForBailoutForId(BailoutId::FunctionContext(),
234 BailoutState::NO_REGISTERS); 233 BailoutState::NO_REGISTERS);
235 234
236 // Possibly set up a local binding to the this function which is used in 235 // Possibly set up a local binding to the this function which is used in
237 // derived constructors with super calls. 236 // derived constructors with super calls.
238 Variable* this_function_var = info->scope()->this_function_var(); 237 Variable* this_function_var = scope()->this_function_var();
239 if (this_function_var != nullptr) { 238 if (this_function_var != nullptr) {
240 Comment cmnt(masm_, "[ This function"); 239 Comment cmnt(masm_, "[ This function");
241 if (!function_in_register_r1) { 240 if (!function_in_register_r1) {
242 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 241 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
243 // The write barrier clobbers register again, keep it marked as such. 242 // The write barrier clobbers register again, keep it marked as such.
244 } 243 }
245 SetVar(this_function_var, r1, r0, r2); 244 SetVar(this_function_var, r1, r0, r2);
246 } 245 }
247 246
248 // Possibly set up a local binding to the new target value. 247 // Possibly set up a local binding to the new target value.
249 Variable* new_target_var = info->scope()->new_target_var(); 248 Variable* new_target_var = scope()->new_target_var();
250 if (new_target_var != nullptr) { 249 if (new_target_var != nullptr) {
251 Comment cmnt(masm_, "[ new.target"); 250 Comment cmnt(masm_, "[ new.target");
252 SetVar(new_target_var, r3, r0, r2); 251 SetVar(new_target_var, r3, r0, r2);
253 } 252 }
254 253
255 // Possibly allocate RestParameters 254 // Possibly allocate RestParameters
256 int rest_index; 255 int rest_index;
257 Variable* rest_param = info->scope()->rest_parameter(&rest_index); 256 Variable* rest_param = scope()->rest_parameter(&rest_index);
258 if (rest_param) { 257 if (rest_param) {
259 Comment cmnt(masm_, "[ Allocate rest parameter array"); 258 Comment cmnt(masm_, "[ Allocate rest parameter array");
260 if (!function_in_register_r1) { 259 if (!function_in_register_r1) {
261 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 260 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
262 } 261 }
263 FastNewRestParameterStub stub(isolate()); 262 FastNewRestParameterStub stub(isolate());
264 __ CallStub(&stub); 263 __ CallStub(&stub);
265 function_in_register_r1 = false; 264 function_in_register_r1 = false;
266 SetVar(rest_param, r0, r1, r2); 265 SetVar(rest_param, r0, r1, r2);
267 } 266 }
268 267
269 Variable* arguments = info->scope()->arguments(); 268 Variable* arguments = scope()->arguments();
270 if (arguments != NULL) { 269 if (arguments != NULL) {
271 // Function uses arguments object. 270 // Function uses arguments object.
272 Comment cmnt(masm_, "[ Allocate arguments object"); 271 Comment cmnt(masm_, "[ Allocate arguments object");
273 if (!function_in_register_r1) { 272 if (!function_in_register_r1) {
274 // Load this again, if it's used by the local context below. 273 // Load this again, if it's used by the local context below.
275 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 274 __ ldr(r1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
276 } 275 }
277 if (is_strict(language_mode()) || !has_simple_parameters()) { 276 if (is_strict(language_mode()) || !has_simple_parameters()) {
278 FastNewStrictArgumentsStub stub(isolate()); 277 FastNewStrictArgumentsStub stub(isolate());
279 __ CallStub(&stub); 278 __ CallStub(&stub);
(...skipping 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 __ str(value, MemOperand(fp, frame_offset)); 3618 __ str(value, MemOperand(fp, frame_offset));
3620 } 3619 }
3621 3620
3622 3621
3623 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 3622 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
3624 __ ldr(dst, ContextMemOperand(cp, context_index)); 3623 __ ldr(dst, ContextMemOperand(cp, context_index));
3625 } 3624 }
3626 3625
3627 3626
3628 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 3627 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
3629 DeclarationScope* closure_scope = scope()->GetClosureScope(); 3628 Scope* closure_scope = scope()->ClosureScope();
3630 if (closure_scope->is_script_scope() || 3629 if (closure_scope->is_script_scope() ||
3631 closure_scope->is_module_scope()) { 3630 closure_scope->is_module_scope()) {
3632 // Contexts nested in the native context have a canonical empty function 3631 // Contexts nested in the native context have a canonical empty function
3633 // as their closure, not the anonymous closure containing the global 3632 // as their closure, not the anonymous closure containing the global
3634 // code. 3633 // code.
3635 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip); 3634 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip);
3636 } else if (closure_scope->is_eval_scope()) { 3635 } else if (closure_scope->is_eval_scope()) {
3637 // Contexts created by a call to eval have the same closure as the 3636 // Contexts created by a call to eval have the same closure as the
3638 // context calling eval, not the anonymous closure containing the eval 3637 // context calling eval, not the anonymous closure containing the eval
3639 // code. Fetch it from the context. 3638 // code. Fetch it from the context.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3846 DCHECK(interrupt_address == 3845 DCHECK(interrupt_address ==
3847 isolate->builtins()->OnStackReplacement()->entry()); 3846 isolate->builtins()->OnStackReplacement()->entry());
3848 return ON_STACK_REPLACEMENT; 3847 return ON_STACK_REPLACEMENT;
3849 } 3848 }
3850 3849
3851 3850
3852 } // namespace internal 3851 } // namespace internal
3853 } // namespace v8 3852 } // namespace v8
3854 3853
3855 #endif // V8_TARGET_ARCH_ARM 3854 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/crankshaft/x87/lithium-codegen-x87.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698