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

Side by Side Diff: src/objects.h

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Feedback + rebased Created 5 years, 8 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/hydrogen.cc ('k') | src/parser.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 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 4281
4282 // Return the name of the given parameter. 4282 // Return the name of the given parameter.
4283 String* ParameterName(int var); 4283 String* ParameterName(int var);
4284 4284
4285 // Return the name of the given local. 4285 // Return the name of the given local.
4286 String* LocalName(int var); 4286 String* LocalName(int var);
4287 4287
4288 // Return the name of the given stack local. 4288 // Return the name of the given stack local.
4289 String* StackLocalName(int var); 4289 String* StackLocalName(int var);
4290 4290
4291 // Return the name of the given stack local.
4292 int StackLocalIndex(int var);
4293
4291 // Return the name of the given context local. 4294 // Return the name of the given context local.
4292 String* ContextLocalName(int var); 4295 String* ContextLocalName(int var);
4293 4296
4294 // Return the mode of the given context local. 4297 // Return the mode of the given context local.
4295 VariableMode ContextLocalMode(int var); 4298 VariableMode ContextLocalMode(int var);
4296 4299
4297 // Return the initialization flag of the given context local. 4300 // Return the initialization flag of the given context local.
4298 InitializationFlag ContextLocalInitFlag(int var); 4301 InitializationFlag ContextLocalInitFlag(int var);
4299 4302
4300 // Return the initialization flag of the given context local. 4303 // Return the initialization flag of the given context local.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
4389 #undef FOR_EACH_NUMERIC_FIELD 4392 #undef FOR_EACH_NUMERIC_FIELD
4390 kVariablePartIndex 4393 kVariablePartIndex
4391 }; 4394 };
4392 4395
4393 // The layout of the variable part of a ScopeInfo is as follows: 4396 // The layout of the variable part of a ScopeInfo is as follows:
4394 // 1. ParameterEntries: 4397 // 1. ParameterEntries:
4395 // This part stores the names of the parameters for function scopes. One 4398 // This part stores the names of the parameters for function scopes. One
4396 // slot is used per parameter, so in total this part occupies 4399 // slot is used per parameter, so in total this part occupies
4397 // ParameterCount() slots in the array. For other scopes than function 4400 // ParameterCount() slots in the array. For other scopes than function
4398 // scopes ParameterCount() is 0. 4401 // scopes ParameterCount() is 0.
4399 // 2. StackLocalEntries: 4402 // 2. StackLocalFirstSlot:
4403 // Index of a first stack slot for stack local. Stack locals belonging to
4404 // this scope are located on a stack at slots starting from this index.
4405 // 3. StackLocalEntries:
4400 // Contains the names of local variables that are allocated on the stack, 4406 // Contains the names of local variables that are allocated on the stack,
4401 // in increasing order of the stack slot index. One slot is used per stack 4407 // in increasing order of the stack slot index. First local variable has
4402 // local, so in total this part occupies StackLocalCount() slots in the 4408 // a stack slot index defined in StackLocalFirstSlot (point 2 above).
4403 // array. 4409 // One slot is used per stack local, so in total this part occupies
4404 // 3. ContextLocalNameEntries: 4410 // StackLocalCount() slots in the array.
4411 // 4. ContextLocalNameEntries:
4405 // Contains the names of local variables and parameters that are allocated 4412 // Contains the names of local variables and parameters that are allocated
4406 // in the context. They are stored in increasing order of the context slot 4413 // in the context. They are stored in increasing order of the context slot
4407 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per 4414 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per
4408 // context local, so in total this part occupies ContextLocalCount() slots 4415 // context local, so in total this part occupies ContextLocalCount() slots
4409 // in the array. 4416 // in the array.
4410 // 4. ContextLocalInfoEntries: 4417 // 5. ContextLocalInfoEntries:
4411 // Contains the variable modes and initialization flags corresponding to 4418 // Contains the variable modes and initialization flags corresponding to
4412 // the context locals in ContextLocalNameEntries. One slot is used per 4419 // the context locals in ContextLocalNameEntries. One slot is used per
4413 // context local, so in total this part occupies ContextLocalCount() 4420 // context local, so in total this part occupies ContextLocalCount()
4414 // slots in the array. 4421 // slots in the array.
4415 // 5. StrongModeFreeVariableNameEntries: 4422 // 6. StrongModeFreeVariableNameEntries:
4416 // Stores the names of strong mode free variables. 4423 // Stores the names of strong mode free variables.
4417 // 6. StrongModeFreeVariablePositionEntries: 4424 // 7. StrongModeFreeVariablePositionEntries:
4418 // Stores the locations (start and end position) of strong mode free 4425 // Stores the locations (start and end position) of strong mode free
4419 // variables. 4426 // variables.
4420 // 7. FunctionNameEntryIndex: 4427 // 8. FunctionNameEntryIndex:
4421 // If the scope belongs to a named function expression this part contains 4428 // If the scope belongs to a named function expression this part contains
4422 // information about the function variable. It always occupies two array 4429 // information about the function variable. It always occupies two array
4423 // slots: a. The name of the function variable. 4430 // slots: a. The name of the function variable.
4424 // b. The context or stack slot index for the variable. 4431 // b. The context or stack slot index for the variable.
4425 int ParameterEntriesIndex(); 4432 int ParameterEntriesIndex();
4433 int StackLocalFirstSlotIndex();
4426 int StackLocalEntriesIndex(); 4434 int StackLocalEntriesIndex();
4427 int ContextLocalNameEntriesIndex(); 4435 int ContextLocalNameEntriesIndex();
4428 int ContextLocalInfoEntriesIndex(); 4436 int ContextLocalInfoEntriesIndex();
4429 int StrongModeFreeVariableNameEntriesIndex(); 4437 int StrongModeFreeVariableNameEntriesIndex();
4430 int StrongModeFreeVariablePositionEntriesIndex(); 4438 int StrongModeFreeVariablePositionEntriesIndex();
4431 int FunctionNameEntryIndex(); 4439 int FunctionNameEntryIndex();
4432 4440
4433 // Location of the function variable for named function expressions. 4441 // Location of the function variable for named function expressions.
4434 enum FunctionVariableInfo { 4442 enum FunctionVariableInfo {
4435 NONE, // No function name present. 4443 NONE, // No function name present.
(...skipping 6649 matching lines...) Expand 10 before | Expand all | Expand 10 after
11085 } else { 11093 } else {
11086 value &= ~(1 << bit_position); 11094 value &= ~(1 << bit_position);
11087 } 11095 }
11088 return value; 11096 return value;
11089 } 11097 }
11090 }; 11098 };
11091 11099
11092 } } // namespace v8::internal 11100 } } // namespace v8::internal
11093 11101
11094 #endif // V8_OBJECTS_H_ 11102 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698