| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // - JSWeakMap | 63 // - JSWeakMap |
| 64 // - JSWeakSet | 64 // - JSWeakSet |
| 65 // - JSRegExp | 65 // - JSRegExp |
| 66 // - JSFunction | 66 // - JSFunction |
| 67 // - JSGeneratorObject | 67 // - JSGeneratorObject |
| 68 // - JSGlobalObject | 68 // - JSGlobalObject |
| 69 // - JSGlobalProxy | 69 // - JSGlobalProxy |
| 70 // - JSValue | 70 // - JSValue |
| 71 // - JSDate | 71 // - JSDate |
| 72 // - JSMessageObject | 72 // - JSMessageObject |
| 73 // - JSModule |
| 73 // - JSProxy | 74 // - JSProxy |
| 74 // - FixedArrayBase | 75 // - FixedArrayBase |
| 75 // - ByteArray | 76 // - ByteArray |
| 76 // - BytecodeArray | 77 // - BytecodeArray |
| 77 // - FixedArray | 78 // - FixedArray |
| 78 // - DescriptorArray | 79 // - DescriptorArray |
| 79 // - FrameArray | 80 // - FrameArray |
| 80 // - LiteralsArray | 81 // - LiteralsArray |
| 81 // - HashTable | 82 // - HashTable |
| 82 // - Dictionary | 83 // - Dictionary |
| 83 // - StringTable | 84 // - StringTable |
| 84 // - StringSet | 85 // - StringSet |
| 85 // - CompilationCacheTable | 86 // - CompilationCacheTable |
| 86 // - CodeCacheHashTable | 87 // - CodeCacheHashTable |
| 87 // - MapCache | 88 // - MapCache |
| 88 // - OrderedHashTable | 89 // - OrderedHashTable |
| 89 // - OrderedHashSet | 90 // - OrderedHashSet |
| 90 // - OrderedHashMap | 91 // - OrderedHashMap |
| 91 // - Context | 92 // - Context |
| 92 // - TypeFeedbackMetadata | 93 // - TypeFeedbackMetadata |
| 93 // - TypeFeedbackVector | 94 // - TypeFeedbackVector |
| 94 // - TemplateList | 95 // - TemplateList |
| 95 // - TransitionArray | 96 // - TransitionArray |
| 96 // - ScopeInfo | 97 // - ScopeInfo |
| 98 // - ModuleInfoEntry |
| 97 // - ModuleInfo | 99 // - ModuleInfo |
| 98 // - ScriptContextTable | 100 // - ScriptContextTable |
| 99 // - WeakFixedArray | 101 // - WeakFixedArray |
| 100 // - FixedDoubleArray | 102 // - FixedDoubleArray |
| 101 // - Name | 103 // - Name |
| 102 // - String | 104 // - String |
| 103 // - SeqString | 105 // - SeqString |
| 104 // - SeqOneByteString | 106 // - SeqOneByteString |
| 105 // - SeqTwoByteString | 107 // - SeqTwoByteString |
| 106 // - SlicedString | 108 // - SlicedString |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 class ElementsAccessor; | 874 class ElementsAccessor; |
| 873 class FixedArrayBase; | 875 class FixedArrayBase; |
| 874 class FunctionLiteral; | 876 class FunctionLiteral; |
| 875 class JSGlobalObject; | 877 class JSGlobalObject; |
| 876 class KeyAccumulator; | 878 class KeyAccumulator; |
| 877 class LayoutDescriptor; | 879 class LayoutDescriptor; |
| 878 class LiteralsArray; | 880 class LiteralsArray; |
| 879 class LookupIterator; | 881 class LookupIterator; |
| 880 class FieldType; | 882 class FieldType; |
| 881 class ModuleDescriptor; | 883 class ModuleDescriptor; |
| 884 class ModuleInfoEntry; |
| 882 class ModuleInfo; | 885 class ModuleInfo; |
| 883 class ObjectHashTable; | 886 class ObjectHashTable; |
| 884 class ObjectVisitor; | 887 class ObjectVisitor; |
| 885 class PropertyCell; | 888 class PropertyCell; |
| 886 class PropertyDescriptor; | 889 class PropertyDescriptor; |
| 887 class SafepointEntry; | 890 class SafepointEntry; |
| 888 class SharedFunctionInfo; | 891 class SharedFunctionInfo; |
| 889 class StringStream; | 892 class StringStream; |
| 890 class TypeFeedbackInfo; | 893 class TypeFeedbackInfo; |
| 891 class TypeFeedbackMetadata; | 894 class TypeFeedbackMetadata; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 V(FixedFloat32Array) \ | 957 V(FixedFloat32Array) \ |
| 955 V(FixedFloat64Array) \ | 958 V(FixedFloat64Array) \ |
| 956 V(FixedUint8ClampedArray) \ | 959 V(FixedUint8ClampedArray) \ |
| 957 V(ByteArray) \ | 960 V(ByteArray) \ |
| 958 V(BytecodeArray) \ | 961 V(BytecodeArray) \ |
| 959 V(FreeSpace) \ | 962 V(FreeSpace) \ |
| 960 V(JSReceiver) \ | 963 V(JSReceiver) \ |
| 961 V(JSObject) \ | 964 V(JSObject) \ |
| 962 V(JSContextExtensionObject) \ | 965 V(JSContextExtensionObject) \ |
| 963 V(JSGeneratorObject) \ | 966 V(JSGeneratorObject) \ |
| 967 V(JSModule) \ |
| 964 V(Map) \ | 968 V(Map) \ |
| 965 V(DescriptorArray) \ | 969 V(DescriptorArray) \ |
| 966 V(FrameArray) \ | 970 V(FrameArray) \ |
| 967 V(TransitionArray) \ | 971 V(TransitionArray) \ |
| 968 V(LiteralsArray) \ | 972 V(LiteralsArray) \ |
| 969 V(TypeFeedbackMetadata) \ | 973 V(TypeFeedbackMetadata) \ |
| 970 V(TypeFeedbackVector) \ | 974 V(TypeFeedbackVector) \ |
| 971 V(DeoptimizationInputData) \ | 975 V(DeoptimizationInputData) \ |
| 972 V(DeoptimizationOutputData) \ | 976 V(DeoptimizationOutputData) \ |
| 973 V(DependentCode) \ | 977 V(DependentCode) \ |
| 974 V(HandlerTable) \ | 978 V(HandlerTable) \ |
| 975 V(FixedArray) \ | 979 V(FixedArray) \ |
| 976 V(FixedDoubleArray) \ | 980 V(FixedDoubleArray) \ |
| 977 V(WeakFixedArray) \ | 981 V(WeakFixedArray) \ |
| 978 V(ArrayList) \ | 982 V(ArrayList) \ |
| 979 V(Context) \ | 983 V(Context) \ |
| 980 V(ScriptContextTable) \ | 984 V(ScriptContextTable) \ |
| 981 V(NativeContext) \ | 985 V(NativeContext) \ |
| 982 V(ScopeInfo) \ | 986 V(ScopeInfo) \ |
| 987 V(ModuleInfoEntry) \ |
| 983 V(ModuleInfo) \ | 988 V(ModuleInfo) \ |
| 984 V(JSBoundFunction) \ | 989 V(JSBoundFunction) \ |
| 985 V(JSFunction) \ | 990 V(JSFunction) \ |
| 986 V(Code) \ | 991 V(Code) \ |
| 987 V(AbstractCode) \ | 992 V(AbstractCode) \ |
| 988 V(Oddball) \ | 993 V(Oddball) \ |
| 989 V(SharedFunctionInfo) \ | 994 V(SharedFunctionInfo) \ |
| 990 V(JSValue) \ | 995 V(JSValue) \ |
| 991 V(JSDate) \ | 996 V(JSDate) \ |
| 992 V(JSMessageObject) \ | 997 V(JSMessageObject) \ |
| (...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 | 4401 |
| 4397 // Serializes empty scope info. | 4402 // Serializes empty scope info. |
| 4398 static ScopeInfo* Empty(Isolate* isolate); | 4403 static ScopeInfo* Empty(Isolate* isolate); |
| 4399 | 4404 |
| 4400 #ifdef DEBUG | 4405 #ifdef DEBUG |
| 4401 void Print(); | 4406 void Print(); |
| 4402 #endif | 4407 #endif |
| 4403 | 4408 |
| 4404 // The layout of the static part of a ScopeInfo is as follows. Each entry is | 4409 // The layout of the static part of a ScopeInfo is as follows. Each entry is |
| 4405 // numeric and occupies one array slot. | 4410 // numeric and occupies one array slot. |
| 4406 // 1. A set of properties of the scope | 4411 // 1. A set of properties of the scope. |
| 4407 // 2. The number of parameters. For non-function scopes this is 0. | 4412 // 2. The number of parameters. For non-function scopes this is 0. |
| 4408 // 3. The number of non-parameter variables allocated on the stack. | 4413 // 3. The number of non-parameter variables allocated on the stack. |
| 4409 // 4. The number of non-parameter and parameter variables allocated in the | 4414 // 4. The number of non-parameter and parameter variables allocated in the |
| 4410 // context. | 4415 // context. |
| 4411 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ | 4416 #define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \ |
| 4412 V(Flags) \ | 4417 V(Flags) \ |
| 4413 V(ParameterCount) \ | 4418 V(ParameterCount) \ |
| 4414 V(StackLocalCount) \ | 4419 V(StackLocalCount) \ |
| 4415 V(ContextLocalCount) | 4420 V(ContextLocalCount) |
| 4416 | 4421 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4509 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {}; | 4514 : public BitField<FunctionKind, HasSimpleParametersField::kNext, 9> {}; |
| 4510 | 4515 |
| 4511 // Properties of variables. | 4516 // Properties of variables. |
| 4512 class VariableModeField : public BitField<VariableMode, 0, 3> {}; | 4517 class VariableModeField : public BitField<VariableMode, 0, 3> {}; |
| 4513 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; | 4518 class InitFlagField : public BitField<InitializationFlag, 3, 1> {}; |
| 4514 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; | 4519 class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {}; |
| 4515 | 4520 |
| 4516 friend class ScopeIterator; | 4521 friend class ScopeIterator; |
| 4517 }; | 4522 }; |
| 4518 | 4523 |
| 4524 class ModuleInfoEntry : public FixedArray { |
| 4525 public: |
| 4526 DECLARE_CAST(ModuleInfoEntry) |
| 4527 static Handle<ModuleInfoEntry> New(Isolate* isolate, |
| 4528 Handle<Object> export_name, |
| 4529 Handle<Object> local_name, |
| 4530 Handle<Object> import_name, |
| 4531 Handle<Object> module_request); |
| 4532 inline Object* export_name() const; |
| 4533 inline Object* local_name() const; |
| 4534 inline Object* import_name() const; |
| 4535 inline Object* module_request() const; |
| 4536 |
| 4537 private: |
| 4538 friend class Factory; |
| 4539 enum { |
| 4540 kExportNameIndex, |
| 4541 kLocalNameIndex, |
| 4542 kImportNameIndex, |
| 4543 kModuleRequestIndex, |
| 4544 kLength |
| 4545 }; |
| 4546 }; |
| 4547 |
| 4519 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope. | 4548 // ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope. |
| 4520 class ModuleInfo : public FixedArray { | 4549 class ModuleInfo : public FixedArray { |
| 4521 public: | 4550 public: |
| 4522 DECLARE_CAST(ModuleInfo) | 4551 DECLARE_CAST(ModuleInfo) |
| 4523 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr); | 4552 static Handle<ModuleInfo> New(Isolate* isolate, ModuleDescriptor* descr); |
| 4524 inline FixedArray* special_exports() const; | 4553 inline FixedArray* special_exports() const; |
| 4525 inline FixedArray* regular_exports() const; | 4554 inline FixedArray* regular_exports() const; |
| 4526 | 4555 |
| 4527 private: | 4556 private: |
| 4528 friend class Factory; | 4557 friend class Factory; |
| (...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6311 inline bool CanTransition(); | 6340 inline bool CanTransition(); |
| 6312 | 6341 |
| 6313 inline bool IsBooleanMap(); | 6342 inline bool IsBooleanMap(); |
| 6314 inline bool IsPrimitiveMap(); | 6343 inline bool IsPrimitiveMap(); |
| 6315 inline bool IsJSReceiverMap(); | 6344 inline bool IsJSReceiverMap(); |
| 6316 inline bool IsJSObjectMap(); | 6345 inline bool IsJSObjectMap(); |
| 6317 inline bool IsJSArrayMap(); | 6346 inline bool IsJSArrayMap(); |
| 6318 inline bool IsJSFunctionMap(); | 6347 inline bool IsJSFunctionMap(); |
| 6319 inline bool IsStringMap(); | 6348 inline bool IsStringMap(); |
| 6320 inline bool IsJSProxyMap(); | 6349 inline bool IsJSProxyMap(); |
| 6350 inline bool IsJSModuleMap(); |
| 6321 inline bool IsJSGlobalProxyMap(); | 6351 inline bool IsJSGlobalProxyMap(); |
| 6322 inline bool IsJSGlobalObjectMap(); | 6352 inline bool IsJSGlobalObjectMap(); |
| 6323 inline bool IsJSTypedArrayMap(); | 6353 inline bool IsJSTypedArrayMap(); |
| 6324 inline bool IsJSDataViewMap(); | 6354 inline bool IsJSDataViewMap(); |
| 6325 | 6355 |
| 6326 inline bool CanOmitMapChecks(); | 6356 inline bool CanOmitMapChecks(); |
| 6327 | 6357 |
| 6328 static void AddDependentCode(Handle<Map> map, | 6358 static void AddDependentCode(Handle<Map> map, |
| 6329 DependentCode::DependencyGroup group, | 6359 DependentCode::DependencyGroup group, |
| 6330 Handle<Code> code); | 6360 Handle<Code> code); |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7782 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; | 7812 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; |
| 7783 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; | 7813 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; |
| 7784 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; | 7814 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; |
| 7785 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; | 7815 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; |
| 7786 static const int kSize = kOperandStackOffset + kPointerSize; | 7816 static const int kSize = kOperandStackOffset + kPointerSize; |
| 7787 | 7817 |
| 7788 private: | 7818 private: |
| 7789 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); | 7819 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); |
| 7790 }; | 7820 }; |
| 7791 | 7821 |
| 7822 // A JSModule object is a mapping from export names to cells |
| 7823 // This is still very much in flux. |
| 7824 class JSModule : public JSObject { |
| 7825 public: |
| 7826 DECLARE_CAST(JSModule) |
| 7827 DECLARE_VERIFIER(JSModule) |
| 7828 |
| 7829 static const int kSize = JSObject::kHeaderSize; |
| 7830 |
| 7831 static void CreateExport(Handle<JSModule> module, Handle<String> name); |
| 7832 static void StoreExport(Handle<JSModule> module, Handle<String> name, |
| 7833 Handle<Object> value); |
| 7834 static Handle<Object> LoadExport(Handle<JSModule> module, |
| 7835 Handle<String> name); |
| 7836 }; |
| 7792 | 7837 |
| 7793 // JSBoundFunction describes a bound function exotic object. | 7838 // JSBoundFunction describes a bound function exotic object. |
| 7794 class JSBoundFunction : public JSObject { | 7839 class JSBoundFunction : public JSObject { |
| 7795 public: | 7840 public: |
| 7796 // [bound_target_function]: The wrapped function object. | 7841 // [bound_target_function]: The wrapped function object. |
| 7797 DECL_ACCESSORS(bound_target_function, JSReceiver) | 7842 DECL_ACCESSORS(bound_target_function, JSReceiver) |
| 7798 | 7843 |
| 7799 // [bound_this]: The value that is always passed as the this value when | 7844 // [bound_this]: The value that is always passed as the this value when |
| 7800 // calling the wrapped function. | 7845 // calling the wrapped function. |
| 7801 DECL_ACCESSORS(bound_this, Object) | 7846 DECL_ACCESSORS(bound_this, Object) |
| (...skipping 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11203 } | 11248 } |
| 11204 return value; | 11249 return value; |
| 11205 } | 11250 } |
| 11206 }; | 11251 }; |
| 11207 | 11252 |
| 11208 | 11253 |
| 11209 } // NOLINT, false-positive due to second-order macros. | 11254 } // NOLINT, false-positive due to second-order macros. |
| 11210 } // NOLINT, false-positive due to second-order macros. | 11255 } // NOLINT, false-positive due to second-order macros. |
| 11211 | 11256 |
| 11212 #endif // V8_OBJECTS_H_ | 11257 #endif // V8_OBJECTS_H_ |
| OLD | NEW |