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 7885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7896 // [[Evaluated]]: Whether this module has been evaluated. Modules | 7896 // [[Evaluated]]: Whether this module has been evaluated. Modules |
7897 // are only evaluated a single time. | 7897 // are only evaluated a single time. |
7898 DECL_BOOLEAN_ACCESSORS(evaluated) | 7898 DECL_BOOLEAN_ACCESSORS(evaluated) |
7899 | 7899 |
7900 // Storage for [[Evaluated]] | 7900 // Storage for [[Evaluated]] |
7901 DECL_INT_ACCESSORS(flags) | 7901 DECL_INT_ACCESSORS(flags) |
7902 | 7902 |
7903 // Embedder-specified data | 7903 // Embedder-specified data |
7904 DECL_ACCESSORS(embedder_data, Object) | 7904 DECL_ACCESSORS(embedder_data, Object) |
7905 | 7905 |
7906 // Hash code for this object (a random non-zero Smi). | |
neis
2016/10/07 09:21:50
s/code // to avoid confusion in the following comm
adamk
2016/10/07 17:37:35
Done.
| |
7907 DECL_INT_ACCESSORS(hash) | |
7908 | |
7906 // Get the SharedFunctionInfo associated with the code. | 7909 // Get the SharedFunctionInfo associated with the code. |
7907 inline SharedFunctionInfo* shared() const; | 7910 inline SharedFunctionInfo* shared() const; |
7908 | 7911 |
7909 // Get the ModuleInfo associated with the code. | 7912 // Get the ModuleInfo associated with the code. |
7910 inline ModuleInfo* info() const; | 7913 inline ModuleInfo* info() const; |
7911 | 7914 |
7912 // Compute a hash for this object. | |
7913 inline uint32_t Hash() const; | |
7914 | |
7915 // Implementation of spec operation ModuleDeclarationInstantiation. | 7915 // Implementation of spec operation ModuleDeclarationInstantiation. |
7916 // Returns false if an exception occurred during instantiation, true | 7916 // Returns false if an exception occurred during instantiation, true |
7917 // otherwise. | 7917 // otherwise. |
7918 static MUST_USE_RESULT bool Instantiate(Handle<Module> module, | 7918 static MUST_USE_RESULT bool Instantiate(Handle<Module> module, |
7919 v8::Local<v8::Context> context, | 7919 v8::Local<v8::Context> context, |
7920 v8::Module::ResolveCallback callback, | 7920 v8::Module::ResolveCallback callback, |
7921 v8::Local<v8::Value> callback_data); | 7921 v8::Local<v8::Value> callback_data); |
7922 | 7922 |
7923 // Implementation of spec operation ModuleEvaluation. | 7923 // Implementation of spec operation ModuleEvaluation. |
7924 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); | 7924 static MUST_USE_RESULT MaybeHandle<Object> Evaluate(Handle<Module> module); |
7925 | 7925 |
7926 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); | 7926 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); |
7927 static void StoreExport(Handle<Module> module, Handle<String> name, | 7927 static void StoreExport(Handle<Module> module, Handle<String> name, |
7928 Handle<Object> value); | 7928 Handle<Object> value); |
7929 | 7929 |
7930 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, | 7930 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, |
7931 int module_request); | 7931 int module_request); |
7932 | 7932 |
7933 static const int kCodeOffset = HeapObject::kHeaderSize; | 7933 static const int kCodeOffset = HeapObject::kHeaderSize; |
7934 static const int kExportsOffset = kCodeOffset + kPointerSize; | 7934 static const int kExportsOffset = kCodeOffset + kPointerSize; |
7935 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; | 7935 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; |
7936 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; | 7936 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; |
7937 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; | 7937 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; |
7938 static const int kSize = kEmbedderDataOffset + kPointerSize; | 7938 static const int kHashOffset = kEmbedderDataOffset + kPointerSize; |
7939 static const int kSize = kHashOffset + kPointerSize; | |
7939 | 7940 |
7940 private: | 7941 private: |
7941 enum { kEvaluatedBit }; | 7942 enum { kEvaluatedBit }; |
7942 | 7943 |
7943 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); | 7944 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); |
7944 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, | 7945 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, |
7945 Handle<ModuleInfoEntry> entry); | 7946 Handle<ModuleInfoEntry> entry); |
7946 | 7947 |
7947 // The [must_resolve] argument indicates whether or not an exception should be | 7948 // The [must_resolve] argument indicates whether or not an exception should be |
7948 // thrown in case the module does not provide an export named [name] | 7949 // thrown in case the module does not provide an export named [name] |
(...skipping 3456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11405 } | 11406 } |
11406 return value; | 11407 return value; |
11407 } | 11408 } |
11408 }; | 11409 }; |
11409 | 11410 |
11410 | 11411 |
11411 } // NOLINT, false-positive due to second-order macros. | 11412 } // NOLINT, false-positive due to second-order macros. |
11412 } // NOLINT, false-positive due to second-order macros. | 11413 } // NOLINT, false-positive due to second-order macros. |
11413 | 11414 |
11414 #endif // V8_OBJECTS_H_ | 11415 #endif // V8_OBJECTS_H_ |
OLD | NEW |