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

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

Powered by Google App Engine
This is Rietveld 408576698