Commit 934e8d3a authored by Mythri A's avatar Mythri A Committed by V8 LUCI CQ

[sparkplug] Retain baseline data in IsCompiledScope

With baseline code flushing we also need to hold baseline
data in IsCompiledScope. IsCompiledScope is used in places where we
don't want bytecode / baseline code to be flushed.

Change-Id: I692cdc5fc433dedeabcfc412d9f96d76148ddbe3
BUG: v8:12009
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3048172
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75903}
parent 8b385ee8
...@@ -466,21 +466,31 @@ IsCompiledScope SharedFunctionInfo::is_compiled_scope(IsolateT* isolate) const { ...@@ -466,21 +466,31 @@ IsCompiledScope SharedFunctionInfo::is_compiled_scope(IsolateT* isolate) const {
IsCompiledScope::IsCompiledScope(const SharedFunctionInfo shared, IsCompiledScope::IsCompiledScope(const SharedFunctionInfo shared,
Isolate* isolate) Isolate* isolate)
: retain_bytecode_(shared.HasBytecodeArray() : is_compiled_(shared.is_compiled()) {
? handle(shared.GetBytecodeArray(isolate), isolate) if (shared.HasBytecodeArray()) {
: MaybeHandle<BytecodeArray>()), retain_code_ = handle(shared.GetBytecodeArray(isolate), isolate);
is_compiled_(shared.is_compiled()) { } else if (shared.HasBaselineData()) {
DCHECK_IMPLIES(!retain_bytecode_.is_null(), is_compiled()); retain_code_ = handle(shared.baseline_data(), isolate);
} else {
retain_code_ = MaybeHandle<HeapObject>();
}
DCHECK_IMPLIES(!retain_code_.is_null(), is_compiled());
} }
IsCompiledScope::IsCompiledScope(const SharedFunctionInfo shared, IsCompiledScope::IsCompiledScope(const SharedFunctionInfo shared,
LocalIsolate* isolate) LocalIsolate* isolate)
: retain_bytecode_(shared.HasBytecodeArray() : is_compiled_(shared.is_compiled()) {
? isolate->heap()->NewPersistentHandle( if (shared.HasBytecodeArray()) {
shared.GetBytecodeArray(isolate)) retain_code_ =
: MaybeHandle<BytecodeArray>()), isolate->heap()->NewPersistentHandle(shared.GetBytecodeArray(isolate));
is_compiled_(shared.is_compiled()) { } else if (shared.HasBaselineData()) {
DCHECK_IMPLIES(!retain_bytecode_.is_null(), is_compiled()); retain_code_ = isolate->heap()->NewPersistentHandle(shared.baseline_data());
} else {
retain_code_ = MaybeHandle<HeapObject>();
}
DCHECK_IMPLIES(!retain_code_.is_null(), is_compiled());
} }
bool SharedFunctionInfo::has_simple_parameters() { bool SharedFunctionInfo::has_simple_parameters() {
......
...@@ -691,12 +691,12 @@ class V8_NODISCARD IsCompiledScope { ...@@ -691,12 +691,12 @@ class V8_NODISCARD IsCompiledScope {
inline IsCompiledScope(const SharedFunctionInfo shared, Isolate* isolate); inline IsCompiledScope(const SharedFunctionInfo shared, Isolate* isolate);
inline IsCompiledScope(const SharedFunctionInfo shared, inline IsCompiledScope(const SharedFunctionInfo shared,
LocalIsolate* isolate); LocalIsolate* isolate);
inline IsCompiledScope() : retain_bytecode_(), is_compiled_(false) {} inline IsCompiledScope() : retain_code_(), is_compiled_(false) {}
inline bool is_compiled() const { return is_compiled_; } inline bool is_compiled() const { return is_compiled_; }
private: private:
MaybeHandle<BytecodeArray> retain_bytecode_; MaybeHandle<HeapObject> retain_code_;
bool is_compiled_; bool is_compiled_;
}; };
......
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