Commit 03762b84 authored by marja's avatar marja Committed by Commit bot

objects.h splitting: move ModuleInfo

Including a fix: object-macros.h needs to be the last include: otherwise
we'll have a problem when a file does this:

#include "object-macros.h"
#include "x.h" // x.h also includes object-macros.h

BUG=v8:5402

Review-Url: https://codereview.chromium.org/2623573003
Cr-Commit-Position: refs/heads/master@{#42187}
parent bf67ce5f
...@@ -1544,6 +1544,7 @@ v8_source_set("v8_base") { ...@@ -1544,6 +1544,7 @@ v8_source_set("v8_base") {
"src/objects-printer.cc", "src/objects-printer.cc",
"src/objects.cc", "src/objects.cc",
"src/objects.h", "src/objects.h",
"src/objects/module-info.h",
"src/objects/object-macros-undef.h", "src/objects/object-macros-undef.h",
"src/objects/object-macros.h", "src/objects/object-macros.h",
"src/objects/scope-info.h", "src/objects/scope-info.h",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "src/ast/ast-value-factory.h" #include "src/ast/ast-value-factory.h"
#include "src/ast/scopes.h" #include "src/ast/scopes.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/objects/module-info.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
#include "src/accessors.h" #include "src/accessors.h"
#include "src/ast/ast.h" #include "src/ast/ast.h"
#include "src/bootstrapper.h" #include "src/bootstrapper.h"
#include "src/counters.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "src/objects/scope-info.h" #include "src/objects/module-info.h"
#include "src/parsing/parse-info.h" #include "src/parsing/parse-info.h"
namespace v8 { namespace v8 {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "src/base/hashmap.h" #include "src/base/hashmap.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/objects/scope-info.h"
#include "src/zone/zone.h" #include "src/zone/zone.h"
namespace v8 { namespace v8 {
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "src/conversions.h" #include "src/conversions.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/macro-assembler.h" #include "src/macro-assembler.h"
#include "src/objects/module-info.h"
#include "src/objects/scope-info.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "src/lookup-cache-inl.h" #include "src/lookup-cache-inl.h"
#include "src/lookup.h" #include "src/lookup.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/objects/module-info.h"
#include "src/objects/scope-info.h" #include "src/objects/scope-info.h"
#include "src/property.h" #include "src/property.h"
#include "src/prototype.h" #include "src/prototype.h"
...@@ -8083,35 +8084,6 @@ SMI_ACCESSORS(ModuleInfoEntry, cell_index, kCellIndexOffset) ...@@ -8083,35 +8084,6 @@ SMI_ACCESSORS(ModuleInfoEntry, cell_index, kCellIndexOffset)
SMI_ACCESSORS(ModuleInfoEntry, beg_pos, kBegPosOffset) SMI_ACCESSORS(ModuleInfoEntry, beg_pos, kBegPosOffset)
SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset) SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset)
FixedArray* ModuleInfo::module_requests() const {
return FixedArray::cast(get(kModuleRequestsIndex));
}
FixedArray* ModuleInfo::special_exports() const {
return FixedArray::cast(get(kSpecialExportsIndex));
}
FixedArray* ModuleInfo::regular_exports() const {
return FixedArray::cast(get(kRegularExportsIndex));
}
FixedArray* ModuleInfo::regular_imports() const {
return FixedArray::cast(get(kRegularImportsIndex));
}
FixedArray* ModuleInfo::namespace_imports() const {
return FixedArray::cast(get(kNamespaceImportsIndex));
}
#ifdef DEBUG
bool ModuleInfo::Equals(ModuleInfo* other) const {
return regular_exports() == other->regular_exports() &&
regular_imports() == other->regular_imports() &&
special_exports() == other->special_exports() &&
namespace_imports() == other->namespace_imports();
}
#endif
void Map::ClearCodeCache(Heap* heap) { void Map::ClearCodeCache(Heap* heap) {
// No write barrier is needed since empty_fixed_array is not in new space. // No write barrier is needed since empty_fixed_array is not in new space.
// Please note this function is used during marking: // Please note this function is used during marking:
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "src/flags.h" #include "src/flags.h"
#include "src/list.h" #include "src/list.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/objects/object-macros.h"
#include "src/property-details.h" #include "src/property-details.h"
#include "src/unicode-decoder.h" #include "src/unicode-decoder.h"
#include "src/unicode.h" #include "src/unicode.h"
...@@ -39,6 +38,8 @@ ...@@ -39,6 +38,8 @@
#include "src/s390/constants-s390.h" // NOLINT #include "src/s390/constants-s390.h" // NOLINT
#endif #endif
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
// //
// Most object types in the V8 JavaScript are described in this file. // Most object types in the V8 JavaScript are described in this file.
...@@ -168,6 +169,7 @@ ...@@ -168,6 +169,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class ModuleInfo;
struct InliningPosition; struct InliningPosition;
enum KeyedAccessStoreMode { enum KeyedAccessStoreMode {
...@@ -7960,52 +7962,6 @@ class ModuleInfoEntry : public Struct { ...@@ -7960,52 +7962,6 @@ class ModuleInfoEntry : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfoEntry); DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfoEntry);
}; };
// ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
class ModuleInfo : public FixedArray {
public:
DECLARE_CAST(ModuleInfo)
static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone,
ModuleDescriptor* descr);
inline FixedArray* module_requests() const;
inline FixedArray* special_exports() const;
inline FixedArray* regular_exports() const;
inline FixedArray* namespace_imports() const;
inline FixedArray* regular_imports() const;
// Accessors for [regular_exports].
int RegularExportCount() const;
String* RegularExportLocalName(int i) const;
int RegularExportCellIndex(int i) const;
FixedArray* RegularExportExportNames(int i) const;
static Handle<ModuleInfoEntry> LookupRegularImport(Handle<ModuleInfo> info,
Handle<String> local_name);
#ifdef DEBUG
inline bool Equals(ModuleInfo* other) const;
#endif
private:
friend class Factory;
friend class ModuleDescriptor;
enum {
kModuleRequestsIndex,
kSpecialExportsIndex,
kRegularExportsIndex,
kNamespaceImportsIndex,
kRegularImportsIndex,
kLength
};
enum {
kRegularExportLocalNameOffset,
kRegularExportCellIndexOffset,
kRegularExportExportNamesOffset,
kRegularExportLength
};
DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfo);
};
// When importing a module namespace (import * as foo from "bar"), a // When importing a module namespace (import * as foo from "bar"), a
// JSModuleNamespace object (representing module "bar") is created and bound to // JSModuleNamespace object (representing module "bar") is created and bound to
// the declared variable (foo). A module can have at most one namespace object. // the declared variable (foo). A module can have at most one namespace object.
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_MODULE_INFO_H_
#define V8_OBJECTS_MODULE_INFO_H_
#include "src/objects.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
template <typename T>
class Handle;
class Isolate;
class ModuleDescriptor;
class ModuleInfoEntry;
class String;
class Zone;
// ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
class ModuleInfo : public FixedArray {
public:
DECLARE_CAST(ModuleInfo)
static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone,
ModuleDescriptor* descr);
inline FixedArray* module_requests() const {
return FixedArray::cast(get(kModuleRequestsIndex));
}
inline FixedArray* special_exports() const {
return FixedArray::cast(get(kSpecialExportsIndex));
}
inline FixedArray* regular_exports() const {
return FixedArray::cast(get(kRegularExportsIndex));
}
inline FixedArray* regular_imports() const {
return FixedArray::cast(get(kRegularImportsIndex));
}
inline FixedArray* namespace_imports() const {
return FixedArray::cast(get(kNamespaceImportsIndex));
}
// Accessors for [regular_exports].
int RegularExportCount() const;
String* RegularExportLocalName(int i) const;
int RegularExportCellIndex(int i) const;
FixedArray* RegularExportExportNames(int i) const;
static Handle<ModuleInfoEntry> LookupRegularImport(Handle<ModuleInfo> info,
Handle<String> local_name);
#ifdef DEBUG
inline bool Equals(ModuleInfo* other) const {
return regular_exports() == other->regular_exports() &&
regular_imports() == other->regular_imports() &&
special_exports() == other->special_exports() &&
namespace_imports() == other->namespace_imports();
}
#endif
private:
friend class Factory;
friend class ModuleDescriptor;
enum {
kModuleRequestsIndex,
kSpecialExportsIndex,
kRegularExportsIndex,
kNamespaceImportsIndex,
kRegularImportsIndex,
kLength
};
enum {
kRegularExportLocalNameOffset,
kRegularExportCellIndexOffset,
kRegularExportExportNamesOffset,
kRegularExportLength
};
DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfo);
};
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_MODULE_INFO_H_
...@@ -8,9 +8,11 @@ ...@@ -8,9 +8,11 @@
#include "src/globals.h" #include "src/globals.h"
#include "src/handles.h" #include "src/handles.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/objects/object-macros.h"
#include "src/utils.h" #include "src/utils.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
......
...@@ -1075,6 +1075,7 @@ ...@@ -1075,6 +1075,7 @@
'objects-printer.cc', 'objects-printer.cc',
'objects.cc', 'objects.cc',
'objects.h', 'objects.h',
'objects/module-info.h',
'objects/object-macros.h', 'objects/object-macros.h',
'objects/object-macros-undef.h', 'objects/object-macros-undef.h',
'objects/scope-info.h', 'objects/scope-info.h',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment