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

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

Powered by Google App Engine
This is Rietveld 408576698