Commit 0cddd59b authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Make SourceTextModule never-serialized

Bug: v8:7790
Change-Id: I9b4ae95e2caf23e6574d2b48ec8796fcf82cfcc9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2874656Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74398}
parent a87eefc8
......@@ -4002,7 +4002,7 @@ base::Optional<ObjectRef> JSArrayRef::GetOwnCowElement(
}
base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const {
if (data_->should_access_heap() || broker()->is_concurrent_inlining()) {
if (data_->should_access_heap()) {
return MakeRef(broker(), broker()->CanonicalPersistentHandle(
object()->GetCell(cell_index)));
}
......@@ -4012,9 +4012,9 @@ base::Optional<CellRef> SourceTextModuleRef::GetCell(int cell_index) const {
return CellRef(broker(), cell);
}
ObjectRef SourceTextModuleRef::import_meta() const {
base::Optional<ObjectRef> SourceTextModuleRef::import_meta() const {
if (data_->should_access_heap()) {
return MakeRef(
return TryMakeRef(
broker(), broker()->CanonicalPersistentHandle(object()->import_meta()));
}
return ObjectRef(broker(),
......
......@@ -131,7 +131,7 @@ enum class RefSerializationKind {
V(RegExpBoilerplateDescription, RefSerializationKind::kNeverSerialized) \
V(ScopeInfo, RefSerializationKind::kNeverSerialized) \
V(SharedFunctionInfo, RefSerializationKind::kNeverSerialized) \
V(SourceTextModule, RefSerializationKind::kSerialized) \
V(SourceTextModule, RefSerializationKind::kNeverSerialized) \
V(TemplateObjectDescription, RefSerializationKind::kNeverSerialized) \
/* Subtypes of Object */ \
V(HeapObject, RefSerializationKind::kBackgroundSerialized)
......@@ -975,7 +975,7 @@ class SourceTextModuleRef : public HeapObjectRef {
void Serialize();
base::Optional<CellRef> GetCell(int cell_index) const;
ObjectRef import_meta() const;
base::Optional<ObjectRef> import_meta() const;
};
class TemplateObjectDescriptionRef : public HeapObjectRef {
......
......@@ -259,17 +259,18 @@ Reduction JSContextSpecialization::ReduceJSGetImportMeta(Node* node) {
ContextRef context = maybe_context.value();
SourceTextModuleRef module =
context.get(Context::EXTENSION_INDEX).value().AsSourceTextModule();
ObjectRef import_meta = module.import_meta();
if (import_meta.IsJSObject()) {
Node* import_meta_const = jsgraph()->Constant(import_meta);
ReplaceWithValue(node, import_meta_const);
return Changed(import_meta_const);
} else {
DCHECK(import_meta.IsTheHole());
base::Optional<ObjectRef> import_meta = module.import_meta();
if (!import_meta.has_value()) return NoChange();
if (!import_meta->IsJSObject()) {
DCHECK(import_meta->IsTheHole());
// The import.meta object has not yet been created. Let JSGenericLowering
// replace the operator with a runtime call.
return NoChange();
}
Node* import_meta_const = jsgraph()->Constant(*import_meta);
ReplaceWithValue(node, import_meta_const);
return Changed(import_meta_const);
}
Isolate* JSContextSpecialization::isolate() const {
......
......@@ -571,7 +571,10 @@ template <class T,
base::Optional<typename ref_traits<T>::ref_type> TryMakeRef(
JSHeapBroker* broker, T object) {
ObjectData* data = broker->TryGetOrCreateData(object);
if (data == nullptr) return {};
if (data == nullptr) {
TRACE_BROKER_MISSING(broker, "ObjectData for " << Brief(object));
return {};
}
return {typename ref_traits<T>::ref_type(broker, data)};
}
......@@ -580,7 +583,10 @@ template <class T,
base::Optional<typename ref_traits<T>::ref_type> TryMakeRef(
JSHeapBroker* broker, Handle<T> object) {
ObjectData* data = broker->TryGetOrCreateData(object);
if (data == nullptr) return {};
if (data == nullptr) {
TRACE_BROKER_MISSING(broker, "ObjectData for " << Brief(*object));
return {};
}
return {typename ref_traits<T>::ref_type(broker, data)};
}
......
......@@ -29,7 +29,7 @@ extern class SourceTextModule extends Module {
// The value of import.meta inside of this module.
// Lazily initialized on first access. It's the hole before first access and
// a JSObject afterwards.
import_meta: TheHole|JSObject;
@acquireRead @releaseWrite import_meta: TheHole|JSObject;
// The first visited module of a cycle. For modules not in a cycle, this is
// the module itself. It's the hole before the module state transitions to
......
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