OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 4420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4431 | 4431 |
4432 enum { | 4432 enum { |
4433 #define DECL_INDEX(name) k##name, | 4433 #define DECL_INDEX(name) k##name, |
4434 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(DECL_INDEX) | 4434 FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(DECL_INDEX) |
4435 #undef DECL_INDEX | 4435 #undef DECL_INDEX |
4436 kVariablePartIndex | 4436 kVariablePartIndex |
4437 }; | 4437 }; |
4438 | 4438 |
4439 private: | 4439 private: |
4440 // The layout of the variable part of a ScopeInfo is as follows: | 4440 // The layout of the variable part of a ScopeInfo is as follows: |
4441 // 1. ParameterEntries: | 4441 // 1. ParameterNames: |
4442 // This part stores the names of the parameters for function scopes. One | 4442 // This part stores the names of the parameters for function scopes. One |
4443 // slot is used per parameter, so in total this part occupies | 4443 // slot is used per parameter, so in total this part occupies |
4444 // ParameterCount() slots in the array. For other scopes than function | 4444 // ParameterCount() slots in the array. For other scopes than function |
4445 // scopes ParameterCount() is 0. | 4445 // scopes ParameterCount() is 0. |
4446 // 2. StackLocalFirstSlot: | 4446 // 2. StackLocalFirstSlot: |
4447 // Index of a first stack slot for stack local. Stack locals belonging to | 4447 // Index of a first stack slot for stack local. Stack locals belonging to |
4448 // this scope are located on a stack at slots starting from this index. | 4448 // this scope are located on a stack at slots starting from this index. |
4449 // 3. StackLocalEntries: | 4449 // 3. StackLocalNames: |
4450 // Contains the names of local variables that are allocated on the stack, | 4450 // Contains the names of local variables that are allocated on the stack, |
4451 // in increasing order of the stack slot index. First local variable has a | 4451 // in increasing order of the stack slot index. First local variable has a |
4452 // stack slot index defined in StackLocalFirstSlot (point 2 above). | 4452 // stack slot index defined in StackLocalFirstSlot (point 2 above). |
4453 // One slot is used per stack local, so in total this part occupies | 4453 // One slot is used per stack local, so in total this part occupies |
4454 // StackLocalCount() slots in the array. | 4454 // StackLocalCount() slots in the array. |
4455 // 4. ContextLocalNameEntries: | 4455 // 4. ContextLocalNames: |
4456 // Contains the names of local variables and parameters that are allocated | 4456 // Contains the names of local variables and parameters that are allocated |
4457 // in the context. They are stored in increasing order of the context slot | 4457 // in the context. They are stored in increasing order of the context slot |
4458 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per | 4458 // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per |
4459 // context local, so in total this part occupies ContextLocalCount() slots | 4459 // context local, so in total this part occupies ContextLocalCount() slots |
4460 // in the array. | 4460 // in the array. |
4461 // 5. ContextLocalInfoEntries: | 4461 // 5. ContextLocalInfos: |
4462 // Contains the variable modes and initialization flags corresponding to | 4462 // Contains the variable modes and initialization flags corresponding to |
4463 // the context locals in ContextLocalNameEntries. One slot is used per | 4463 // the context locals in ContextLocalNames. One slot is used per |
4464 // context local, so in total this part occupies ContextLocalCount() | 4464 // context local, so in total this part occupies ContextLocalCount() |
4465 // slots in the array. | 4465 // slots in the array. |
4466 // 6. ReceiverEntry: | 4466 // 6. ReceiverInfo: |
4467 // If the scope binds a "this" value, one slot is reserved to hold the | 4467 // If the scope binds a "this" value, one slot is reserved to hold the |
4468 // context or stack slot index for the variable. | 4468 // context or stack slot index for the variable. |
4469 // 7. FunctionNameEntry: | 4469 // 7. FunctionNameInfo: |
4470 // If the scope belongs to a named function expression this part contains | 4470 // If the scope belongs to a named function expression this part contains |
4471 // information about the function variable. It always occupies two array | 4471 // information about the function variable. It always occupies two array |
4472 // slots: a. The name of the function variable. | 4472 // slots: a. The name of the function variable. |
4473 // b. The context or stack slot index for the variable. | 4473 // b. The context or stack slot index for the variable. |
4474 // 8. OuterScopeInfoEntryIndex: | 4474 // 8. OuterScopeInfoIndex: |
4475 // The outer scope's ScopeInfo or the hole if there's none. | 4475 // The outer scope's ScopeInfo or the hole if there's none. |
4476 // 9. ModuleInfoEntry, ModuleVariableCount, and ModuleVariableEntries: | 4476 // 9. ModuleInfo, ModuleVariableCount, and ModuleVariables: |
4477 // For a module scope, this part contains the ModuleInfo, the number of | 4477 // For a module scope, this part contains the ModuleInfo, the number of |
4478 // MODULE-allocated variables, and the metadata of those variables. For | 4478 // MODULE-allocated variables, and the metadata of those variables. For |
4479 // non-module scopes it is empty. | 4479 // non-module scopes it is empty. |
4480 int ParameterEntriesIndex(); | 4480 int ParameterNamesIndex(); |
4481 int StackLocalFirstSlotIndex(); | 4481 int StackLocalFirstSlotIndex(); |
4482 int StackLocalEntriesIndex(); | 4482 int StackLocalNamesIndex(); |
4483 int ContextLocalNameEntriesIndex(); | 4483 int ContextLocalNamesIndex(); |
4484 int ContextLocalInfoEntriesIndex(); | 4484 int ContextLocalInfosIndex(); |
4485 int ReceiverEntryIndex(); | 4485 int ReceiverInfoIndex(); |
4486 int FunctionNameEntryIndex(); | 4486 int FunctionNameInfoIndex(); |
4487 int OuterScopeInfoEntryIndex(); | 4487 int OuterScopeInfoIndex(); |
4488 int ModuleInfoEntryIndex(); | 4488 int ModuleInfoIndex(); |
4489 int ModuleVariableCountIndex(); | 4489 int ModuleVariableCountIndex(); |
4490 int ModuleVariableEntriesIndex(); | 4490 int ModuleVariablesIndex(); |
4491 | 4491 |
4492 int Lookup(Handle<String> name, int start, int end, VariableMode* mode, | 4492 int Lookup(Handle<String> name, int start, int end, VariableMode* mode, |
4493 VariableLocation* location, InitializationFlag* init_flag, | 4493 VariableLocation* location, InitializationFlag* init_flag, |
4494 MaybeAssignedFlag* maybe_assigned_flag); | 4494 MaybeAssignedFlag* maybe_assigned_flag); |
4495 | 4495 |
4496 // Used for the function name variable for named function expressions, and for | 4496 // Used for the function name variable for named function expressions, and for |
4497 // the receiver. | 4497 // the receiver. |
4498 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; | 4498 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; |
4499 | 4499 |
4500 // Properties of scopes. | 4500 // Properties of scopes. |
(...skipping 6725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11226 } | 11226 } |
11227 return value; | 11227 return value; |
11228 } | 11228 } |
11229 }; | 11229 }; |
11230 | 11230 |
11231 | 11231 |
11232 } // NOLINT, false-positive due to second-order macros. | 11232 } // NOLINT, false-positive due to second-order macros. |
11233 } // NOLINT, false-positive due to second-order macros. | 11233 } // NOLINT, false-positive due to second-order macros. |
11234 | 11234 |
11235 #endif // V8_OBJECTS_H_ | 11235 #endif // V8_OBJECTS_H_ |
OLD | NEW |