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

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

Powered by Google App Engine
This is Rietveld 408576698