| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // - MapCache | 87 // - MapCache |
| 88 // - OrderedHashTable | 88 // - OrderedHashTable |
| 89 // - OrderedHashSet | 89 // - OrderedHashSet |
| 90 // - OrderedHashMap | 90 // - OrderedHashMap |
| 91 // - Context | 91 // - Context |
| 92 // - TypeFeedbackMetadata | 92 // - TypeFeedbackMetadata |
| 93 // - TypeFeedbackVector | 93 // - TypeFeedbackVector |
| 94 // - TemplateList | 94 // - TemplateList |
| 95 // - TransitionArray | 95 // - TransitionArray |
| 96 // - ScopeInfo | 96 // - ScopeInfo |
| 97 // - ModuleInfo |
| 97 // - ScriptContextTable | 98 // - ScriptContextTable |
| 98 // - WeakFixedArray | 99 // - WeakFixedArray |
| 99 // - FixedDoubleArray | 100 // - FixedDoubleArray |
| 100 // - Name | 101 // - Name |
| 101 // - String | 102 // - String |
| 102 // - SeqString | 103 // - SeqString |
| 103 // - SeqOneByteString | 104 // - SeqOneByteString |
| 104 // - SeqTwoByteString | 105 // - SeqTwoByteString |
| 105 // - SlicedString | 106 // - SlicedString |
| 106 // - ConsString | 107 // - ConsString |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 class ConsString; | 873 class ConsString; |
| 873 class ElementsAccessor; | 874 class ElementsAccessor; |
| 874 class FixedArrayBase; | 875 class FixedArrayBase; |
| 875 class FunctionLiteral; | 876 class FunctionLiteral; |
| 876 class JSGlobalObject; | 877 class JSGlobalObject; |
| 877 class KeyAccumulator; | 878 class KeyAccumulator; |
| 878 class LayoutDescriptor; | 879 class LayoutDescriptor; |
| 879 class LiteralsArray; | 880 class LiteralsArray; |
| 880 class LookupIterator; | 881 class LookupIterator; |
| 881 class FieldType; | 882 class FieldType; |
| 883 class ModuleDescriptor; |
| 884 class ModuleInfo; |
| 882 class ObjectHashTable; | 885 class ObjectHashTable; |
| 883 class ObjectVisitor; | 886 class ObjectVisitor; |
| 884 class PropertyCell; | 887 class PropertyCell; |
| 885 class PropertyDescriptor; | 888 class PropertyDescriptor; |
| 886 class SafepointEntry; | 889 class SafepointEntry; |
| 887 class SharedFunctionInfo; | 890 class SharedFunctionInfo; |
| 888 class StringStream; | 891 class StringStream; |
| 889 class TypeFeedbackInfo; | 892 class TypeFeedbackInfo; |
| 890 class TypeFeedbackMetadata; | 893 class TypeFeedbackMetadata; |
| 891 class TypeFeedbackVector; | 894 class TypeFeedbackVector; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 V(DependentCode) \ | 975 V(DependentCode) \ |
| 973 V(HandlerTable) \ | 976 V(HandlerTable) \ |
| 974 V(FixedArray) \ | 977 V(FixedArray) \ |
| 975 V(FixedDoubleArray) \ | 978 V(FixedDoubleArray) \ |
| 976 V(WeakFixedArray) \ | 979 V(WeakFixedArray) \ |
| 977 V(ArrayList) \ | 980 V(ArrayList) \ |
| 978 V(Context) \ | 981 V(Context) \ |
| 979 V(ScriptContextTable) \ | 982 V(ScriptContextTable) \ |
| 980 V(NativeContext) \ | 983 V(NativeContext) \ |
| 981 V(ScopeInfo) \ | 984 V(ScopeInfo) \ |
| 985 V(ModuleInfo) \ |
| 982 V(JSBoundFunction) \ | 986 V(JSBoundFunction) \ |
| 983 V(JSFunction) \ | 987 V(JSFunction) \ |
| 984 V(Code) \ | 988 V(Code) \ |
| 985 V(AbstractCode) \ | 989 V(AbstractCode) \ |
| 986 V(Oddball) \ | 990 V(Oddball) \ |
| 987 V(SharedFunctionInfo) \ | 991 V(SharedFunctionInfo) \ |
| 988 V(JSValue) \ | 992 V(JSValue) \ |
| 989 V(JSDate) \ | 993 V(JSDate) \ |
| 990 V(JSMessageObject) \ | 994 V(JSMessageObject) \ |
| 991 V(StringWrapper) \ | 995 V(StringWrapper) \ |
| (...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4306 inline bool IsAsmModule(); | 4310 inline bool IsAsmModule(); |
| 4307 | 4311 |
| 4308 // Return if this is a nested function within an asm module scope. | 4312 // Return if this is a nested function within an asm module scope. |
| 4309 inline bool IsAsmFunction(); | 4313 inline bool IsAsmFunction(); |
| 4310 | 4314 |
| 4311 inline bool HasSimpleParameters(); | 4315 inline bool HasSimpleParameters(); |
| 4312 | 4316 |
| 4313 // Return the function_name if present. | 4317 // Return the function_name if present. |
| 4314 String* FunctionName(); | 4318 String* FunctionName(); |
| 4315 | 4319 |
| 4320 ModuleInfo* ModuleDescriptorInfo(); |
| 4321 |
| 4316 // Return the name of the given parameter. | 4322 // Return the name of the given parameter. |
| 4317 String* ParameterName(int var); | 4323 String* ParameterName(int var); |
| 4318 | 4324 |
| 4319 // Return the name of the given local. | 4325 // Return the name of the given local. |
| 4320 String* LocalName(int var); | 4326 String* LocalName(int var); |
| 4321 | 4327 |
| 4322 // Return the name of the given stack local. | 4328 // Return the name of the given stack local. |
| 4323 String* StackLocalName(int var); | 4329 String* StackLocalName(int var); |
| 4324 | 4330 |
| 4325 // Return the name of the given stack local. | 4331 // Return the name of the given stack local. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4359 // Similar to ContextSlotIndex() but this method searches only among | 4365 // Similar to ContextSlotIndex() but this method searches only among |
| 4360 // global slots of the serialized scope info. Returns the context slot index | 4366 // global slots of the serialized scope info. Returns the context slot index |
| 4361 // for a given slot name if the slot is present; otherwise returns a | 4367 // for a given slot name if the slot is present; otherwise returns a |
| 4362 // value < 0. The name must be an internalized string. If the slot is present | 4368 // value < 0. The name must be an internalized string. If the slot is present |
| 4363 // and mode != NULL, sets *mode to the corresponding mode for that variable. | 4369 // and mode != NULL, sets *mode to the corresponding mode for that variable. |
| 4364 static int ContextGlobalSlotIndex(Handle<ScopeInfo> scope_info, | 4370 static int ContextGlobalSlotIndex(Handle<ScopeInfo> scope_info, |
| 4365 Handle<String> name, VariableMode* mode, | 4371 Handle<String> name, VariableMode* mode, |
| 4366 InitializationFlag* init_flag, | 4372 InitializationFlag* init_flag, |
| 4367 MaybeAssignedFlag* maybe_assigned_flag); | 4373 MaybeAssignedFlag* maybe_assigned_flag); |
| 4368 | 4374 |
| 4375 // Lookup metadata of a MODULE-allocated variable. Return a negative value if |
| 4376 // there is no module variable with the given name. |
| 4377 static int ModuleIndex(Handle<ScopeInfo> scope_info, Handle<String> name, |
| 4378 VariableMode* mode, InitializationFlag* init_flag, |
| 4379 MaybeAssignedFlag* maybe_assigned_flag); |
| 4380 |
| 4369 // Lookup the name of a certain context slot by its index. | 4381 // Lookup the name of a certain context slot by its index. |
| 4370 String* ContextSlotName(int slot_index); | 4382 String* ContextSlotName(int slot_index); |
| 4371 | 4383 |
| 4372 // Lookup support for serialized scope info. Returns the | 4384 // Lookup support for serialized scope info. Returns the |
| 4373 // parameter index for a given parameter name if the parameter is present; | 4385 // parameter index for a given parameter name if the parameter is present; |
| 4374 // otherwise returns a value < 0. The name must be an internalized string. | 4386 // otherwise returns a value < 0. The name must be an internalized string. |
| 4375 int ParameterIndex(String* name); | 4387 int ParameterIndex(String* name); |
| 4376 | 4388 |
| 4377 // Lookup support for serialized scope info. Returns the function context | 4389 // Lookup support for serialized scope info. Returns the function context |
| 4378 // slot index if the function name is present and context-allocated (named | 4390 // slot index if the function name is present and context-allocated (named |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4393 // Serializes empty scope info. | 4405 // Serializes empty scope info. |
| 4394 static ScopeInfo* Empty(Isolate* isolate); | 4406 static ScopeInfo* Empty(Isolate* isolate); |
| 4395 | 4407 |
| 4396 #ifdef DEBUG | 4408 #ifdef DEBUG |
| 4397 void Print(); | 4409 void Print(); |
| 4398 #endif | 4410 #endif |
| 4399 | 4411 |
| 4400 // The layout of the static part of a ScopeInfo is as follows. Each entry is | 4412 // The layout of the static part of a ScopeInfo is as follows. Each entry is |
| 4401 // numeric and occupies one array slot. | 4413 // numeric and occupies one array slot. |
| 4402 // 1. A set of properties of the scope | 4414 // 1. A set of properties of the scope |
| 4403 // 2. The number of parameters. This only applies to function scopes. For | 4415 // 2. The number of parameters. For non-function scopes this is 0. |
| 4404 // non-function scopes this is 0. | |
| 4405 // 3. The number of non-parameter variables allocated on the stack. | 4416 // 3. The number of non-parameter variables allocated on the stack. |
| 4406 // 4. The number of non-parameter and parameter variables allocated in the | 4417 // 4. The number of non-parameter and parameter variables allocated in the |
| 4407 // context. | 4418 // context. |
| 4408 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ | 4419 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ |
| 4409 V(Flags) \ | 4420 V(Flags) \ |
| 4410 V(ParameterCount) \ | 4421 V(ParameterCount) \ |
| 4411 V(StackLocalCount) \ | 4422 V(StackLocalCount) \ |
| 4412 V(ContextLocalCount) \ | 4423 V(ContextLocalCount) \ |
| 4413 V(ContextGlobalCount) | 4424 V(ContextGlobalCount) |
| 4414 | 4425 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 // context local, so in total this part occupies ContextLocalCount() | 4464 // context local, so in total this part occupies ContextLocalCount() |
| 4454 // slots in the array. | 4465 // slots in the array. |
| 4455 // 6. RecieverEntryIndex: | 4466 // 6. RecieverEntryIndex: |
| 4456 // 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 |
| 4457 // context or stack slot index for the variable. | 4468 // context or stack slot index for the variable. |
| 4458 // 7. FunctionNameEntryIndex: | 4469 // 7. FunctionNameEntryIndex: |
| 4459 // 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 |
| 4460 // information about the function variable. It always occupies two array | 4471 // information about the function variable. It always occupies two array |
| 4461 // slots: a. The name of the function variable. | 4472 // slots: a. The name of the function variable. |
| 4462 // b. The context or stack slot index for the variable. | 4473 // b. The context or stack slot index for the variable. |
| 4474 // 8. ModuleInfoEntryIndex: |
| 4475 // For a module scope, this part contains module-specific information (for |
| 4476 // non-module scopes it is empty): |
| 4477 // The first slot contains the ModuleInfo. The second slot contains the |
| 4478 // number n of MODULE-allocated variables. The remaining 3*n slots contain |
| 4479 // the metadata of those variables. |
| 4463 int ParameterEntriesIndex(); | 4480 int ParameterEntriesIndex(); |
| 4464 int StackLocalFirstSlotIndex(); | 4481 int StackLocalFirstSlotIndex(); |
| 4465 int StackLocalEntriesIndex(); | 4482 int StackLocalEntriesIndex(); |
| 4466 int ContextLocalNameEntriesIndex(); | 4483 int ContextLocalNameEntriesIndex(); |
| 4467 int ContextGlobalNameEntriesIndex(); | 4484 int ContextGlobalNameEntriesIndex(); |
| 4468 int ContextLocalInfoEntriesIndex(); | 4485 int ContextLocalInfoEntriesIndex(); |
| 4469 int ContextGlobalInfoEntriesIndex(); | 4486 int ContextGlobalInfoEntriesIndex(); |
| 4470 int ReceiverEntryIndex(); | 4487 int ReceiverEntryIndex(); |
| 4471 int FunctionNameEntryIndex(); | 4488 int FunctionNameEntryIndex(); |
| 4489 int ModuleInfoEntryIndex(); |
| 4472 | 4490 |
| 4473 int Lookup(Handle<String> name, int start, int end, VariableMode* mode, | 4491 int Lookup(Handle<String> name, int start, int end, VariableMode* mode, |
| 4474 VariableLocation* location, InitializationFlag* init_flag, | 4492 VariableLocation* location, InitializationFlag* init_flag, |
| 4475 MaybeAssignedFlag* maybe_assigned_flag); | 4493 MaybeAssignedFlag* maybe_assigned_flag); |
| 4476 | 4494 |
| 4477 // Used for the function name variable for named function expressions, and for | 4495 // Used for the function name variable for named function expressions, and for |
| 4478 // the receiver. | 4496 // the receiver. |
| 4479 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; | 4497 enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED }; |
| 4480 | 4498 |
| 4481 // Properties of scopes. | 4499 // Properties of scopes. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4504 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {}; | 4522 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {}; |
| 4505 | 4523 |
| 4506 // Properties of variables. | 4524 // Properties of variables. |
| 4507 class VariableModeField : public BitField<VariableMode, 0, 3> {}; | 4525 class VariableModeField : public BitField<VariableMode, 0, 3> {}; |
| 4508 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; | 4526 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; |
| 4509 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; | 4527 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; |
| 4510 | 4528 |
| 4511 friend class ScopeIterator; | 4529 friend class ScopeIterator; |
| 4512 }; | 4530 }; |
| 4513 | 4531 |
| 4532 class ModuleInfo : public FixedArray { |
| 4533 public: |
| 4534 DECLARE_CAST(ModuleInfo) |
| 4535 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr); |
| 4536 inline FixedArray* special_exports() const; |
| 4537 inline FixedArray* regular_exports() const; |
| 4538 }; |
| 4514 | 4539 |
| 4515 // The cache for maps used by normalized (dictionary mode) objects. | 4540 // The cache for maps used by normalized (dictionary mode) objects. |
| 4516 // Such maps do not have property descriptors, so a typical program | 4541 // Such maps do not have property descriptors, so a typical program |
| 4517 // needs very limited number of distinct normalized maps. | 4542 // needs very limited number of distinct normalized maps. |
| 4518 class NormalizedMapCache: public FixedArray { | 4543 class NormalizedMapCache: public FixedArray { |
| 4519 public: | 4544 public: |
| 4520 static Handle<NormalizedMapCache> New(Isolate* isolate); | 4545 static Handle<NormalizedMapCache> New(Isolate* isolate); |
| 4521 | 4546 |
| 4522 MUST_USE_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map, | 4547 MUST_USE_RESULT MaybeHandle<Map> Get(Handle<Map> fast_map, |
| 4523 PropertyNormalizationMode mode); | 4548 PropertyNormalizationMode mode); |
| (...skipping 6647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11171 } | 11196 } |
| 11172 return value; | 11197 return value; |
| 11173 } | 11198 } |
| 11174 }; | 11199 }; |
| 11175 | 11200 |
| 11176 | 11201 |
| 11177 } // NOLINT, false-positive due to second-order macros. | 11202 } // NOLINT, false-positive due to second-order macros. |
| 11178 } // NOLINT, false-positive due to second-order macros. | 11203 } // NOLINT, false-positive due to second-order macros. |
| 11179 | 11204 |
| 11180 #endif // V8_OBJECTS_H_ | 11205 #endif // V8_OBJECTS_H_ |
| OLD | NEW |