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 7908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7919 // [[Evaluated]]: Whether this module has been evaluated. Modules | 7919 // [[Evaluated]]: Whether this module has been evaluated. Modules |
7920 // are only evaluated a single time. | 7920 // are only evaluated a single time. |
7921 DECL_BOOLEAN_ACCESSORS(evaluated) | 7921 DECL_BOOLEAN_ACCESSORS(evaluated) |
7922 | 7922 |
7923 // Storage for [[Evaluated]]. | 7923 // Storage for [[Evaluated]]. |
7924 DECL_INT_ACCESSORS(flags) | 7924 DECL_INT_ACCESSORS(flags) |
7925 | 7925 |
7926 // Embedder-specified data | 7926 // Embedder-specified data |
7927 DECL_ACCESSORS(embedder_data, Object) | 7927 DECL_ACCESSORS(embedder_data, Object) |
7928 | 7928 |
| 7929 // Hash for this object (a random non-zero Smi). |
| 7930 DECL_INT_ACCESSORS(hash) |
| 7931 |
7929 // Get the SharedFunctionInfo associated with the code. | 7932 // Get the SharedFunctionInfo associated with the code. |
7930 inline SharedFunctionInfo* shared() const; | 7933 inline SharedFunctionInfo* shared() const; |
7931 | 7934 |
7932 // Get the ModuleInfo associated with the code. | 7935 // Get the ModuleInfo associated with the code. |
7933 inline ModuleInfo* info() const; | 7936 inline ModuleInfo* info() const; |
7934 | 7937 |
7935 // Compute a hash for this object. | |
7936 inline uint32_t Hash() const; | |
7937 | |
7938 // Implementation of spec operation ModuleDeclarationInstantiation. | 7938 // Implementation of spec operation ModuleDeclarationInstantiation. |
7939 // Returns false if an exception occurred during instantiation, true | 7939 // Returns false if an exception occurred during instantiation, true |
7940 // otherwise. | 7940 // otherwise. |
7941 static MUST_USE_RESULT bool Instantiate(Handle<Module> module, | 7941 static MUST_USE_RESULT bool Instantiate(Handle<Module> module, |
7942 v8::Local<v8::Context> context, | 7942 v8::Local<v8::Context> context, |
7943 v8::Module::ResolveCallback callback, | 7943 v8::Module::ResolveCallback callback, |
7944 v8::Local<v8::Value> callback_data); | 7944 v8::Local<v8::Value> callback_data); |
7945 | 7945 |
7946 // Implementation of spec operation ModuleEvaluation. | 7946 // Implementation of spec operation ModuleEvaluation. |
7947 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); | 7947 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); |
7948 | 7948 |
7949 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); | 7949 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); |
7950 static void StoreExport(Handle<Module> module, Handle<String> name, | 7950 static void StoreExport(Handle<Module> module, Handle<String> name, |
7951 Handle<Object> value); | 7951 Handle<Object> value); |
7952 | 7952 |
7953 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, | 7953 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, |
7954 int module_request); | 7954 int module_request); |
7955 | 7955 |
7956 // Get the namespace object for [module_request] of [module]. If it doesn't | 7956 // Get the namespace object for [module_request] of [module]. If it doesn't |
7957 // exist yet, it is created. | 7957 // exist yet, it is created. |
7958 static Handle<JSModuleNamespace> GetModuleNamespace(Handle<Module> module, | 7958 static Handle<JSModuleNamespace> GetModuleNamespace(Handle<Module> module, |
7959 int module_request); | 7959 int module_request); |
7960 | 7960 |
7961 static const int kCodeOffset = HeapObject::kHeaderSize; | 7961 static const int kCodeOffset = HeapObject::kHeaderSize; |
7962 static const int kExportsOffset = kCodeOffset + kPointerSize; | 7962 static const int kExportsOffset = kCodeOffset + kPointerSize; |
7963 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; | 7963 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; |
7964 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; | 7964 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; |
7965 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; | 7965 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; |
7966 static const int kModuleNamespaceOffset = kEmbedderDataOffset + kPointerSize; | 7966 static const int kModuleNamespaceOffset = kEmbedderDataOffset + kPointerSize; |
7967 static const int kSize = kModuleNamespaceOffset + kPointerSize; | 7967 static const int kHashOffset = kModuleNamespaceOffset + kPointerSize; |
| 7968 static const int kSize = kHashOffset + kPointerSize; |
7968 | 7969 |
7969 private: | 7970 private: |
7970 enum { kEvaluatedBit }; | 7971 enum { kEvaluatedBit }; |
7971 | 7972 |
7972 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); | 7973 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); |
7973 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, | 7974 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, |
7974 Handle<ModuleInfoEntry> entry); | 7975 Handle<ModuleInfoEntry> entry); |
7975 | 7976 |
7976 // Get the namespace object for [module]. If it doesn't exist yet, it is | 7977 // Get the namespace object for [module]. If it doesn't exist yet, it is |
7977 // created. | 7978 // created. |
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11442 } | 11443 } |
11443 return value; | 11444 return value; |
11444 } | 11445 } |
11445 }; | 11446 }; |
11446 | 11447 |
11447 | 11448 |
11448 } // NOLINT, false-positive due to second-order macros. | 11449 } // NOLINT, false-positive due to second-order macros. |
11449 } // NOLINT, false-positive due to second-order macros. | 11450 } // NOLINT, false-positive due to second-order macros. |
11450 | 11451 |
11451 #endif // V8_OBJECTS_H_ | 11452 #endif // V8_OBJECTS_H_ |
OLD | NEW |