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

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

Powered by Google App Engine
This is Rietveld 408576698