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

Side by Side Diff: src/full-codegen/ppc/full-codegen-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 function_in_register_r4 = false; 202 function_in_register_r4 = false;
203 // Context is returned in r3. It replaces the context passed to us. 203 // Context is returned in r3. It replaces the context passed to us.
204 // It's saved in the stack and kept live in cp. 204 // It's saved in the stack and kept live in cp.
205 __ mr(cp, r3); 205 __ mr(cp, r3);
206 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); 206 __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset));
207 // Copy any necessary parameters into the context. 207 // Copy any necessary parameters into the context.
208 int num_parameters = info->scope()->num_parameters(); 208 int num_parameters = info->scope()->num_parameters();
209 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; 209 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
210 for (int i = first_parameter; i < num_parameters; i++) { 210 for (int i = first_parameter; i < num_parameters; i++) {
211 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); 211 Variable* var =
212 (i == -1) ? info->scope()->receiver() : info->scope()->parameter(i);
212 if (var->IsContextSlot()) { 213 if (var->IsContextSlot()) {
213 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 214 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
214 (num_parameters - 1 - i) * kPointerSize; 215 (num_parameters - 1 - i) * kPointerSize;
215 // Load parameter from stack. 216 // Load parameter from stack.
216 __ LoadP(r3, MemOperand(fp, parameter_offset), r0); 217 __ LoadP(r3, MemOperand(fp, parameter_offset), r0);
217 // Store it in the context. 218 // Store it in the context.
218 MemOperand target = ContextMemOperand(cp, var->index()); 219 MemOperand target = ContextMemOperand(cp, var->index());
219 __ StoreP(r3, target, r0); 220 __ StoreP(r3, target, r0);
220 221
221 // Update the write barrier. 222 // Update the write barrier.
(...skipping 11 matching lines...) Expand all
233 } 234 }
234 235
235 // Register holding this function and new target are both trashed in case we 236 // Register holding this function and new target are both trashed in case we
236 // bailout here. But since that can happen only when new target is not used 237 // bailout here. But since that can happen only when new target is not used
237 // and we allocate a context, the value of |function_in_register| is correct. 238 // and we allocate a context, the value of |function_in_register| is correct.
238 PrepareForBailoutForId(BailoutId::FunctionContext(), 239 PrepareForBailoutForId(BailoutId::FunctionContext(),
239 BailoutState::NO_REGISTERS); 240 BailoutState::NO_REGISTERS);
240 241
241 // Possibly set up a local binding to the this function which is used in 242 // Possibly set up a local binding to the this function which is used in
242 // derived constructors with super calls. 243 // derived constructors with super calls.
243 Variable* this_function_var = scope()->this_function_var(); 244 Variable* this_function_var = info->scope()->this_function_var();
244 if (this_function_var != nullptr) { 245 if (this_function_var != nullptr) {
245 Comment cmnt(masm_, "[ This function"); 246 Comment cmnt(masm_, "[ This function");
246 if (!function_in_register_r4) { 247 if (!function_in_register_r4) {
247 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 248 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
248 // The write barrier clobbers register again, keep it marked as such. 249 // The write barrier clobbers register again, keep it marked as such.
249 } 250 }
250 SetVar(this_function_var, r4, r3, r5); 251 SetVar(this_function_var, r4, r3, r5);
251 } 252 }
252 253
253 // Possibly set up a local binding to the new target value. 254 // Possibly set up a local binding to the new target value.
254 Variable* new_target_var = scope()->new_target_var(); 255 Variable* new_target_var = info->scope()->new_target_var();
255 if (new_target_var != nullptr) { 256 if (new_target_var != nullptr) {
256 Comment cmnt(masm_, "[ new.target"); 257 Comment cmnt(masm_, "[ new.target");
257 SetVar(new_target_var, r6, r3, r5); 258 SetVar(new_target_var, r6, r3, r5);
258 } 259 }
259 260
260 // Possibly allocate RestParameters 261 // Possibly allocate RestParameters
261 int rest_index; 262 int rest_index;
262 Variable* rest_param = scope()->rest_parameter(&rest_index); 263 Variable* rest_param = info->scope()->rest_parameter(&rest_index);
263 if (rest_param) { 264 if (rest_param) {
264 Comment cmnt(masm_, "[ Allocate rest parameter array"); 265 Comment cmnt(masm_, "[ Allocate rest parameter array");
265 if (!function_in_register_r4) { 266 if (!function_in_register_r4) {
266 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 267 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
267 } 268 }
268 FastNewRestParameterStub stub(isolate()); 269 FastNewRestParameterStub stub(isolate());
269 __ CallStub(&stub); 270 __ CallStub(&stub);
270 function_in_register_r4 = false; 271 function_in_register_r4 = false;
271 SetVar(rest_param, r3, r4, r5); 272 SetVar(rest_param, r3, r4, r5);
272 } 273 }
273 274
274 Variable* arguments = scope()->arguments(); 275 Variable* arguments = info->scope()->arguments();
275 if (arguments != NULL) { 276 if (arguments != NULL) {
276 // Function uses arguments object. 277 // Function uses arguments object.
277 Comment cmnt(masm_, "[ Allocate arguments object"); 278 Comment cmnt(masm_, "[ Allocate arguments object");
278 if (!function_in_register_r4) { 279 if (!function_in_register_r4) {
279 // Load this again, if it's used by the local context below. 280 // Load this again, if it's used by the local context below.
280 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 281 __ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
281 } 282 }
282 if (is_strict(language_mode()) || !has_simple_parameters()) { 283 if (is_strict(language_mode()) || !has_simple_parameters()) {
283 FastNewStrictArgumentsStub stub(isolate()); 284 FastNewStrictArgumentsStub stub(isolate());
284 __ CallStub(&stub); 285 __ CallStub(&stub);
(...skipping 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 __ StoreP(value, MemOperand(fp, frame_offset), r0); 3611 __ StoreP(value, MemOperand(fp, frame_offset), r0);
3611 } 3612 }
3612 3613
3613 3614
3614 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 3615 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
3615 __ LoadP(dst, ContextMemOperand(cp, context_index), r0); 3616 __ LoadP(dst, ContextMemOperand(cp, context_index), r0);
3616 } 3617 }
3617 3618
3618 3619
3619 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 3620 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
3620 Scope* closure_scope = scope()->ClosureScope(); 3621 DeclarationScope* closure_scope = scope()->GetClosureScope();
3621 if (closure_scope->is_script_scope() || 3622 if (closure_scope->is_script_scope() ||
3622 closure_scope->is_module_scope()) { 3623 closure_scope->is_module_scope()) {
3623 // Contexts nested in the native context have a canonical empty function 3624 // Contexts nested in the native context have a canonical empty function
3624 // as their closure, not the anonymous closure containing the global 3625 // as their closure, not the anonymous closure containing the global
3625 // code. 3626 // code.
3626 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip); 3627 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, ip);
3627 } else if (closure_scope->is_eval_scope()) { 3628 } else if (closure_scope->is_eval_scope()) {
3628 // Contexts created by a call to eval have the same closure as the 3629 // Contexts created by a call to eval have the same closure as the
3629 // context calling eval, not the anonymous closure containing the eval 3630 // context calling eval, not the anonymous closure containing the eval
3630 // code. Fetch it from the context. 3631 // code. Fetch it from the context.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 3767
3767 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); 3768 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address)));
3768 3769
3769 DCHECK(interrupt_address == 3770 DCHECK(interrupt_address ==
3770 isolate->builtins()->OnStackReplacement()->entry()); 3771 isolate->builtins()->OnStackReplacement()->entry());
3771 return ON_STACK_REPLACEMENT; 3772 return ON_STACK_REPLACEMENT;
3772 } 3773 }
3773 } // namespace internal 3774 } // namespace internal
3774 } // namespace v8 3775 } // namespace v8
3775 #endif // V8_TARGET_ARCH_PPC 3776 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698