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

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

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

Powered by Google App Engine
This is Rietveld 408576698