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

Side by Side Diff: src/full-codegen/s390/full-codegen-s390.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_S390 5 #if V8_TARGET_ARCH_S390
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 function_in_register_r3 = false; 207 function_in_register_r3 = false;
208 // Context is returned in r2. It replaces the context passed to us. 208 // Context is returned in r2. It replaces the context passed to us.
209 // It's saved in the stack and kept live in cp. 209 // It's saved in the stack and kept live in cp.
210 __ LoadRR(cp, r2); 210 __ LoadRR(cp, r2);
211 __ StoreP(r2, MemOperand(fp, StandardFrameConstants::kContextOffset)); 211 __ StoreP(r2, MemOperand(fp, StandardFrameConstants::kContextOffset));
212 // Copy any necessary parameters into the context. 212 // Copy any necessary parameters into the context.
213 int num_parameters = info->scope()->num_parameters(); 213 int num_parameters = info->scope()->num_parameters();
214 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; 214 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
215 for (int i = first_parameter; i < num_parameters; i++) { 215 for (int i = first_parameter; i < num_parameters; i++) {
216 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); 216 Variable* var =
217 (i == -1) ? info->scope()->receiver() : info->scope()->parameter(i);
217 if (var->IsContextSlot()) { 218 if (var->IsContextSlot()) {
218 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 219 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
219 (num_parameters - 1 - i) * kPointerSize; 220 (num_parameters - 1 - i) * kPointerSize;
220 // Load parameter from stack. 221 // Load parameter from stack.
221 __ LoadP(r2, MemOperand(fp, parameter_offset), r0); 222 __ LoadP(r2, MemOperand(fp, parameter_offset), r0);
222 // Store it in the context. 223 // Store it in the context.
223 MemOperand target = ContextMemOperand(cp, var->index()); 224 MemOperand target = ContextMemOperand(cp, var->index());
224 __ StoreP(r2, target); 225 __ StoreP(r2, target);
225 226
226 // Update the write barrier. 227 // Update the write barrier.
(...skipping 11 matching lines...) Expand all
238 } 239 }
239 240
240 // Register holding this function and new target are both trashed in case we 241 // Register holding this function and new target are both trashed in case we
241 // bailout here. But since that can happen only when new target is not used 242 // bailout here. But since that can happen only when new target is not used
242 // and we allocate a context, the value of |function_in_register| is correct. 243 // and we allocate a context, the value of |function_in_register| is correct.
243 PrepareForBailoutForId(BailoutId::FunctionContext(), 244 PrepareForBailoutForId(BailoutId::FunctionContext(),
244 BailoutState::NO_REGISTERS); 245 BailoutState::NO_REGISTERS);
245 246
246 // Possibly set up a local binding to the this function which is used in 247 // Possibly set up a local binding to the this function which is used in
247 // derived constructors with super calls. 248 // derived constructors with super calls.
248 Variable* this_function_var = scope()->this_function_var(); 249 Variable* this_function_var = info->scope()->this_function_var();
249 if (this_function_var != nullptr) { 250 if (this_function_var != nullptr) {
250 Comment cmnt(masm_, "[ This function"); 251 Comment cmnt(masm_, "[ This function");
251 if (!function_in_register_r3) { 252 if (!function_in_register_r3) {
252 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 253 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
253 // The write barrier clobbers register again, keep it marked as such. 254 // The write barrier clobbers register again, keep it marked as such.
254 } 255 }
255 SetVar(this_function_var, r3, r2, r4); 256 SetVar(this_function_var, r3, r2, r4);
256 } 257 }
257 258
258 // Possibly set up a local binding to the new target value. 259 // Possibly set up a local binding to the new target value.
259 Variable* new_target_var = scope()->new_target_var(); 260 Variable* new_target_var = info->scope()->new_target_var();
260 if (new_target_var != nullptr) { 261 if (new_target_var != nullptr) {
261 Comment cmnt(masm_, "[ new.target"); 262 Comment cmnt(masm_, "[ new.target");
262 SetVar(new_target_var, r5, r2, r4); 263 SetVar(new_target_var, r5, r2, r4);
263 } 264 }
264 265
265 // Possibly allocate RestParameters 266 // Possibly allocate RestParameters
266 int rest_index; 267 int rest_index;
267 Variable* rest_param = scope()->rest_parameter(&rest_index); 268 Variable* rest_param = info->scope()->rest_parameter(&rest_index);
268 if (rest_param) { 269 if (rest_param) {
269 Comment cmnt(masm_, "[ Allocate rest parameter array"); 270 Comment cmnt(masm_, "[ Allocate rest parameter array");
270 271
271 if (!function_in_register_r3) { 272 if (!function_in_register_r3) {
272 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 273 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
273 } 274 }
274 FastNewRestParameterStub stub(isolate()); 275 FastNewRestParameterStub stub(isolate());
275 __ CallStub(&stub); 276 __ CallStub(&stub);
276 277
277 function_in_register_r3 = false; 278 function_in_register_r3 = false;
278 SetVar(rest_param, r2, r3, r4); 279 SetVar(rest_param, r2, r3, r4);
279 } 280 }
280 281
281 Variable* arguments = scope()->arguments(); 282 Variable* arguments = info->scope()->arguments();
282 if (arguments != NULL) { 283 if (arguments != NULL) {
283 // Function uses arguments object. 284 // Function uses arguments object.
284 Comment cmnt(masm_, "[ Allocate arguments object"); 285 Comment cmnt(masm_, "[ Allocate arguments object");
285 if (!function_in_register_r3) { 286 if (!function_in_register_r3) {
286 // Load this again, if it's used by the local context below. 287 // Load this again, if it's used by the local context below.
287 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 288 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
288 } 289 }
289 if (is_strict(language_mode()) || !has_simple_parameters()) { 290 if (is_strict(language_mode()) || !has_simple_parameters()) {
290 FastNewStrictArgumentsStub stub(isolate()); 291 FastNewStrictArgumentsStub stub(isolate());
291 __ CallStub(&stub); 292 __ CallStub(&stub);
(...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { 3519 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) {
3519 DCHECK_EQ(static_cast<int>(POINTER_SIZE_ALIGN(frame_offset)), frame_offset); 3520 DCHECK_EQ(static_cast<int>(POINTER_SIZE_ALIGN(frame_offset)), frame_offset);
3520 __ StoreP(value, MemOperand(fp, frame_offset)); 3521 __ StoreP(value, MemOperand(fp, frame_offset));
3521 } 3522 }
3522 3523
3523 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 3524 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
3524 __ LoadP(dst, ContextMemOperand(cp, context_index), r0); 3525 __ LoadP(dst, ContextMemOperand(cp, context_index), r0);
3525 } 3526 }
3526 3527
3527 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 3528 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
3528 Scope* closure_scope = scope()->ClosureScope(); 3529 DeclarationScope* closure_scope = scope()->GetClosureScope();
3529 if (closure_scope->is_script_scope() || closure_scope->is_module_scope()) { 3530 if (closure_scope->is_script_scope() || closure_scope->is_module_scope()) {
3530 // Contexts nested in the native context have a canonical empty function 3531 // Contexts nested in the native context have a canonical empty function
3531 // as their closure, not the anonymous closure containing the global 3532 // as their closure, not the anonymous closure containing the global
3532 // code. 3533 // code.
3533 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip); 3534 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip);
3534 } else if (closure_scope->is_eval_scope()) { 3535 } else if (closure_scope->is_eval_scope()) {
3535 // Contexts created by a call to eval have the same closure as the 3536 // Contexts created by a call to eval have the same closure as the
3536 // context calling eval, not the anonymous closure containing the eval 3537 // context calling eval, not the anonymous closure containing the eval
3537 // code. Fetch it from the context. 3538 // code. Fetch it from the context.
3538 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); 3539 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 DCHECK(kOSRBranchInstruction == br_instr); 3679 DCHECK(kOSRBranchInstruction == br_instr);
3679 3680
3680 DCHECK(interrupt_address == 3681 DCHECK(interrupt_address ==
3681 isolate->builtins()->OnStackReplacement()->entry()); 3682 isolate->builtins()->OnStackReplacement()->entry());
3682 return ON_STACK_REPLACEMENT; 3683 return ON_STACK_REPLACEMENT;
3683 } 3684 }
3684 3685
3685 } // namespace internal 3686 } // namespace internal
3686 } // namespace v8 3687 } // namespace v8
3687 #endif // V8_TARGET_ARCH_S390 3688 #endif // V8_TARGET_ARCH_S390
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698