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 7935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7946 | 7946 |
7947 // Storage for [[Evaluated]] | 7947 // Storage for [[Evaluated]] |
7948 DECL_INT_ACCESSORS(flags) | 7948 DECL_INT_ACCESSORS(flags) |
7949 | 7949 |
7950 // Embedder-specified data | 7950 // Embedder-specified data |
7951 DECL_ACCESSORS(embedder_data, Object) | 7951 DECL_ACCESSORS(embedder_data, Object) |
7952 | 7952 |
7953 // Get the ModuleInfo associated with the code. | 7953 // Get the ModuleInfo associated with the code. |
7954 inline ModuleInfo* info() const; | 7954 inline ModuleInfo* info() const; |
7955 | 7955 |
7956 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); | 7956 // Implementation of spec operation ModuleDeclarationInstantiation. |
| 7957 // Returns false if an exception occurred during instantiation, true |
| 7958 // otherwise. |
| 7959 static MUST_USE_RESULT bool Instantiate(Handle<Module> module, |
| 7960 v8::Local<v8::Context> context, |
| 7961 v8::Module::ResolveCallback callback, |
| 7962 v8::Local<v8::Value> callback_data); |
| 7963 |
7957 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); | 7964 static Handle<Object> LoadExport(Handle<Module> module, Handle<String> name); |
7958 static void StoreExport(Handle<Module> module, Handle<String> name, | 7965 static void StoreExport(Handle<Module> module, Handle<String> name, |
7959 Handle<Object> value); | 7966 Handle<Object> value); |
7960 | 7967 |
| 7968 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, |
| 7969 int module_request); |
| 7970 |
| 7971 static const int kCodeOffset = HeapObject::kHeaderSize; |
| 7972 static const int kExportsOffset = kCodeOffset + kPointerSize; |
| 7973 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; |
| 7974 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; |
| 7975 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; |
| 7976 static const int kSize = kEmbedderDataOffset + kPointerSize; |
| 7977 |
| 7978 private: |
| 7979 enum { kEvaluatedBit }; |
| 7980 |
| 7981 static void CreateExport(Handle<Module> module, Handle<FixedArray> names); |
7961 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, | 7982 static void CreateIndirectExport(Handle<Module> module, Handle<String> name, |
7962 Handle<ModuleInfoEntry> entry); | 7983 Handle<ModuleInfoEntry> entry); |
7963 | 7984 |
7964 static Handle<Object> LoadImport(Handle<Module> module, Handle<String> name, | |
7965 int module_request); | |
7966 | |
7967 // The [must_resolve] argument indicates whether or not an exception should be | 7985 // The [must_resolve] argument indicates whether or not an exception should be |
7968 // thrown if the module does not provide an export named [name]. | 7986 // thrown if the module does not provide an export named [name]. |
7969 // | 7987 // |
7970 // If [must_resolve] is true, a null result indicates an exception. If | 7988 // If [must_resolve] is true, a null result indicates an exception. If |
7971 // [must_resolve] is false, a null result does not necessarily indicate an | 7989 // [must_resolve] is false, a null result does not necessarily indicate an |
7972 // exception, but there may be one pending. | 7990 // exception, but there may be one pending. |
7973 // | 7991 // |
7974 // Currently, an exception is always thrown in the case of a cycle and in the | 7992 // Currently, an exception is always thrown in the case of a cycle and in the |
7975 // case of conflicting star exports. TODO(neis): Make that spec-compliant. | 7993 // case of conflicting star exports. TODO(neis): Make that spec-compliant. |
7976 static MUST_USE_RESULT MaybeHandle<Cell> ResolveExport(Handle<Module> module, | 7994 static MUST_USE_RESULT MaybeHandle<Cell> ResolveExport(Handle<Module> module, |
7977 Handle<String> name, | 7995 Handle<String> name, |
7978 bool must_resolve); | 7996 bool must_resolve); |
7979 static MUST_USE_RESULT MaybeHandle<Cell> ResolveImport(Handle<Module> module, | 7997 static MUST_USE_RESULT MaybeHandle<Cell> ResolveImport(Handle<Module> module, |
7980 Handle<String> name, | 7998 Handle<String> name, |
7981 int module_request, | 7999 int module_request, |
7982 bool must_resolve); | 8000 bool must_resolve); |
7983 | 8001 |
7984 static const int kCodeOffset = HeapObject::kHeaderSize; | |
7985 static const int kExportsOffset = kCodeOffset + kPointerSize; | |
7986 static const int kRequestedModulesOffset = kExportsOffset + kPointerSize; | |
7987 static const int kFlagsOffset = kRequestedModulesOffset + kPointerSize; | |
7988 static const int kEmbedderDataOffset = kFlagsOffset + kPointerSize; | |
7989 static const int kSize = kEmbedderDataOffset + kPointerSize; | |
7990 | |
7991 private: | |
7992 enum { kEvaluatedBit }; | |
7993 | |
7994 // Helper for ResolveExport. | 8002 // Helper for ResolveExport. |
7995 static MUST_USE_RESULT MaybeHandle<Cell> ResolveExportUsingStarExports( | 8003 static MUST_USE_RESULT MaybeHandle<Cell> ResolveExportUsingStarExports( |
7996 Handle<Module> module, Handle<String> name, bool must_resolve); | 8004 Handle<Module> module, Handle<String> name, bool must_resolve); |
7997 | 8005 |
7998 DISALLOW_IMPLICIT_CONSTRUCTORS(Module); | 8006 DISALLOW_IMPLICIT_CONSTRUCTORS(Module); |
7999 }; | 8007 }; |
8000 | 8008 |
8001 // JSBoundFunction describes a bound function exotic object. | 8009 // JSBoundFunction describes a bound function exotic object. |
8002 class JSBoundFunction : public JSObject { | 8010 class JSBoundFunction : public JSObject { |
8003 public: | 8011 public: |
(...skipping 3430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11434 } | 11442 } |
11435 return value; | 11443 return value; |
11436 } | 11444 } |
11437 }; | 11445 }; |
11438 | 11446 |
11439 | 11447 |
11440 } // NOLINT, false-positive due to second-order macros. | 11448 } // NOLINT, false-positive due to second-order macros. |
11441 } // NOLINT, false-positive due to second-order macros. | 11449 } // NOLINT, false-positive due to second-order macros. |
11442 | 11450 |
11443 #endif // V8_OBJECTS_H_ | 11451 #endif // V8_OBJECTS_H_ |
OLD | NEW |