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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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/x64/full-codegen-x64.cc ('k') | src/globals.h » ('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_X87 5 #if V8_TARGET_ARCH_X87
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 function_in_register = false; 189 function_in_register = false;
190 // Context is returned in eax. It replaces the context passed to us. 190 // Context is returned in eax. It replaces the context passed to us.
191 // It's saved in the stack and kept live in esi. 191 // It's saved in the stack and kept live in esi.
192 __ mov(esi, eax); 192 __ mov(esi, eax);
193 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 193 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
194 194
195 // Copy parameters into context if necessary. 195 // Copy parameters into context if necessary.
196 int num_parameters = info->scope()->num_parameters(); 196 int num_parameters = info->scope()->num_parameters();
197 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; 197 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0;
198 for (int i = first_parameter; i < num_parameters; i++) { 198 for (int i = first_parameter; i < num_parameters; i++) {
199 Variable* var = 199 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
200 (i == -1) ? info->scope()->receiver() : info->scope()->parameter(i);
201 if (var->IsContextSlot()) { 200 if (var->IsContextSlot()) {
202 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 201 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
203 (num_parameters - 1 - i) * kPointerSize; 202 (num_parameters - 1 - i) * kPointerSize;
204 // Load parameter from stack. 203 // Load parameter from stack.
205 __ mov(eax, Operand(ebp, parameter_offset)); 204 __ mov(eax, Operand(ebp, parameter_offset));
206 // Store it in the context. 205 // Store it in the context.
207 int context_offset = Context::SlotOffset(var->index()); 206 int context_offset = Context::SlotOffset(var->index());
208 __ mov(Operand(esi, context_offset), eax); 207 __ mov(Operand(esi, context_offset), eax);
209 // Update the write barrier. This clobbers eax and ebx. 208 // Update the write barrier. This clobbers eax and ebx.
210 if (need_write_barrier) { 209 if (need_write_barrier) {
(...skipping 10 matching lines...) Expand all
221 } 220 }
222 221
223 // Register holding this function and new target are both trashed in case we 222 // Register holding this function and new target are both trashed in case we
224 // bailout here. But since that can happen only when new target is not used 223 // bailout here. But since that can happen only when new target is not used
225 // and we allocate a context, the value of |function_in_register| is correct. 224 // and we allocate a context, the value of |function_in_register| is correct.
226 PrepareForBailoutForId(BailoutId::FunctionContext(), 225 PrepareForBailoutForId(BailoutId::FunctionContext(),
227 BailoutState::NO_REGISTERS); 226 BailoutState::NO_REGISTERS);
228 227
229 // Possibly set up a local binding to the this function which is used in 228 // Possibly set up a local binding to the this function which is used in
230 // derived constructors with super calls. 229 // derived constructors with super calls.
231 Variable* this_function_var = info->scope()->this_function_var(); 230 Variable* this_function_var = scope()->this_function_var();
232 if (this_function_var != nullptr) { 231 if (this_function_var != nullptr) {
233 Comment cmnt(masm_, "[ This function"); 232 Comment cmnt(masm_, "[ This function");
234 if (!function_in_register) { 233 if (!function_in_register) {
235 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 234 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
236 // The write barrier clobbers register again, keep it marked as such. 235 // The write barrier clobbers register again, keep it marked as such.
237 } 236 }
238 SetVar(this_function_var, edi, ebx, ecx); 237 SetVar(this_function_var, edi, ebx, ecx);
239 } 238 }
240 239
241 // Possibly set up a local binding to the new target value. 240 // Possibly set up a local binding to the new target value.
242 Variable* new_target_var = info->scope()->new_target_var(); 241 Variable* new_target_var = scope()->new_target_var();
243 if (new_target_var != nullptr) { 242 if (new_target_var != nullptr) {
244 Comment cmnt(masm_, "[ new.target"); 243 Comment cmnt(masm_, "[ new.target");
245 SetVar(new_target_var, edx, ebx, ecx); 244 SetVar(new_target_var, edx, ebx, ecx);
246 } 245 }
247 246
248 // Possibly allocate RestParameters 247 // Possibly allocate RestParameters
249 int rest_index; 248 int rest_index;
250 Variable* rest_param = info->scope()->rest_parameter(&rest_index); 249 Variable* rest_param = scope()->rest_parameter(&rest_index);
251 if (rest_param) { 250 if (rest_param) {
252 Comment cmnt(masm_, "[ Allocate rest parameter array"); 251 Comment cmnt(masm_, "[ Allocate rest parameter array");
253 if (!function_in_register) { 252 if (!function_in_register) {
254 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 253 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
255 } 254 }
256 FastNewRestParameterStub stub(isolate()); 255 FastNewRestParameterStub stub(isolate());
257 __ CallStub(&stub); 256 __ CallStub(&stub);
258 function_in_register = false; 257 function_in_register = false;
259 SetVar(rest_param, eax, ebx, edx); 258 SetVar(rest_param, eax, ebx, edx);
260 } 259 }
261 260
262 Variable* arguments = info->scope()->arguments(); 261 Variable* arguments = scope()->arguments();
263 if (arguments != NULL) { 262 if (arguments != NULL) {
264 // Arguments object must be allocated after the context object, in 263 // Arguments object must be allocated after the context object, in
265 // case the "arguments" or ".arguments" variables are in the context. 264 // case the "arguments" or ".arguments" variables are in the context.
266 Comment cmnt(masm_, "[ Allocate arguments object"); 265 Comment cmnt(masm_, "[ Allocate arguments object");
267 if (!function_in_register) { 266 if (!function_in_register) {
268 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 267 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
269 } 268 }
270 if (is_strict(language_mode()) || !has_simple_parameters()) { 269 if (is_strict(language_mode()) || !has_simple_parameters()) {
271 FastNewStrictArgumentsStub stub(isolate()); 270 FastNewStrictArgumentsStub stub(isolate());
272 __ CallStub(&stub); 271 __ CallStub(&stub);
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after
3511 __ mov(Operand(ebp, frame_offset), value); 3510 __ mov(Operand(ebp, frame_offset), value);
3512 } 3511 }
3513 3512
3514 3513
3515 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 3514 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
3516 __ mov(dst, ContextOperand(esi, context_index)); 3515 __ mov(dst, ContextOperand(esi, context_index));
3517 } 3516 }
3518 3517
3519 3518
3520 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 3519 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
3521 DeclarationScope* closure_scope = scope()->GetClosureScope(); 3520 Scope* closure_scope = scope()->ClosureScope();
3522 if (closure_scope->is_script_scope() || 3521 if (closure_scope->is_script_scope() ||
3523 closure_scope->is_module_scope()) { 3522 closure_scope->is_module_scope()) {
3524 // Contexts nested in the native context have a canonical empty function 3523 // Contexts nested in the native context have a canonical empty function
3525 // as their closure, not the anonymous closure containing the global 3524 // as their closure, not the anonymous closure containing the global
3526 // code. 3525 // code.
3527 __ mov(eax, NativeContextOperand()); 3526 __ mov(eax, NativeContextOperand());
3528 PushOperand(ContextOperand(eax, Context::CLOSURE_INDEX)); 3527 PushOperand(ContextOperand(eax, Context::CLOSURE_INDEX));
3529 } else if (closure_scope->is_eval_scope()) { 3528 } else if (closure_scope->is_eval_scope()) {
3530 // Contexts nested inside eval code have the same closure as the context 3529 // Contexts nested inside eval code have the same closure as the context
3531 // calling eval, not the anonymous closure containing the eval code. 3530 // calling eval, not the anonymous closure containing the eval code.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 isolate->builtins()->OnStackReplacement()->entry(), 3668 isolate->builtins()->OnStackReplacement()->entry(),
3670 Assembler::target_address_at(call_target_address, unoptimized_code)); 3669 Assembler::target_address_at(call_target_address, unoptimized_code));
3671 return ON_STACK_REPLACEMENT; 3670 return ON_STACK_REPLACEMENT;
3672 } 3671 }
3673 3672
3674 3673
3675 } // namespace internal 3674 } // namespace internal
3676 } // namespace v8 3675 } // namespace v8
3677 3676
3678 #endif // V8_TARGET_ARCH_X87 3677 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698