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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 function_in_register_a1 = false; 206 function_in_register_a1 = false;
207 // Context is returned in v0. It replaces the context passed to us. 207 // Context is returned in v0. It replaces the context passed to us.
208 // It's saved in the stack and kept live in cp. 208 // It's saved in the stack and kept live in cp.
209 __ mov(cp, v0); 209 __ mov(cp, v0);
210 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); 210 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset));
211 // Copy any necessary parameters into the context. 211 // Copy any necessary parameters into the context.
212 int num_parameters = info->scope()->num_parameters(); 212 int num_parameters = info->scope()->num_parameters();
213 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; 213 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
214 for (int i = first_parameter; i < num_parameters; i++) { 214 for (int i = first_parameter; i < num_parameters; i++) {
215 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); 215 Variable* var =
216 (i == -1) ? info->scope()->receiver() : info->scope()->parameter(i);
216 if (var->IsContextSlot()) { 217 if (var->IsContextSlot()) {
217 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 218 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
218 (num_parameters - 1 - i) * kPointerSize; 219 (num_parameters - 1 - i) * kPointerSize;
219 // Load parameter from stack. 220 // Load parameter from stack.
220 __ lw(a0, MemOperand(fp, parameter_offset)); 221 __ lw(a0, MemOperand(fp, parameter_offset));
221 // Store it in the context. 222 // Store it in the context.
222 MemOperand target = ContextMemOperand(cp, var->index()); 223 MemOperand target = ContextMemOperand(cp, var->index());
223 __ sw(a0, target); 224 __ sw(a0, target);
224 225
225 // Update the write barrier. 226 // Update the write barrier.
(...skipping 11 matching lines...) Expand all
237 } 238 }
238 239
239 // 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
240 // 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
241 // 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.
242 PrepareForBailoutForId(BailoutId::FunctionContext(), 243 PrepareForBailoutForId(BailoutId::FunctionContext(),
243 BailoutState::NO_REGISTERS); 244 BailoutState::NO_REGISTERS);
244 245
245 // 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
246 // derived constructors with super calls. 247 // derived constructors with super calls.
247 Variable* this_function_var = scope()->this_function_var(); 248 Variable* this_function_var = info->scope()->this_function_var();
248 if (this_function_var != nullptr) { 249 if (this_function_var != nullptr) {
249 Comment cmnt(masm_, "[ This function"); 250 Comment cmnt(masm_, "[ This function");
250 if (!function_in_register_a1) { 251 if (!function_in_register_a1) {
251 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 252 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
252 // The write barrier clobbers register again, keep it marked as such. 253 // The write barrier clobbers register again, keep it marked as such.
253 } 254 }
254 SetVar(this_function_var, a1, a0, a2); 255 SetVar(this_function_var, a1, a0, a2);
255 } 256 }
256 257
257 // Possibly set up a local binding to the new target value. 258 // Possibly set up a local binding to the new target value.
258 Variable* new_target_var = scope()->new_target_var(); 259 Variable* new_target_var = info->scope()->new_target_var();
259 if (new_target_var != nullptr) { 260 if (new_target_var != nullptr) {
260 Comment cmnt(masm_, "[ new.target"); 261 Comment cmnt(masm_, "[ new.target");
261 SetVar(new_target_var, a3, a0, a2); 262 SetVar(new_target_var, a3, a0, a2);
262 } 263 }
263 264
264 // Possibly allocate RestParameters 265 // Possibly allocate RestParameters
265 int rest_index; 266 int rest_index;
266 Variable* rest_param = scope()->rest_parameter(&rest_index); 267 Variable* rest_param = info->scope()->rest_parameter(&rest_index);
267 if (rest_param) { 268 if (rest_param) {
268 Comment cmnt(masm_, "[ Allocate rest parameter array"); 269 Comment cmnt(masm_, "[ Allocate rest parameter array");
269 if (!function_in_register_a1) { 270 if (!function_in_register_a1) {
270 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 271 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
271 } 272 }
272 FastNewRestParameterStub stub(isolate()); 273 FastNewRestParameterStub stub(isolate());
273 __ CallStub(&stub); 274 __ CallStub(&stub);
274 function_in_register_a1 = false; 275 function_in_register_a1 = false;
275 SetVar(rest_param, v0, a1, a2); 276 SetVar(rest_param, v0, a1, a2);
276 } 277 }
277 278
278 Variable* arguments = scope()->arguments(); 279 Variable* arguments = info->scope()->arguments();
279 if (arguments != NULL) { 280 if (arguments != NULL) {
280 // Function uses arguments object. 281 // Function uses arguments object.
281 Comment cmnt(masm_, "[ Allocate arguments object"); 282 Comment cmnt(masm_, "[ Allocate arguments object");
282 if (!function_in_register_a1) { 283 if (!function_in_register_a1) {
283 // Load this again, if it's used by the local context below. 284 // Load this again, if it's used by the local context below.
284 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 285 __ lw(a1, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
285 } 286 }
286 if (is_strict(language_mode()) || !has_simple_parameters()) { 287 if (is_strict(language_mode()) || !has_simple_parameters()) {
287 FastNewStrictArgumentsStub stub(isolate()); 288 FastNewStrictArgumentsStub stub(isolate());
288 __ CallStub(&stub); 289 __ CallStub(&stub);
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 __ sw(value, MemOperand(fp, frame_offset)); 3624 __ sw(value, MemOperand(fp, frame_offset));
3624 } 3625 }
3625 3626
3626 3627
3627 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 3628 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
3628 __ lw(dst, ContextMemOperand(cp, context_index)); 3629 __ lw(dst, ContextMemOperand(cp, context_index));
3629 } 3630 }
3630 3631
3631 3632
3632 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 3633 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
3633 Scope* closure_scope = scope()->ClosureScope(); 3634 DeclarationScope* closure_scope = scope()->GetClosureScope();
3634 if (closure_scope->is_script_scope() || 3635 if (closure_scope->is_script_scope() ||
3635 closure_scope->is_module_scope()) { 3636 closure_scope->is_module_scope()) {
3636 // Contexts nested in the native context have a canonical empty function 3637 // Contexts nested in the native context have a canonical empty function
3637 // as their closure, not the anonymous closure containing the global 3638 // as their closure, not the anonymous closure containing the global
3638 // code. 3639 // code.
3639 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, at); 3640 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, at);
3640 } else if (closure_scope->is_eval_scope()) { 3641 } else if (closure_scope->is_eval_scope()) {
3641 // Contexts created by a call to eval have the same closure as the 3642 // Contexts created by a call to eval have the same closure as the
3642 // context calling eval, not the anonymous closure containing the eval 3643 // context calling eval, not the anonymous closure containing the eval
3643 // code. Fetch it from the context. 3644 // code. Fetch it from the context.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 reinterpret_cast<uint32_t>( 3786 reinterpret_cast<uint32_t>(
3786 isolate->builtins()->OnStackReplacement()->entry())); 3787 isolate->builtins()->OnStackReplacement()->entry()));
3787 return ON_STACK_REPLACEMENT; 3788 return ON_STACK_REPLACEMENT;
3788 } 3789 }
3789 3790
3790 3791
3791 } // namespace internal 3792 } // namespace internal
3792 } // namespace v8 3793 } // namespace v8
3793 3794
3794 #endif // V8_TARGET_ARCH_MIPS 3795 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698