Commit d3cacbbb authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

Reland: ScopeInfo, SharedFunctionInfo never-ever serialized

This relands squashed CLs:

59b9aaf7
8f84d0bb

The revert was at crrev.com/c/2996198.

Changed: Fixed a test in which bytecode flushing caused a behavioral
change between serialized- and unserialized SFI Refs. The serialized
SFI ref kept bytecode alive while unserialized SFIs allow flushing.
The test was fixed by adding a %PrepareFunctionForOptimization
annotation.

No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7790, v8:11939
Change-Id: I170f8085bd7454a2a5f2bb03c8824e2862857827
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2999089
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75504}
parent 0e9c483c
This diff is collapsed.
...@@ -899,6 +899,8 @@ class V8_EXPORT_PRIVATE SharedFunctionInfoRef : public HeapObjectRef { ...@@ -899,6 +899,8 @@ class V8_EXPORT_PRIVATE SharedFunctionInfoRef : public HeapObjectRef {
int context_header_size() const; int context_header_size() const;
BytecodeArrayRef GetBytecodeArray() const; BytecodeArrayRef GetBytecodeArray() const;
SharedFunctionInfo::Inlineability GetInlineability() const; SharedFunctionInfo::Inlineability GetInlineability() const;
base::Optional<FunctionTemplateInfoRef> function_template_info() const;
ScopeInfoRef scope_info() const;
#define DECL_ACCESSOR(type, name) type name() const; #define DECL_ACCESSOR(type, name) type name() const;
BROKER_SFI_FIELDS(DECL_ACCESSOR) BROKER_SFI_FIELDS(DECL_ACCESSOR)
...@@ -907,12 +909,6 @@ class V8_EXPORT_PRIVATE SharedFunctionInfoRef : public HeapObjectRef { ...@@ -907,12 +909,6 @@ class V8_EXPORT_PRIVATE SharedFunctionInfoRef : public HeapObjectRef {
bool IsInlineable() const { bool IsInlineable() const {
return GetInlineability() == SharedFunctionInfo::kIsInlineable; return GetInlineability() == SharedFunctionInfo::kIsInlineable;
} }
void SerializeFunctionTemplateInfo();
base::Optional<FunctionTemplateInfoRef> function_template_info() const;
void SerializeScopeInfoChain();
ScopeInfoRef scope_info() const;
}; };
class StringRef : public NameRef { class StringRef : public NameRef {
......
...@@ -1783,12 +1783,6 @@ void SerializerForBackgroundCompilation::VisitForInPrepare( ...@@ -1783,12 +1783,6 @@ void SerializerForBackgroundCompilation::VisitForInPrepare(
void SerializerForBackgroundCompilation::ProcessCreateContext( void SerializerForBackgroundCompilation::ProcessCreateContext(
interpreter::BytecodeArrayIterator* iterator, int scopeinfo_operand_index) { interpreter::BytecodeArrayIterator* iterator, int scopeinfo_operand_index) {
Handle<ScopeInfo> scope_info =
Handle<ScopeInfo>::cast(iterator->GetConstantForIndexOperand(
scopeinfo_operand_index, broker()->isolate()));
ScopeInfoRef scope_info_ref = MakeRef(broker(), scope_info);
scope_info_ref.SerializeScopeInfoChain();
Hints const& current_context_hints = environment()->current_context_hints(); Hints const& current_context_hints = environment()->current_context_hints();
Hints result_hints; Hints result_hints;
...@@ -2245,9 +2239,6 @@ void SerializerForBackgroundCompilation::ProcessApiCall( ...@@ -2245,9 +2239,6 @@ void SerializerForBackgroundCompilation::ProcessApiCall(
if (!target_template_info.has_call_code()) return; if (!target_template_info.has_call_code()) return;
target_template_info.SerializeCallCode(); target_template_info.SerializeCallCode();
SharedFunctionInfoRef target_ref = MakeRef(broker(), target);
target_ref.SerializeFunctionTemplateInfo();
if (target_template_info.accept_any_receiver() && if (target_template_info.accept_any_receiver() &&
target_template_info.is_signature_undefined()) { target_template_info.is_signature_undefined()) {
return; return;
...@@ -2893,8 +2884,6 @@ void SerializerForBackgroundCompilation::ProcessCheckContextExtensions( ...@@ -2893,8 +2884,6 @@ void SerializerForBackgroundCompilation::ProcessCheckContextExtensions(
ProcessContextAccess(context_hints, Context::EXTENSION_INDEX, i, ProcessContextAccess(context_hints, Context::EXTENSION_INDEX, i,
kSerializeSlot); kSerializeSlot);
} }
SharedFunctionInfoRef shared = MakeRef(broker(), function().shared());
shared.SerializeScopeInfoChain();
} }
void SerializerForBackgroundCompilation::ProcessLdaLookupGlobalSlot( void SerializerForBackgroundCompilation::ProcessLdaLookupGlobalSlot(
......
...@@ -9,16 +9,18 @@ function TestMapConstructorEntrySideEffect(ctor) { ...@@ -9,16 +9,18 @@ function TestMapConstructorEntrySideEffect(ctor) {
const k1 = {}; const k1 = {};
const k2 = {}; const k2 = {};
let callCount = 0; let callCount = 0;
let prop = {
get() {
// Verify continuation retains original set function
ctor.prototype.set = () => {
callCount++;
};
return k1;
}
};
%PrepareFunctionForOptimization(prop.get); // To prevent flushing.
const input = [ const input = [
Object.defineProperty([, 1], "0", { Object.defineProperty([, 1], "0", prop),
get() {
// Verify continuation retains original set function
ctor.prototype.set = () => {
callCount++;
};
return k1;
}
}),
[k2, 2] [k2, 2]
]; ];
const col = new ctor(input); const col = new ctor(input);
......
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