[handles] Migration to direct handles, part 3
This CL migrates a large number of handles to direct handles. The changes are only relevant for builds with v8_enable_direct_handle=true. Affected source directories: ast, baseline, codegen, compiler, d8, diagnostics, extensions, ic, init, interpreter, logging, maglev, parsing, profiler. Bug: 42203211 Change-Id: I3ca12892acfe45f8458d19aa4cbd56ad01842c0a Cq-Include-Trybots: luci.v8.try:v8_linux64_css_dbg Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5615411 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Omer Katz <omerkatz@chromium.org> Commit-Queue: Nikolaos Papaspyrou <nikolaos@chromium.org> Cr-Commit-Position: refs/heads/main@{#94363}
This commit is contained in:
1 parent
3c095e99f8
commit
82f85a3919
64 files changed
+628
-581
No files matched your search
+4
-3
@@ -512,13 +512,14 @@ void ObjectLiteralBoilerplateBuilder::BuildBoilerplateDescription(
|
||||
// in at runtime. The enumeration order is maintained.
|
||||
Literal* key_literal = property->key()->AsLiteral();
|
||||
uint32_t element_index = 0;
|
||||
Handle<Object> key =
|
||||
DirectHandle<Object> key =
|
||||
key_literal->AsArrayIndex(&element_index)
|
||||
? isolate->factory()
|
||||
->template NewNumberFromUint<AllocationType::kOld>(
|
||||
element_index)
|
||||
: Handle<Object>::cast(key_literal->AsRawPropertyName()->string());
|
||||
Handle<Object> value = GetBoilerplateValue(property->value(), isolate);
|
||||
: Cast<Object>(key_literal->AsRawPropertyName()->string());
|
||||
DirectHandle<Object> value =
|
||||
GetBoilerplateValue(property->value(), isolate);
|
||||
boilerplate_description->set_key_value(position++, *key, *value);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void CallPrinter::Print(const char* str) {
|
||||
builder_.AppendCString(str);
|
||||
}
|
||||
|
||||
void CallPrinter::Print(Handle<String> str) {
|
||||
void CallPrinter::Print(DirectHandle<String> str) {
|
||||
if (!found_ || done_) return;
|
||||
num_prints_++;
|
||||
builder_.AppendString(str);
|
||||
|
||||
@@ -51,7 +51,7 @@ class CallPrinter final : public AstVisitor<CallPrinter> {
|
||||
private:
|
||||
void Print(char c);
|
||||
void Print(const char* str);
|
||||
void Print(Handle<String> str);
|
||||
void Print(DirectHandle<String> str);
|
||||
|
||||
void Find(AstNode* node, bool print = false);
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ class BaselineCompilerTask {
|
||||
|
||||
class BaselineBatchCompilerJob {
|
||||
public:
|
||||
BaselineBatchCompilerJob(Isolate* isolate, Handle<WeakFixedArray> task_queue,
|
||||
BaselineBatchCompilerJob(Isolate* isolate,
|
||||
DirectHandle<WeakFixedArray> task_queue,
|
||||
int batch_size) {
|
||||
handles_ = isolate->NewPersistentHandles();
|
||||
tasks_.reserve(batch_size);
|
||||
@@ -253,7 +254,7 @@ bool BaselineBatchCompiler::concurrent() const {
|
||||
}
|
||||
|
||||
void BaselineBatchCompiler::EnqueueFunction(Handle<JSFunction> function) {
|
||||
Handle<SharedFunctionInfo> shared(function->shared(), isolate_);
|
||||
DirectHandle<SharedFunctionInfo> shared(function->shared(), isolate_);
|
||||
// Immediately compile the function if batch compilation is disabled.
|
||||
if (!is_enabled()) {
|
||||
IsCompiledScope is_compiled_scope(
|
||||
@@ -282,7 +283,7 @@ void BaselineBatchCompiler::EnqueueSFI(Tagged<SharedFunctionInfo> shared) {
|
||||
}
|
||||
}
|
||||
|
||||
void BaselineBatchCompiler::Enqueue(Handle<SharedFunctionInfo> shared) {
|
||||
void BaselineBatchCompiler::Enqueue(DirectHandle<SharedFunctionInfo> shared) {
|
||||
EnsureQueueCapacity();
|
||||
compilation_queue_->set(last_index_++, MakeWeak(*shared));
|
||||
}
|
||||
@@ -300,7 +301,7 @@ void BaselineBatchCompiler::EnsureQueueCapacity() {
|
||||
return;
|
||||
}
|
||||
if (last_index_ >= compilation_queue_->length()) {
|
||||
Handle<WeakFixedArray> new_queue =
|
||||
DirectHandle<WeakFixedArray> new_queue =
|
||||
isolate_->factory()->CopyWeakFixedArrayAndGrow(compilation_queue_,
|
||||
last_index_);
|
||||
GlobalHandles::Destroy(compilation_queue_.location());
|
||||
|
||||
@@ -40,7 +40,7 @@ class BaselineBatchCompiler {
|
||||
void EnsureQueueCapacity();
|
||||
|
||||
// Enqueues SharedFunctionInfo.
|
||||
void Enqueue(Handle<SharedFunctionInfo> shared);
|
||||
void Enqueue(DirectHandle<SharedFunctionInfo> shared);
|
||||
|
||||
// Returns true if the current batch exceeds the threshold and should be
|
||||
// compiled.
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace detail {
|
||||
|
||||
#ifdef DEBUG
|
||||
bool Clobbers(Register target, Register reg) { return target == reg; }
|
||||
bool Clobbers(Register target, Handle<Object> handle) { return false; }
|
||||
bool Clobbers(Register target, DirectHandle<Object> handle) { return false; }
|
||||
bool Clobbers(Register target, Tagged<Smi> smi) { return false; }
|
||||
bool Clobbers(Register target, Tagged<TaggedIndex> index) { return false; }
|
||||
bool Clobbers(Register target, int32_t imm) { return false; }
|
||||
@@ -85,7 +85,7 @@ bool Clobbers(Register target, interpreter::RegisterList list) { return false; }
|
||||
// match.
|
||||
bool MachineTypeMatches(MachineType type, Register reg) { return true; }
|
||||
bool MachineTypeMatches(MachineType type, MemOperand reg) { return true; }
|
||||
bool MachineTypeMatches(MachineType type, Handle<HeapObject> handle) {
|
||||
bool MachineTypeMatches(MachineType type, DirectHandle<HeapObject> handle) {
|
||||
return type.IsTagged() && !type.IsTaggedSigned();
|
||||
}
|
||||
bool MachineTypeMatches(MachineType type, Tagged<Smi> handle) {
|
||||
@@ -258,7 +258,7 @@ const int kAverageBytecodeToInstructionRatio = 5;
|
||||
const int kAverageBytecodeToInstructionRatio = 7;
|
||||
#endif
|
||||
std::unique_ptr<AssemblerBuffer> AllocateBuffer(
|
||||
Handle<BytecodeArray> bytecodes) {
|
||||
DirectHandle<BytecodeArray> bytecodes) {
|
||||
int estimated_size;
|
||||
{
|
||||
DisallowHeapAllocation no_gc;
|
||||
|
||||
@@ -34,19 +34,20 @@ class V8_EXPORT_PRIVATE BackgroundMergeTask {
|
||||
// Alternative step 1: on the main thread, if the caller has already looked up
|
||||
// the script in the Isolate compilation cache, set up the necessary
|
||||
// persistent data for the background merge.
|
||||
void SetUpOnMainThread(Isolate* isolate, Handle<Script> cached_script);
|
||||
void SetUpOnMainThread(Isolate* isolate, DirectHandle<Script> cached_script);
|
||||
|
||||
// Step 2: on the background thread, update pointers in the new Script's
|
||||
// object graph to point to corresponding objects from the cached Script where
|
||||
// appropriate. May only be called if HasPendingBackgroundWork returned true.
|
||||
void BeginMergeInBackground(LocalIsolate* isolate, Handle<Script> new_script);
|
||||
void BeginMergeInBackground(LocalIsolate* isolate,
|
||||
DirectHandle<Script> new_script);
|
||||
|
||||
// Step 3: on the main thread again, complete the merge so that all relevant
|
||||
// objects are reachable from the cached Script. May only be called if
|
||||
// HasPendingForegroundWork returned true. Returns the top-level
|
||||
// SharedFunctionInfo that should be used.
|
||||
Handle<SharedFunctionInfo> CompleteMergeInForeground(
|
||||
Isolate* isolate, Handle<Script> new_script);
|
||||
Isolate* isolate, DirectHandle<Script> new_script);
|
||||
|
||||
bool HasPendingBackgroundWork() const {
|
||||
return state_ == kPendingBackgroundWork;
|
||||
|
||||
@@ -145,7 +145,7 @@ void CompilationCacheRegExp::Clear() {
|
||||
}
|
||||
|
||||
void CompilationCacheEvalOrScript::Remove(
|
||||
Handle<SharedFunctionInfo> function_info) {
|
||||
DirectHandle<SharedFunctionInfo> function_info) {
|
||||
if (IsUndefined(table_, isolate())) return;
|
||||
CompilationCacheTable::cast(table_)->Remove(*function_info);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ CompilationCacheScript::LookupResult CompilationCacheScript::Lookup(
|
||||
// into the caller's handle scope.
|
||||
{
|
||||
HandleScope scope(isolate());
|
||||
Handle<CompilationCacheTable> table = GetTable();
|
||||
DirectHandle<CompilationCacheTable> table = GetTable();
|
||||
LookupResult probe = CompilationCacheTable::LookupScript(
|
||||
table, source, script_details, isolate());
|
||||
raw_result_for_escaping_handle_scope = probe.GetRawObjects();
|
||||
@@ -185,8 +185,8 @@ CompilationCacheScript::LookupResult CompilationCacheScript::Lookup(
|
||||
return result;
|
||||
}
|
||||
|
||||
void CompilationCacheScript::Put(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> function_info) {
|
||||
void CompilationCacheScript::Put(
|
||||
Handle<String> source, DirectHandle<SharedFunctionInfo> function_info) {
|
||||
HandleScope scope(isolate());
|
||||
Handle<CompilationCacheTable> table = GetTable();
|
||||
table_ = *CompilationCacheTable::PutScript(table, source, kNullMaybeHandle,
|
||||
@@ -195,7 +195,7 @@ void CompilationCacheScript::Put(Handle<String> source,
|
||||
|
||||
InfoCellPair CompilationCacheEval::Lookup(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> native_context,
|
||||
DirectHandle<Context> native_context,
|
||||
LanguageMode language_mode,
|
||||
int position) {
|
||||
HandleScope scope(isolate());
|
||||
@@ -203,7 +203,7 @@ InfoCellPair CompilationCacheEval::Lookup(Handle<String> source,
|
||||
// scope. Otherwise, we risk keeping old tables around even after
|
||||
// having cleared the cache.
|
||||
InfoCellPair result;
|
||||
Handle<CompilationCacheTable> table = GetTable();
|
||||
DirectHandle<CompilationCacheTable> table = GetTable();
|
||||
result = CompilationCacheTable::LookupEval(
|
||||
table, source, outer_info, native_context, language_mode, position);
|
||||
if (result.has_shared()) {
|
||||
@@ -216,9 +216,9 @@ InfoCellPair CompilationCacheEval::Lookup(Handle<String> source,
|
||||
|
||||
void CompilationCacheEval::Put(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<SharedFunctionInfo> function_info,
|
||||
Handle<Context> native_context,
|
||||
Handle<FeedbackCell> feedback_cell,
|
||||
DirectHandle<SharedFunctionInfo> function_info,
|
||||
DirectHandle<Context> native_context,
|
||||
DirectHandle<FeedbackCell> feedback_cell,
|
||||
int position) {
|
||||
HandleScope scope(isolate());
|
||||
Handle<CompilationCacheTable> table = GetTable();
|
||||
@@ -236,7 +236,7 @@ MaybeHandle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
|
||||
Handle<Object> result = isolate()->factory()->undefined_value();
|
||||
int generation;
|
||||
for (generation = 0; generation < kGenerations; generation++) {
|
||||
Handle<CompilationCacheTable> table = GetTable(generation);
|
||||
DirectHandle<CompilationCacheTable> table = GetTable(generation);
|
||||
result = table->LookupRegExp(source, flags);
|
||||
if (IsFixedArray(*result)) break;
|
||||
}
|
||||
@@ -254,14 +254,14 @@ MaybeHandle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
|
||||
}
|
||||
|
||||
void CompilationCacheRegExp::Put(Handle<String> source, JSRegExp::Flags flags,
|
||||
Handle<FixedArray> data) {
|
||||
DirectHandle<FixedArray> data) {
|
||||
HandleScope scope(isolate());
|
||||
Handle<CompilationCacheTable> table = GetTable(0);
|
||||
tables_[0] =
|
||||
*CompilationCacheTable::PutRegExp(isolate(), table, source, flags, data);
|
||||
}
|
||||
|
||||
void CompilationCache::Remove(Handle<SharedFunctionInfo> function_info) {
|
||||
void CompilationCache::Remove(DirectHandle<SharedFunctionInfo> function_info) {
|
||||
if (!IsEnabledScriptAndEval()) return;
|
||||
|
||||
eval_global_.Remove(function_info);
|
||||
@@ -278,7 +278,7 @@ CompilationCacheScript::LookupResult CompilationCache::LookupScript(
|
||||
|
||||
InfoCellPair CompilationCache::LookupEval(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context,
|
||||
DirectHandle<Context> context,
|
||||
LanguageMode language_mode,
|
||||
int position) {
|
||||
InfoCellPair result;
|
||||
@@ -293,7 +293,7 @@ InfoCellPair CompilationCache::LookupEval(Handle<String> source,
|
||||
|
||||
} else {
|
||||
DCHECK_NE(position, kNoSourcePosition);
|
||||
Handle<Context> native_context(context->native_context(), isolate());
|
||||
DirectHandle<Context> native_context(context->native_context(), isolate());
|
||||
result = eval_contextual_.Lookup(source, outer_info, native_context,
|
||||
language_mode, position);
|
||||
cache_type = "eval-contextual";
|
||||
@@ -323,7 +323,7 @@ void CompilationCache::PutScript(Handle<String> source,
|
||||
void CompilationCache::PutEval(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context,
|
||||
Handle<SharedFunctionInfo> function_info,
|
||||
DirectHandle<SharedFunctionInfo> function_info,
|
||||
Handle<FeedbackCell> feedback_cell,
|
||||
int position) {
|
||||
if (!IsEnabledScriptAndEval()) return;
|
||||
@@ -345,7 +345,7 @@ void CompilationCache::PutEval(Handle<String> source,
|
||||
}
|
||||
|
||||
void CompilationCache::PutRegExp(Handle<String> source, JSRegExp::Flags flags,
|
||||
Handle<FixedArray> data) {
|
||||
DirectHandle<FixedArray> data) {
|
||||
reg_exp_.Put(source, flags, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class CompilationCacheEvalOrScript {
|
||||
void Clear();
|
||||
|
||||
// Removes given shared function info from sub-cache.
|
||||
void Remove(Handle<SharedFunctionInfo> function_info);
|
||||
void Remove(DirectHandle<SharedFunctionInfo> function_info);
|
||||
|
||||
protected:
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
@@ -55,7 +55,8 @@ class CompilationCacheScript : public CompilationCacheEvalOrScript {
|
||||
LookupResult Lookup(Handle<String> source,
|
||||
const ScriptDetails& script_details);
|
||||
|
||||
void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info);
|
||||
void Put(Handle<String> source,
|
||||
DirectHandle<SharedFunctionInfo> function_info);
|
||||
|
||||
void Age();
|
||||
|
||||
@@ -82,13 +83,13 @@ class CompilationCacheEval : public CompilationCacheEvalOrScript {
|
||||
|
||||
InfoCellPair Lookup(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> native_context,
|
||||
DirectHandle<Context> native_context,
|
||||
LanguageMode language_mode, int position);
|
||||
|
||||
void Put(Handle<String> source, Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<SharedFunctionInfo> function_info,
|
||||
Handle<Context> native_context, Handle<FeedbackCell> feedback_cell,
|
||||
int position);
|
||||
DirectHandle<SharedFunctionInfo> function_info,
|
||||
DirectHandle<Context> native_context,
|
||||
DirectHandle<FeedbackCell> feedback_cell, int position);
|
||||
|
||||
void Age();
|
||||
|
||||
@@ -104,7 +105,7 @@ class CompilationCacheRegExp {
|
||||
MaybeHandle<FixedArray> Lookup(Handle<String> source, JSRegExp::Flags flags);
|
||||
|
||||
void Put(Handle<String> source, JSRegExp::Flags flags,
|
||||
Handle<FixedArray> data);
|
||||
DirectHandle<FixedArray> data);
|
||||
|
||||
// The number of generations for the RegExp sub cache.
|
||||
static const int kGenerations = 2;
|
||||
@@ -153,8 +154,8 @@ class V8_EXPORT_PRIVATE CompilationCache {
|
||||
// contain a script for the given source string.
|
||||
InfoCellPair LookupEval(Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context, LanguageMode language_mode,
|
||||
int position);
|
||||
DirectHandle<Context> context,
|
||||
LanguageMode language_mode, int position);
|
||||
|
||||
// Returns the regexp data associated with the given regexp if it
|
||||
// is in cache, otherwise an empty handle.
|
||||
@@ -170,19 +171,19 @@ class V8_EXPORT_PRIVATE CompilationCache {
|
||||
// with the shared function info. This may overwrite an existing mapping.
|
||||
void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context,
|
||||
Handle<SharedFunctionInfo> function_info,
|
||||
DirectHandle<SharedFunctionInfo> function_info,
|
||||
Handle<FeedbackCell> feedback_cell, int position);
|
||||
|
||||
// Associate the (source, flags) pair to the given regexp data.
|
||||
// This may overwrite an existing mapping.
|
||||
void PutRegExp(Handle<String> source, JSRegExp::Flags flags,
|
||||
Handle<FixedArray> data);
|
||||
DirectHandle<FixedArray> data);
|
||||
|
||||
// Clear the cache - also used to initialize the cache at startup.
|
||||
void Clear();
|
||||
|
||||
// Remove given shared function info from all caches.
|
||||
void Remove(Handle<SharedFunctionInfo> function_info);
|
||||
void Remove(DirectHandle<SharedFunctionInfo> function_info);
|
||||
|
||||
// GC support.
|
||||
void Iterate(RootVisitor* v);
|
||||
|
||||
+73
-69
@@ -97,8 +97,8 @@ void ResetTieringState(IsolateForSandbox isolate, Tagged<JSFunction> function,
|
||||
|
||||
class CompilerTracer : public AllStatic {
|
||||
public:
|
||||
static void TraceStartBaselineCompile(Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> shared) {
|
||||
static void TraceStartBaselineCompile(
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared) {
|
||||
if (!v8_flags.trace_baseline) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintTracePrefix(scope, "compiling method", shared, CodeKind::BASELINE);
|
||||
@@ -106,8 +106,8 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceStartMaglevCompile(Isolate* isolate,
|
||||
Handle<JSFunction> function, bool osr,
|
||||
ConcurrencyMode mode) {
|
||||
DirectHandle<JSFunction> function,
|
||||
bool osr, ConcurrencyMode mode) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintTracePrefix(scope, "compiling method", function, CodeKind::MAGLEV);
|
||||
@@ -127,7 +127,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizeOSRStarted(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset,
|
||||
ConcurrencyMode mode) {
|
||||
if (!v8_flags.trace_osr) return;
|
||||
@@ -139,7 +139,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizeOSRFinished(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset) {
|
||||
if (!v8_flags.trace_osr) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
@@ -149,7 +149,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizeOSRAvailable(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset,
|
||||
ConcurrencyMode mode) {
|
||||
if (!v8_flags.trace_osr) return;
|
||||
@@ -161,7 +161,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizeOSRUnavailable(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset,
|
||||
ConcurrencyMode mode) {
|
||||
if (!v8_flags.trace_osr) return;
|
||||
@@ -187,9 +187,9 @@ class CompilerTracer : public AllStatic {
|
||||
PrintTraceSuffix(scope);
|
||||
}
|
||||
|
||||
static void TraceFinishBaselineCompile(Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
double ms_timetaken) {
|
||||
static void TraceFinishBaselineCompile(
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared,
|
||||
double ms_timetaken) {
|
||||
if (!v8_flags.trace_baseline) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintTracePrefix(scope, "completed compiling", shared, CodeKind::BASELINE);
|
||||
@@ -198,9 +198,9 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceFinishMaglevCompile(Isolate* isolate,
|
||||
Handle<JSFunction> function, bool osr,
|
||||
double ms_prepare, double ms_execute,
|
||||
double ms_finalize) {
|
||||
DirectHandle<JSFunction> function,
|
||||
bool osr, double ms_prepare,
|
||||
double ms_execute, double ms_finalize) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintTracePrefix(scope, "completed compiling", function, CodeKind::MAGLEV);
|
||||
@@ -211,7 +211,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceAbortedMaglevCompile(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BailoutReason bailout_reason) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
@@ -244,7 +244,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizedCodeCacheHit(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset,
|
||||
CodeKind code_kind) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
@@ -257,7 +257,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceOptimizeForAlwaysOpt(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
CodeKind code_kind) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
@@ -267,7 +267,7 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void TraceMarkForAlwaysOpt(Isolate* isolate,
|
||||
Handle<JSFunction> function) {
|
||||
DirectHandle<JSFunction> function) {
|
||||
if (!v8_flags.trace_opt) return;
|
||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||
PrintF(scope.file(), "[marking ");
|
||||
@@ -285,7 +285,8 @@ class CompilerTracer : public AllStatic {
|
||||
}
|
||||
|
||||
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
||||
const char* header, Handle<JSFunction> function,
|
||||
const char* header,
|
||||
DirectHandle<JSFunction> function,
|
||||
CodeKind code_kind) {
|
||||
PrintF(scope.file(), "[%s ", header);
|
||||
ShortPrint(*function, scope.file());
|
||||
@@ -294,7 +295,7 @@ class CompilerTracer : public AllStatic {
|
||||
|
||||
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
||||
const char* header,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
DirectHandle<SharedFunctionInfo> shared,
|
||||
CodeKind code_kind) {
|
||||
PrintF(scope.file(), "[%s ", header);
|
||||
ShortPrint(*shared, scope.file());
|
||||
@@ -369,7 +370,8 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
Handle<String> debug_name = SharedFunctionInfo::DebugName(isolate, shared);
|
||||
DirectHandle<String> debug_name =
|
||||
SharedFunctionInfo::DebugName(isolate, shared);
|
||||
DisallowGarbageCollection no_gc;
|
||||
LOG(isolate, FunctionEvent(name.c_str(), script->id(), time_taken_ms,
|
||||
shared->StartPosition(), shared->EndPosition(),
|
||||
@@ -496,7 +498,7 @@ CompilationJob::Status OptimizedCompilationJob::FinalizeJob(Isolate* isolate) {
|
||||
}
|
||||
|
||||
GlobalHandleVector<Map> OptimizedCompilationJob::CollectRetainedMaps(
|
||||
Isolate* isolate, Handle<Code> code) {
|
||||
Isolate* isolate, DirectHandle<Code> code) {
|
||||
DCHECK(code->is_optimized_code());
|
||||
|
||||
DisallowGarbageCollection no_gc;
|
||||
@@ -516,8 +518,8 @@ GlobalHandleVector<Map> OptimizedCompilationJob::CollectRetainedMaps(
|
||||
}
|
||||
|
||||
void OptimizedCompilationJob::RegisterWeakObjectsInOptimizedCode(
|
||||
Isolate* isolate, Handle<NativeContext> context, Handle<Code> code,
|
||||
GlobalHandleVector<Map> maps) {
|
||||
Isolate* isolate, DirectHandle<NativeContext> context,
|
||||
DirectHandle<Code> code, GlobalHandleVector<Map> maps) {
|
||||
isolate->heap()->AddRetainedMaps(context, std::move(maps));
|
||||
code->set_can_have_weak_objects(true);
|
||||
}
|
||||
@@ -539,7 +541,7 @@ CompilationJob::Status TurbofanCompilationJob::AbortOptimization(
|
||||
void TurbofanCompilationJob::RecordCompilationStats(ConcurrencyMode mode,
|
||||
Isolate* isolate) const {
|
||||
DCHECK(compilation_info()->IsOptimizing());
|
||||
Handle<SharedFunctionInfo> shared = compilation_info()->shared_info();
|
||||
DirectHandle<SharedFunctionInfo> shared = compilation_info()->shared_info();
|
||||
if (v8_flags.trace_opt || v8_flags.trace_opt_stats) {
|
||||
double ms_creategraph = time_taken_to_prepare_.InMillisecondsF();
|
||||
double ms_optimize = time_taken_to_execute_.InMillisecondsF();
|
||||
@@ -679,13 +681,13 @@ void Compiler::InstallInterpreterTrampolineCopy(
|
||||
DCHECK(!shared_info->HasInterpreterData(isolate));
|
||||
return;
|
||||
}
|
||||
Handle<BytecodeArray> bytecode_array(shared_info->GetBytecodeArray(isolate),
|
||||
isolate);
|
||||
DirectHandle<BytecodeArray> bytecode_array(
|
||||
shared_info->GetBytecodeArray(isolate), isolate);
|
||||
|
||||
Handle<Code> code =
|
||||
Builtins::CreateInterpreterEntryTrampolineForProfiling(isolate);
|
||||
|
||||
Handle<InterpreterData> interpreter_data =
|
||||
DirectHandle<InterpreterData> interpreter_data =
|
||||
isolate->factory()->NewInterpreterData(bytecode_array, code);
|
||||
|
||||
if (shared_info->HasBaselineCode()) {
|
||||
@@ -714,7 +716,7 @@ namespace {
|
||||
|
||||
template <typename IsolateT>
|
||||
void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
|
||||
Handle<SharedFunctionInfo> shared_info,
|
||||
DirectHandle<SharedFunctionInfo> shared_info,
|
||||
IsolateT* isolate) {
|
||||
if (compilation_info->has_bytecode_array()) {
|
||||
DCHECK(!shared_info->HasBytecodeArray()); // Only compiled once.
|
||||
@@ -729,7 +731,7 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
|
||||
}
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
|
||||
Handle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New(
|
||||
DirectHandle<FeedbackMetadata> feedback_metadata = FeedbackMetadata::New(
|
||||
isolate, compilation_info->feedback_vector_spec());
|
||||
shared_info->set_feedback_metadata(*feedback_metadata, kReleaseStore);
|
||||
|
||||
@@ -750,7 +752,7 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
|
||||
}
|
||||
|
||||
template <typename IsolateT>
|
||||
void EnsureSharedFunctionInfosArrayOnScript(Handle<Script> script,
|
||||
void EnsureSharedFunctionInfosArrayOnScript(DirectHandle<Script> script,
|
||||
ParseInfo* parse_info,
|
||||
IsolateT* isolate) {
|
||||
DCHECK(parse_info->flags().is_toplevel());
|
||||
@@ -761,7 +763,7 @@ void EnsureSharedFunctionInfosArrayOnScript(Handle<Script> script,
|
||||
parse_info->max_function_literal_id() + 1);
|
||||
return;
|
||||
}
|
||||
Handle<WeakFixedArray> infos(isolate->factory()->NewWeakFixedArray(
|
||||
DirectHandle<WeakFixedArray> infos(isolate->factory()->NewWeakFixedArray(
|
||||
parse_info->max_function_literal_id() + 1, AllocationType::kOld));
|
||||
script->set_shared_function_infos(*infos);
|
||||
}
|
||||
@@ -952,7 +954,7 @@ bool IterativelyExecuteAndFinalizeUnoptimizedCompilationJobs(
|
||||
}
|
||||
|
||||
bool FinalizeDeferredUnoptimizedCompilationJobs(
|
||||
Isolate* isolate, Handle<Script> script,
|
||||
Isolate* isolate, DirectHandle<Script> script,
|
||||
DeferredFinalizationJobDataList* deferred_jobs,
|
||||
PendingCompilationErrorHandler* pending_error_handler,
|
||||
FinalizeUnoptimizedCompilationDataList*
|
||||
@@ -987,8 +989,8 @@ bool FinalizeDeferredUnoptimizedCompilationJobs(
|
||||
class OptimizedCodeCache : public AllStatic {
|
||||
public:
|
||||
static V8_WARN_UNUSED_RESULT MaybeHandle<Code> Get(
|
||||
Isolate* isolate, Handle<JSFunction> function, BytecodeOffset osr_offset,
|
||||
CodeKind code_kind) {
|
||||
Isolate* isolate, DirectHandle<JSFunction> function,
|
||||
BytecodeOffset osr_offset, CodeKind code_kind) {
|
||||
if (!CodeKindIsStoredInOptimizedCodeCache(code_kind)) return {};
|
||||
if (!function->has_feedback_vector()) return {};
|
||||
|
||||
@@ -1122,7 +1124,7 @@ bool CompileTurbofan_Concurrent(Isolate* isolate,
|
||||
std::unique_ptr<TurbofanCompilationJob> job) {
|
||||
OptimizedCompilationInfo* const compilation_info = job->compilation_info();
|
||||
DCHECK_EQ(compilation_info->code_kind(), CodeKind::TURBOFAN);
|
||||
Handle<JSFunction> function = compilation_info->closure();
|
||||
DirectHandle<JSFunction> function = compilation_info->closure();
|
||||
|
||||
if (!isolate->optimizing_compile_dispatcher()->IsQueueAvailable()) {
|
||||
if (v8_flags.trace_concurrent_recompilation) {
|
||||
@@ -1176,7 +1178,8 @@ enum class CompileResultBehavior {
|
||||
kDiscardForTesting,
|
||||
};
|
||||
|
||||
bool ShouldOptimize(CodeKind code_kind, Handle<SharedFunctionInfo> shared) {
|
||||
bool ShouldOptimize(CodeKind code_kind,
|
||||
DirectHandle<SharedFunctionInfo> shared) {
|
||||
DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
|
||||
switch (code_kind) {
|
||||
case CodeKind::TURBOFAN:
|
||||
@@ -1190,7 +1193,7 @@ bool ShouldOptimize(CodeKind code_kind, Handle<SharedFunctionInfo> shared) {
|
||||
}
|
||||
|
||||
MaybeHandle<Code> CompileTurbofan(Isolate* isolate, Handle<JSFunction> function,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
DirectHandle<SharedFunctionInfo> shared,
|
||||
ConcurrencyMode mode,
|
||||
BytecodeOffset osr_offset,
|
||||
CompileResultBehavior result_behavior) {
|
||||
@@ -1236,7 +1239,7 @@ MaybeHandle<Code> CompileTurbofan(Isolate* isolate, Handle<JSFunction> function,
|
||||
#ifdef V8_ENABLE_MAGLEV
|
||||
// TODO(v8:7700): Record maglev compilations better.
|
||||
void RecordMaglevFunctionCompilation(Isolate* isolate,
|
||||
Handle<JSFunction> function,
|
||||
DirectHandle<JSFunction> function,
|
||||
Handle<AbstractCode> code) {
|
||||
PtrComprCageBase cage_base(isolate);
|
||||
Handle<SharedFunctionInfo> shared(function->shared(cage_base), isolate);
|
||||
@@ -1325,7 +1328,7 @@ MaybeHandle<Code> GetOrCompileOptimized(
|
||||
CompileResultBehavior result_behavior = CompileResultBehavior::kDefault) {
|
||||
DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
|
||||
|
||||
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
DirectHandle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
|
||||
// Clear the optimization marker on the function so that we don't try to
|
||||
// re-optimize.
|
||||
@@ -1925,7 +1928,7 @@ void BackgroundCompileTask::Run(
|
||||
} else {
|
||||
DCHECK_NOT_NULL(persistent_handles_);
|
||||
isolate->heap()->AttachPersistentHandles(std::move(persistent_handles_));
|
||||
Handle<SharedFunctionInfo> shared_info =
|
||||
DirectHandle<SharedFunctionInfo> shared_info =
|
||||
input_shared_info_.ToHandleChecked();
|
||||
script_ = isolate->heap()->NewPersistentHandle(
|
||||
Script::cast(shared_info->script()));
|
||||
@@ -1956,7 +1959,7 @@ void BackgroundCompileTask::Run(
|
||||
// TODO(leszeks): Consider keeping Scope zones alive between compile tasks
|
||||
// and passing the Scope for the FunctionLiteral through here directly
|
||||
// without copying/deserializing.
|
||||
Handle<SharedFunctionInfo> shared_info =
|
||||
DirectHandle<SharedFunctionInfo> shared_info =
|
||||
input_shared_info_.ToHandleChecked();
|
||||
MaybeHandle<ScopeInfo> maybe_outer_scope_info;
|
||||
if (shared_info->HasOuterScopeInfo()) {
|
||||
@@ -2030,7 +2033,8 @@ class ConstantPoolPointerForwarder {
|
||||
// Runs the update after the setup functions above specified the work to do.
|
||||
void IterateAndForwardPointers() {
|
||||
DCHECK(HasAnythingToForward());
|
||||
for (Handle<BytecodeArray> bytecode_array : bytecode_arrays_to_update_) {
|
||||
for (DirectHandle<BytecodeArray> bytecode_array :
|
||||
bytecode_arrays_to_update_) {
|
||||
local_heap_->Safepoint();
|
||||
DisallowGarbageCollection no_gc;
|
||||
IterateConstantPool(bytecode_array->constant_pool());
|
||||
@@ -2112,16 +2116,16 @@ void BackgroundMergeTask::SetUpOnMainThread(Isolate* isolate,
|
||||
}
|
||||
}
|
||||
|
||||
void BackgroundMergeTask::SetUpOnMainThread(Isolate* isolate,
|
||||
Handle<Script> cached_script) {
|
||||
void BackgroundMergeTask::SetUpOnMainThread(
|
||||
Isolate* isolate, DirectHandle<Script> cached_script) {
|
||||
// Any data sent to the background thread will need to be a persistent handle.
|
||||
persistent_handles_ = std::make_unique<PersistentHandles>(isolate);
|
||||
state_ = kPendingBackgroundWork;
|
||||
cached_script_ = persistent_handles_->NewHandle(*cached_script);
|
||||
}
|
||||
|
||||
void BackgroundMergeTask::BeginMergeInBackground(LocalIsolate* isolate,
|
||||
Handle<Script> new_script) {
|
||||
void BackgroundMergeTask::BeginMergeInBackground(
|
||||
LocalIsolate* isolate, DirectHandle<Script> new_script) {
|
||||
DCHECK_EQ(state_, kPendingBackgroundWork);
|
||||
|
||||
LocalHeap* local_heap = isolate->heap();
|
||||
@@ -2129,7 +2133,7 @@ void BackgroundMergeTask::BeginMergeInBackground(LocalIsolate* isolate,
|
||||
LocalHandleScope handle_scope(local_heap);
|
||||
ConstantPoolPointerForwarder forwarder(isolate, local_heap);
|
||||
|
||||
Handle<Script> old_script = cached_script_.ToHandleChecked();
|
||||
DirectHandle<Script> old_script = cached_script_.ToHandleChecked();
|
||||
|
||||
{
|
||||
DisallowGarbageCollection no_gc;
|
||||
@@ -2200,14 +2204,14 @@ void BackgroundMergeTask::BeginMergeInBackground(LocalIsolate* isolate,
|
||||
}
|
||||
|
||||
Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
|
||||
Isolate* isolate, Handle<Script> new_script) {
|
||||
Isolate* isolate, DirectHandle<Script> new_script) {
|
||||
DCHECK_EQ(state_, kPendingForegroundWork);
|
||||
|
||||
HandleScope handle_scope(isolate);
|
||||
ConstantPoolPointerForwarder forwarder(isolate,
|
||||
isolate->main_thread_local_heap());
|
||||
|
||||
Handle<Script> old_script = cached_script_.ToHandleChecked();
|
||||
DirectHandle<Script> old_script = cached_script_.ToHandleChecked();
|
||||
|
||||
for (const auto& new_compiled_data : new_compiled_data_for_cached_sfis_) {
|
||||
if (!new_compiled_data.cached_sfi->is_compiled() &&
|
||||
@@ -2225,7 +2229,7 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
|
||||
isolate);
|
||||
}
|
||||
}
|
||||
for (Handle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
|
||||
for (DirectHandle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
|
||||
DisallowGarbageCollection no_gc;
|
||||
DCHECK_GE(new_sfi->function_literal_id(), 0);
|
||||
Tagged<MaybeObject> maybe_old_sfi =
|
||||
@@ -2248,7 +2252,7 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
|
||||
// are any new pointers that need forwarding, a new traversal of the constant
|
||||
// pools is required.
|
||||
if (forwarder.HasAnythingToForward()) {
|
||||
for (Handle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
|
||||
for (DirectHandle<SharedFunctionInfo> new_sfi : used_new_sfis_) {
|
||||
if (new_sfi->HasBytecodeArray(isolate)) {
|
||||
forwarder.AddBytecodeArray(new_sfi->GetBytecodeArray(isolate));
|
||||
}
|
||||
@@ -2280,7 +2284,7 @@ Handle<SharedFunctionInfo> BackgroundMergeTask::CompleteMergeInForeground(
|
||||
}
|
||||
|
||||
MaybeHandle<SharedFunctionInfo> BackgroundCompileTask::FinalizeScript(
|
||||
Isolate* isolate, Handle<String> source,
|
||||
Isolate* isolate, DirectHandle<String> source,
|
||||
const ScriptDetails& script_details,
|
||||
MaybeHandle<Script> maybe_cached_script) {
|
||||
ScriptOriginOptions origin_options = script_details.origin_options;
|
||||
@@ -2352,7 +2356,7 @@ bool BackgroundCompileTask::FinalizeFunction(
|
||||
DCHECK(!flags_.is_toplevel());
|
||||
|
||||
MaybeHandle<SharedFunctionInfo> maybe_result;
|
||||
Handle<SharedFunctionInfo> input_shared_info =
|
||||
DirectHandle<SharedFunctionInfo> input_shared_info =
|
||||
input_shared_info_.ToHandleChecked();
|
||||
|
||||
// The UncompiledData on the input SharedFunctionInfo will have a pointer to
|
||||
@@ -2423,7 +2427,7 @@ void BackgroundDeserializeTask::Run() {
|
||||
UnparkedScope unparked_scope(&isolate);
|
||||
LocalHandleScope handle_scope(&isolate);
|
||||
|
||||
Handle<SharedFunctionInfo> inner_result;
|
||||
DirectHandle<SharedFunctionInfo> inner_result;
|
||||
off_thread_data_ =
|
||||
CodeSerializer::StartDeserializeOffThread(&isolate, &cached_data_);
|
||||
if (v8_flags.enable_slow_asserts && off_thread_data_.HasResult()) {
|
||||
@@ -2461,7 +2465,7 @@ void BackgroundDeserializeTask::MergeWithExistingScript() {
|
||||
}
|
||||
|
||||
MaybeHandle<SharedFunctionInfo> BackgroundDeserializeTask::Finish(
|
||||
Isolate* isolate, Handle<String> source,
|
||||
Isolate* isolate, DirectHandle<String> source,
|
||||
const ScriptDetails& script_details) {
|
||||
return CodeSerializer::FinishOffThreadDeserialize(
|
||||
isolate, std::move(off_thread_data_), &cached_data_, source,
|
||||
@@ -3432,7 +3436,7 @@ class StressBackgroundCompileThread : public ParkingThread {
|
||||
// TODO(leszeks): Also test chunking the data.
|
||||
class SourceStream : public v8::ScriptCompiler::ExternalSourceStream {
|
||||
public:
|
||||
SourceStream(Handle<String> source, Isolate* isolate) : done_(false) {
|
||||
SourceStream(DirectHandle<String> source, Isolate* isolate) : done_(false) {
|
||||
source_buffer_ = source->ToCString(ALLOW_NULLS, FAST_STRING_TRAVERSAL,
|
||||
&source_length_);
|
||||
}
|
||||
@@ -3983,8 +3987,8 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
|
||||
// this function, replace the uncompiled data with one that includes it.
|
||||
if (literal->produced_preparse_data() != nullptr &&
|
||||
existing->HasUncompiledDataWithoutPreparseData()) {
|
||||
Handle<UncompiledData> existing_uncompiled_data =
|
||||
handle(existing->uncompiled_data(), isolate);
|
||||
DirectHandle<UncompiledData> existing_uncompiled_data(
|
||||
existing->uncompiled_data(), isolate);
|
||||
DCHECK_EQ(literal->start_position(),
|
||||
existing_uncompiled_data->start_position());
|
||||
DCHECK_EQ(literal->end_position(),
|
||||
@@ -3995,7 +3999,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
|
||||
handle(existing_uncompiled_data->inferred_name(), isolate);
|
||||
Handle<PreparseData> preparse_data =
|
||||
literal->produced_preparse_data()->Serialize(isolate);
|
||||
Handle<UncompiledData> new_uncompiled_data =
|
||||
DirectHandle<UncompiledData> new_uncompiled_data =
|
||||
isolate->factory()->NewUncompiledDataWithPreparseData(
|
||||
inferred_name, existing_uncompiled_data->start_position(),
|
||||
existing_uncompiled_data->end_position(), preparse_data);
|
||||
@@ -4054,7 +4058,7 @@ MaybeHandle<Code> Compiler::CompileOptimizedOSR(Isolate* isolate,
|
||||
void Compiler::DisposeTurbofanCompilationJob(Isolate* isolate,
|
||||
TurbofanCompilationJob* job,
|
||||
bool restore_function_code) {
|
||||
Handle<JSFunction> function = job->compilation_info()->closure();
|
||||
DirectHandle<JSFunction> function = job->compilation_info()->closure();
|
||||
ResetTieringState(isolate, *function, job->compilation_info()->osr_offset());
|
||||
if (restore_function_code) {
|
||||
function->set_code(function->shared()->GetCode(isolate));
|
||||
@@ -4073,8 +4077,8 @@ void Compiler::FinalizeTurbofanCompilationJob(TurbofanCompilationJob* job,
|
||||
"V8.OptimizeConcurrentFinalize", job->trace_id(),
|
||||
TRACE_EVENT_FLAG_FLOW_IN);
|
||||
|
||||
Handle<JSFunction> function = compilation_info->closure();
|
||||
Handle<SharedFunctionInfo> shared = compilation_info->shared_info();
|
||||
DirectHandle<JSFunction> function = compilation_info->closure();
|
||||
DirectHandle<SharedFunctionInfo> shared = compilation_info->shared_info();
|
||||
|
||||
const bool use_result = !compilation_info->discard_result_for_testing();
|
||||
const BytecodeOffset osr_offset = compilation_info->osr_offset();
|
||||
@@ -4129,7 +4133,7 @@ void Compiler::FinalizeMaglevCompilationJob(maglev::MaglevCompilationJob* job,
|
||||
#ifdef V8_ENABLE_MAGLEV
|
||||
VMState<COMPILER> state(isolate);
|
||||
|
||||
Handle<JSFunction> function = job->function();
|
||||
DirectHandle<JSFunction> function = job->function();
|
||||
if (function->ActiveTierIsTurbofan(isolate) && !job->is_osr()) {
|
||||
CompilerTracer::TraceAbortedMaglevCompile(
|
||||
isolate, function, BailoutReason::kHigherTierAvailable);
|
||||
@@ -4146,7 +4150,7 @@ void Compiler::FinalizeMaglevCompilationJob(maglev::MaglevCompilationJob* job,
|
||||
ResetTieringState(isolate, *function, osr_offset);
|
||||
|
||||
if (status == CompilationJob::SUCCEEDED) {
|
||||
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
DirectHandle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
DCHECK(!shared->HasBreakInfo(isolate));
|
||||
|
||||
// Note the finalized InstructionStream object has already been installed on
|
||||
@@ -4179,7 +4183,7 @@ void Compiler::FinalizeMaglevCompilationJob(maglev::MaglevCompilationJob* job,
|
||||
void Compiler::PostInstantiation(Handle<JSFunction> function,
|
||||
IsCompiledScope* is_compiled_scope) {
|
||||
Isolate* isolate = function->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
DirectHandle<SharedFunctionInfo> shared(function->shared(), isolate);
|
||||
|
||||
// If code is compiled to bytecode (i.e., isn't asm.js), then allocate a
|
||||
// feedback and check for optimized code.
|
||||
@@ -4229,7 +4233,7 @@ void Compiler::PostInstantiation(Handle<JSFunction> function,
|
||||
}
|
||||
|
||||
std::unique_ptr<v8::tracing::TracedValue> Compiler::AddScriptCompiledTrace(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> shared) {
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared) {
|
||||
Handle<Script> script(Script::cast(shared->script()), isolate);
|
||||
i::Tagged<i::Object> context_value =
|
||||
isolate->native_context()->debug_context_id();
|
||||
@@ -4266,8 +4270,8 @@ std::unique_ptr<v8::tracing::TracedValue> Compiler::AddScriptCompiledTrace(
|
||||
}
|
||||
|
||||
std::unique_ptr<v8::tracing::TracedValue> Compiler::AddScriptSourceTextTrace(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> shared) {
|
||||
Handle<Script> script(Script::cast(shared->script()), isolate);
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared) {
|
||||
DirectHandle<Script> script(Script::cast(shared->script()), isolate);
|
||||
auto value = v8::tracing::TracedValue::Create();
|
||||
value->SetString("isolate",
|
||||
std::to_string(reinterpret_cast<size_t>(isolate)));
|
||||
|
||||
@@ -275,9 +275,9 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
|
||||
|
||||
private:
|
||||
static std::unique_ptr<v8::tracing::TracedValue> AddScriptCompiledTrace(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> shared);
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared);
|
||||
static std::unique_ptr<v8::tracing::TracedValue> AddScriptSourceTextTrace(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> shared);
|
||||
Isolate* isolate, DirectHandle<SharedFunctionInfo> shared);
|
||||
};
|
||||
|
||||
// A base class for compilation jobs intended to run concurrent to the main
|
||||
@@ -439,10 +439,10 @@ class OptimizedCompilationJob : public CompilationJob {
|
||||
|
||||
// Register weak object to optimized code dependencies.
|
||||
GlobalHandleVector<Map> CollectRetainedMaps(Isolate* isolate,
|
||||
Handle<Code> code);
|
||||
DirectHandle<Code> code);
|
||||
void RegisterWeakObjectsInOptimizedCode(Isolate* isolate,
|
||||
Handle<NativeContext> context,
|
||||
Handle<Code> code,
|
||||
DirectHandle<NativeContext> context,
|
||||
DirectHandle<Code> code,
|
||||
GlobalHandleVector<Map> maps);
|
||||
|
||||
base::TimeDelta time_taken_to_prepare_;
|
||||
@@ -530,7 +530,7 @@ using FinalizeUnoptimizedCompilationDataList =
|
||||
class DeferredFinalizationJobData {
|
||||
public:
|
||||
DeferredFinalizationJobData(Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> function_handle,
|
||||
DirectHandle<SharedFunctionInfo> function_handle,
|
||||
std::unique_ptr<UnoptimizedCompilationJob> job) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
@@ -597,7 +597,7 @@ class V8_EXPORT_PRIVATE BackgroundCompileTask {
|
||||
ReusableUnoptimizedCompileState* reusable_state);
|
||||
|
||||
MaybeHandle<SharedFunctionInfo> FinalizeScript(
|
||||
Isolate* isolate, Handle<String> source,
|
||||
Isolate* isolate, DirectHandle<String> source,
|
||||
const ScriptDetails& script_details,
|
||||
MaybeHandle<Script> maybe_cached_script);
|
||||
|
||||
@@ -692,7 +692,7 @@ class V8_EXPORT_PRIVATE BackgroundDeserializeTask {
|
||||
void MergeWithExistingScript();
|
||||
|
||||
MaybeHandle<SharedFunctionInfo> Finish(Isolate* isolate,
|
||||
Handle<String> source,
|
||||
DirectHandle<String> source,
|
||||
const ScriptDetails& script_details);
|
||||
|
||||
bool rejected() const { return cached_data_.rejected(); }
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
void ManualOptimizationTable::MarkFunctionForManualOptimization(
|
||||
Isolate* isolate, Handle<JSFunction> function,
|
||||
Isolate* isolate, DirectHandle<JSFunction> function,
|
||||
IsCompiledScope* is_compiled_scope) {
|
||||
DCHECK(v8_flags.testing_d8_test_runner || v8_flags.allow_natives_syntax);
|
||||
DCHECK(is_compiled_scope->is_compiled());
|
||||
@@ -45,14 +45,13 @@ bool ManualOptimizationTable::IsMarkedForManualOptimization(
|
||||
Isolate* isolate, Tagged<JSFunction> function) {
|
||||
DCHECK(v8_flags.testing_d8_test_runner || v8_flags.allow_natives_syntax);
|
||||
|
||||
Handle<Object> table = handle(
|
||||
DirectHandle<Object> table(
|
||||
isolate->heap()->functions_marked_for_manual_optimization(), isolate);
|
||||
Handle<Object> entry =
|
||||
IsUndefined(*table)
|
||||
? handle(ReadOnlyRoots(isolate).the_hole_value(), isolate)
|
||||
: handle(Handle<ObjectHashTable>::cast(table)->Lookup(
|
||||
handle(function->shared(), isolate)),
|
||||
isolate);
|
||||
DirectHandle<Object> entry(IsUndefined(*table)
|
||||
? ReadOnlyRoots(isolate).the_hole_value()
|
||||
: Cast<ObjectHashTable>(table)->Lookup(
|
||||
handle(function->shared(), isolate)),
|
||||
isolate);
|
||||
|
||||
return !IsTheHole(*entry);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ManualOptimizationTable {
|
||||
// This also holds on to the bytecode strongly, preventing the bytecode from
|
||||
// being flushed.
|
||||
static void MarkFunctionForManualOptimization(
|
||||
Isolate* isolate, Handle<JSFunction> function,
|
||||
Isolate* isolate, DirectHandle<JSFunction> function,
|
||||
IsCompiledScope* is_compiled_scope);
|
||||
|
||||
// Returns true if MarkFunctionForManualOptimization was called with this
|
||||
|
||||
@@ -406,7 +406,7 @@ PropertyAccessInfo AccessInfoFactory::ComputeDataFieldAccessInfo(
|
||||
InternalIndex descriptor, AccessMode access_mode) const {
|
||||
DCHECK(descriptor.is_found());
|
||||
// TODO(jgruber,v8:7790): Use DescriptorArrayRef instead.
|
||||
Handle<DescriptorArray> descriptors =
|
||||
DirectHandle<DescriptorArray> descriptors =
|
||||
map.instance_descriptors(broker()).object();
|
||||
PropertyDetails const details = descriptors->GetDetails(descriptor);
|
||||
int index = descriptors->GetFieldIndex(descriptor);
|
||||
@@ -518,9 +518,9 @@ PropertyAccessInfo AccessorAccessInfoHelper(
|
||||
AccessorsObjectGetter get_accessors) {
|
||||
if (holder_map.instance_type() == JS_MODULE_NAMESPACE_TYPE) {
|
||||
DCHECK(holder_map.object()->is_prototype_map());
|
||||
Handle<PrototypeInfo> proto_info = broker->CanonicalPersistentHandle(
|
||||
DirectHandle<PrototypeInfo> proto_info = broker->CanonicalPersistentHandle(
|
||||
PrototypeInfo::cast(holder_map.object()->prototype_info()));
|
||||
Handle<JSModuleNamespace> module_namespace =
|
||||
DirectHandle<JSModuleNamespace> module_namespace =
|
||||
broker->CanonicalPersistentHandle(
|
||||
JSModuleNamespace::cast(proto_info->module_namespace()));
|
||||
Handle<Cell> cell = broker->CanonicalPersistentHandle(
|
||||
@@ -558,7 +558,7 @@ PropertyAccessInfo AccessorAccessInfoHelper(
|
||||
if (!IsAccessorPair(*maybe_accessors)) {
|
||||
return PropertyAccessInfo::Invalid(zone);
|
||||
}
|
||||
Handle<AccessorPair> accessors = Handle<AccessorPair>::cast(maybe_accessors);
|
||||
DirectHandle<AccessorPair> accessors = Cast<AccessorPair>(maybe_accessors);
|
||||
Handle<Object> accessor = broker->CanonicalPersistentHandle(
|
||||
access_mode == AccessMode::kLoad ? accessors->getter(kAcquireLoad)
|
||||
: accessors->setter(kAcquireLoad));
|
||||
@@ -690,7 +690,7 @@ bool AccessInfoFactory::TryLoadPropertyDetails(
|
||||
return false;
|
||||
}
|
||||
|
||||
Handle<JSObject> holder = maybe_holder->object();
|
||||
DirectHandle<JSObject> holder = maybe_holder->object();
|
||||
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
|
||||
Tagged<SwissNameDictionary> dict = holder->property_dictionary_swiss();
|
||||
*index_out = dict->FindEntry(isolate(), name.object());
|
||||
@@ -1108,7 +1108,7 @@ PropertyAccessInfo AccessInfoFactory::LookupTransition(
|
||||
MapRef transition_map = maybe_transition_map.value();
|
||||
|
||||
InternalIndex const number = transition_map.object()->LastAdded();
|
||||
Handle<DescriptorArray> descriptors =
|
||||
DirectHandle<DescriptorArray> descriptors =
|
||||
transition_map.instance_descriptors(broker()).object();
|
||||
PropertyDetails const details = descriptors->GetDetails(number);
|
||||
|
||||
|
||||
@@ -977,7 +977,7 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
|
||||
Handle<DeoptimizationData> data =
|
||||
DeoptimizationData::New(isolate(), deopt_count);
|
||||
|
||||
Handle<DeoptimizationFrameTranslation> translation_array =
|
||||
DirectHandle<DeoptimizationFrameTranslation> translation_array =
|
||||
translations_.ToFrameTranslation(
|
||||
isolate()->main_thread_local_isolate()->factory());
|
||||
|
||||
@@ -991,14 +991,14 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
|
||||
data->SetLazyDeoptCount(Smi::FromInt(lazy_deopt_count_));
|
||||
|
||||
if (info->has_shared_info()) {
|
||||
Handle<SharedFunctionInfoWrapper> sfi_wrapper =
|
||||
DirectHandle<SharedFunctionInfoWrapper> sfi_wrapper =
|
||||
isolate()->factory()->NewSharedFunctionInfoWrapper(info->shared_info());
|
||||
data->SetSharedFunctionInfoWrapper(*sfi_wrapper);
|
||||
} else {
|
||||
data->SetSharedFunctionInfoWrapper(Smi::zero());
|
||||
}
|
||||
|
||||
Handle<DeoptimizationLiteralArray> literals =
|
||||
DirectHandle<DeoptimizationLiteralArray> literals =
|
||||
isolate()->factory()->NewDeoptimizationLiteralArray(
|
||||
static_cast<int>(deoptimization_literals_.size()));
|
||||
for (unsigned i = 0; i < deoptimization_literals_.size(); i++) {
|
||||
@@ -1008,7 +1008,7 @@ Handle<DeoptimizationData> CodeGenerator::GenerateDeoptimizationData() {
|
||||
}
|
||||
data->SetLiteralArray(*literals);
|
||||
|
||||
Handle<TrustedPodArray<InliningPosition>> inl_pos =
|
||||
DirectHandle<TrustedPodArray<InliningPosition>> inl_pos =
|
||||
CreateInliningPositions(info, isolate());
|
||||
data->SetInliningPositions(*inl_pos);
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ void StoreBuiltinCallForNode(Node* n, Builtin builtin, int block_id,
|
||||
if (op->opcode() == IrOpcode::kHeapConstant) {
|
||||
Handle<HeapObject> para = OpParameter<Handle<HeapObject>>(op);
|
||||
if (IsCode(*para)) {
|
||||
Handle<Code> code = Handle<Code>::cast(para);
|
||||
DirectHandle<Code> code = Cast<Code>(para);
|
||||
if (code->is_builtin()) {
|
||||
bcc_profiler->AddBuiltinCall(builtin, code->builtin_id(), block_id);
|
||||
return;
|
||||
|
||||
@@ -260,7 +260,7 @@ template <bool IsFirstUpdate, Bytecode bytecode>
|
||||
void UpdateOutLiveness(BytecodeLiveness& liveness,
|
||||
BytecodeLivenessState* next_bytecode_in_liveness,
|
||||
const interpreter::BytecodeArrayIterator& iterator,
|
||||
Handle<BytecodeArray> bytecode_array,
|
||||
DirectHandle<BytecodeArray> bytecode_array,
|
||||
const BytecodeLivenessMap& liveness_map, Zone* zone) {
|
||||
// On subsequent updates, only update out-liveness manually if it isn't
|
||||
// already aliasing the next bytecode's in-liveness.
|
||||
|
||||
@@ -173,7 +173,7 @@ class PendingDependencies final {
|
||||
}
|
||||
|
||||
private:
|
||||
uint32_t HandleValueHash(Handle<HeapObject> handle) {
|
||||
uint32_t HandleValueHash(DirectHandle<HeapObject> handle) {
|
||||
return static_cast<uint32_t>(base::hash_value(handle->ptr()));
|
||||
}
|
||||
struct HandleValueEqual {
|
||||
@@ -197,7 +197,7 @@ class InitialMapDependency final : public CompilationDependency {
|
||||
initial_map_(initial_map) {}
|
||||
|
||||
bool IsValid(JSHeapBroker* broker) const override {
|
||||
Handle<JSFunction> function = function_.object();
|
||||
DirectHandle<JSFunction> function = function_.object();
|
||||
return function->has_initial_map() &&
|
||||
function->initial_map() == *initial_map_.object();
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class PrototypePropertyDependency final : public CompilationDependency {
|
||||
}
|
||||
|
||||
bool IsValid(JSHeapBroker* broker) const override {
|
||||
Handle<JSFunction> function = function_.object();
|
||||
DirectHandle<JSFunction> function = function_.object();
|
||||
return function->has_prototype_slot() &&
|
||||
function->has_instance_prototype() &&
|
||||
!function->PrototypeRequiresRuntimeLookup() &&
|
||||
@@ -252,7 +252,7 @@ class PrototypePropertyDependency final : public CompilationDependency {
|
||||
|
||||
void Install(JSHeapBroker* broker, PendingDependencies* deps) const override {
|
||||
SLOW_DCHECK(IsValid(broker));
|
||||
Handle<JSFunction> function = function_.object();
|
||||
DirectHandle<JSFunction> function = function_.object();
|
||||
CHECK(function->has_initial_map());
|
||||
Handle<Map> initial_map(function->initial_map(), broker->isolate());
|
||||
deps->Register(initial_map, DependentCode::kInitialMapChangedGroup);
|
||||
@@ -327,7 +327,7 @@ class ConstantInDictionaryPrototypeChainDependency final
|
||||
void Install(JSHeapBroker* broker, PendingDependencies* deps) const override {
|
||||
SLOW_DCHECK(IsValid(broker));
|
||||
Isolate* isolate = broker->isolate();
|
||||
Handle<JSObject> holder = GetHolderIfValid(broker).ToHandleChecked();
|
||||
DirectHandle<JSObject> holder = GetHolderIfValid(broker).ToHandleChecked();
|
||||
Handle<Map> map = receiver_map_.object();
|
||||
|
||||
while (map->prototype() != *holder) {
|
||||
@@ -351,7 +351,6 @@ class ConstantInDictionaryPrototypeChainDependency final
|
||||
DisallowGarbageCollection no_gc;
|
||||
Isolate* isolate = broker->isolate();
|
||||
|
||||
Handle<Object> holder;
|
||||
Tagged<HeapObject> prototype = receiver_map_.object()->prototype();
|
||||
|
||||
enum class ValidationResult { kFoundCorrect, kFoundIncorrect, kNotFound };
|
||||
@@ -868,7 +867,7 @@ class GlobalPropertyDependency final : public CompilationDependency {
|
||||
}
|
||||
|
||||
bool IsValid(JSHeapBroker* broker) const override {
|
||||
Handle<PropertyCell> cell = cell_.object();
|
||||
DirectHandle<PropertyCell> cell = cell_.object();
|
||||
// The dependency is never valid if the cell is 'invalidated'. This is
|
||||
// marked by setting the value to the hole.
|
||||
if (cell->value() ==
|
||||
@@ -944,7 +943,7 @@ class ProtectorDependency final : public CompilationDependency {
|
||||
: CompilationDependency(kProtector), cell_(cell) {}
|
||||
|
||||
bool IsValid(JSHeapBroker* broker) const override {
|
||||
Handle<PropertyCell> cell = cell_.object();
|
||||
DirectHandle<PropertyCell> cell = cell_.object();
|
||||
return cell->value() == Smi::FromInt(Protectors::kProtectorValid);
|
||||
}
|
||||
void Install(JSHeapBroker* broker, PendingDependencies* deps) const override {
|
||||
@@ -1011,7 +1010,7 @@ class ElementsKindDependency final : public CompilationDependency {
|
||||
}
|
||||
|
||||
bool IsValid(JSHeapBroker* broker) const override {
|
||||
Handle<AllocationSite> site = site_.object();
|
||||
DirectHandle<AllocationSite> site = site_.object();
|
||||
ElementsKind kind =
|
||||
site->PointsToLiteral()
|
||||
? site->boilerplate(kAcquireLoad)->map()->elements_kind()
|
||||
|
||||
@@ -68,7 +68,7 @@ std::ostream& operator<<(std::ostream& out, const NodeOriginAsJSON& asJSON) {
|
||||
|
||||
void JsonPrintBytecodeSource(std::ostream& os, int source_id,
|
||||
std::unique_ptr<char[]> function_name,
|
||||
Handle<BytecodeArray> bytecode_array) {
|
||||
DirectHandle<BytecodeArray> bytecode_array) {
|
||||
os << "\"" << source_id << "\" : {";
|
||||
os << "\"sourceId\": " << source_id;
|
||||
os << ", \"functionName\": \"" << function_name.get() << "\"";
|
||||
|
||||
@@ -135,7 +135,7 @@ void JsonPrintAllBytecodeSources(std::ostream& os,
|
||||
|
||||
void JsonPrintBytecodeSource(std::ostream& os, int source_id,
|
||||
std::unique_ptr<char[]> function_name,
|
||||
Handle<BytecodeArray> bytecode_array);
|
||||
DirectHandle<BytecodeArray> bytecode_array);
|
||||
|
||||
void JsonPrintAllSourceWithPositions(std::ostream& os,
|
||||
OptimizedCompilationInfo* info,
|
||||
|
||||
+13
-12
@@ -372,9 +372,9 @@ base::Optional<Tagged<Object>> GetOwnFastConstantDataPropertyFromHeap(
|
||||
|
||||
// Tries to get the property at {dict_index}. If we are within bounds of the
|
||||
// object, we are guaranteed to see valid heap words even if the data is wrong.
|
||||
OptionalObjectRef GetOwnDictionaryPropertyFromHeap(JSHeapBroker* broker,
|
||||
Handle<JSObject> receiver,
|
||||
InternalIndex dict_index) {
|
||||
OptionalObjectRef GetOwnDictionaryPropertyFromHeap(
|
||||
JSHeapBroker* broker, DirectHandle<JSObject> receiver,
|
||||
InternalIndex dict_index) {
|
||||
Handle<Object> constant;
|
||||
{
|
||||
DisallowGarbageCollection no_gc;
|
||||
@@ -597,7 +597,7 @@ int InstanceSizeWithMinSlack(JSHeapBroker* broker, MapRef map) {
|
||||
JSHeapBroker::MapUpdaterGuardIfNeeded mumd_scope(broker);
|
||||
|
||||
int slack = std::numeric_limits<int>::max();
|
||||
for (Handle<Map> m : maps) {
|
||||
for (DirectHandle<Map> m : maps) {
|
||||
slack = std::min(slack, m->UnusedPropertyFields());
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ void JSFunctionData::Cache(JSHeapBroker* broker) {
|
||||
DCHECK(!serialized_);
|
||||
|
||||
TraceScope tracer(broker, this, "JSFunctionData::Cache");
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(object());
|
||||
DirectHandle<JSFunction> function = Cast<JSFunction>(object());
|
||||
|
||||
// This function may run on the background thread and thus must be individual
|
||||
// fields in a thread-safe manner. Consistency between fields is *not*
|
||||
@@ -679,7 +679,7 @@ void JSFunctionData::Cache(JSHeapBroker* broker) {
|
||||
bool JSFunctionData::IsConsistentWithHeapState(JSHeapBroker* broker) const {
|
||||
DCHECK(serialized_);
|
||||
|
||||
Handle<JSFunction> f = Handle<JSFunction>::cast(object());
|
||||
DirectHandle<JSFunction> f = Cast<JSFunction>(object());
|
||||
|
||||
if (*context_->object() != f->context()) {
|
||||
TRACE_BROKER_MISSING(broker, "JSFunction::context");
|
||||
@@ -815,7 +815,8 @@ InstanceType HeapObjectData::GetMapInstanceType() const {
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsReadOnlyLengthDescriptor(Isolate* isolate, Handle<Map> jsarray_map) {
|
||||
bool IsReadOnlyLengthDescriptor(Isolate* isolate,
|
||||
DirectHandle<Map> jsarray_map) {
|
||||
DCHECK(!jsarray_map->is_dictionary_map());
|
||||
Tagged<DescriptorArray> descriptors =
|
||||
jsarray_map->instance_descriptors(isolate, kRelaxedLoad);
|
||||
@@ -830,7 +831,7 @@ bool IsReadOnlyLengthDescriptor(Isolate* isolate, Handle<Map> jsarray_map) {
|
||||
// compiler checks protectors through the compilation dependency mechanism; it
|
||||
// doesn't make sense to do that here as part of every MapData construction.
|
||||
// Callers *must* take care to take the correct dependency themselves.
|
||||
bool SupportsFastArrayIteration(JSHeapBroker* broker, Handle<Map> map) {
|
||||
bool SupportsFastArrayIteration(JSHeapBroker* broker, DirectHandle<Map> map) {
|
||||
return map->instance_type() == JS_ARRAY_TYPE &&
|
||||
IsFastElementsKind(map->elements_kind()) &&
|
||||
IsJSArray(map->prototype()) &&
|
||||
@@ -838,7 +839,7 @@ bool SupportsFastArrayIteration(JSHeapBroker* broker, Handle<Map> map) {
|
||||
JSArray::cast(map->prototype())));
|
||||
}
|
||||
|
||||
bool SupportsFastArrayResize(JSHeapBroker* broker, Handle<Map> map) {
|
||||
bool SupportsFastArrayResize(JSHeapBroker* broker, DirectHandle<Map> map) {
|
||||
return SupportsFastArrayIteration(broker, map) && map->is_extensible() &&
|
||||
!map->is_dictionary_map() &&
|
||||
!IsReadOnlyLengthDescriptor(broker->isolate(), map);
|
||||
@@ -999,7 +1000,7 @@ OptionalObjectRef ContextRef::TryGetSideData(JSHeapBroker* broker,
|
||||
}
|
||||
|
||||
void JSHeapBroker::InitializeAndStartSerializing(
|
||||
Handle<NativeContext> target_native_context) {
|
||||
DirectHandle<NativeContext> target_native_context) {
|
||||
TraceScope tracer(this, "JSHeapBroker::InitializeAndStartSerializing");
|
||||
|
||||
CHECK_EQ(mode_, kDisabled);
|
||||
@@ -1980,7 +1981,7 @@ base::Optional<Tagged<Object>> JSObjectRef::GetOwnConstantElementFromHeap(
|
||||
ElementsKind elements_kind, uint32_t index) const {
|
||||
DCHECK_LE(index, JSObject::kMaxElementIndex);
|
||||
|
||||
Handle<JSObject> holder = object();
|
||||
DirectHandle<JSObject> holder = object();
|
||||
|
||||
// This block is carefully constructed to avoid Ref creation and access since
|
||||
// this method may be called after the broker has retired.
|
||||
@@ -2368,7 +2369,7 @@ ScopeInfoRef SharedFunctionInfoRef::scope_info(JSHeapBroker* broker) const {
|
||||
}
|
||||
|
||||
OptionalMapRef JSObjectRef::GetObjectCreateMap(JSHeapBroker* broker) const {
|
||||
Handle<Map> map_handle = Handle<Map>::cast(map(broker).object());
|
||||
DirectHandle<Map> map_handle = Cast<Map>(map(broker).object());
|
||||
// Note: implemented as an acquire-load.
|
||||
if (!map_handle->is_prototype_map()) return {};
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ void JSHeapBroker::Retire() {
|
||||
}
|
||||
|
||||
void JSHeapBroker::SetTargetNativeContextRef(
|
||||
Handle<NativeContext> native_context) {
|
||||
DirectHandle<NativeContext> native_context) {
|
||||
DCHECK(!target_native_context_.has_value());
|
||||
target_native_context_ = MakeRef(this, *native_context);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ bool JSHeapBroker::StackHasOverflowed() const {
|
||||
: StackLimitCheck(isolate_).HasOverflowed();
|
||||
}
|
||||
|
||||
bool JSHeapBroker::ObjectMayBeUninitialized(Handle<Object> object) const {
|
||||
bool JSHeapBroker::ObjectMayBeUninitialized(DirectHandle<Object> object) const {
|
||||
return ObjectMayBeUninitialized(*object);
|
||||
}
|
||||
|
||||
@@ -521,8 +521,8 @@ ProcessedFeedback const& JSHeapBroker::ReadFeedbackForPropertyAccess(
|
||||
DCHECK(maps.empty());
|
||||
MaybeObjectHandle maybe_handler = nexus.ExtractMegaDOMHandler();
|
||||
if (!maybe_handler.is_null()) {
|
||||
Handle<MegaDomHandler> handler =
|
||||
Handle<MegaDomHandler>::cast(maybe_handler.object());
|
||||
DirectHandle<MegaDomHandler> handler =
|
||||
Cast<MegaDomHandler>(maybe_handler.object());
|
||||
if (!handler->accessor(kAcquireLoad).IsCleared()) {
|
||||
FunctionTemplateInfoRef info = MakeRefAssumeMemoryFence(
|
||||
this, FunctionTemplateInfo::cast(
|
||||
|
||||
@@ -115,9 +115,10 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
|
||||
NativeContextRef target_native_context() const {
|
||||
return target_native_context_.value();
|
||||
}
|
||||
void SetTargetNativeContextRef(Handle<NativeContext> native_context);
|
||||
void SetTargetNativeContextRef(DirectHandle<NativeContext> native_context);
|
||||
|
||||
void InitializeAndStartSerializing(Handle<NativeContext> native_context);
|
||||
void InitializeAndStartSerializing(
|
||||
DirectHandle<NativeContext> native_context);
|
||||
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
|
||||
@@ -383,7 +384,7 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
|
||||
// If this returns false, the object is guaranteed to be fully initialized and
|
||||
// thus safe to read from a memory safety perspective. The converse does not
|
||||
// necessarily hold.
|
||||
bool ObjectMayBeUninitialized(Handle<Object> object) const;
|
||||
bool ObjectMayBeUninitialized(DirectHandle<Object> object) const;
|
||||
bool ObjectMayBeUninitialized(Tagged<Object> object) const;
|
||||
bool ObjectMayBeUninitialized(Tagged<HeapObject> object) const;
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ Reduction JSNativeContextSpecialization::ReduceJSToString(Node* node) {
|
||||
// regressions and the stronger optimization should be re-implemented.
|
||||
NumberMatcher number_matcher(input);
|
||||
if (number_matcher.HasResolvedValue()) {
|
||||
Handle<Object> num_obj =
|
||||
DirectHandle<Object> num_obj =
|
||||
broker()
|
||||
->local_isolate_or_isolate()
|
||||
->factory()
|
||||
@@ -200,7 +200,7 @@ Handle<String> JSNativeContextSpecialization::CreateStringConstant(Node* node) {
|
||||
DCHECK(IrOpcode::IsConstantOpcode(node->opcode()));
|
||||
NumberMatcher number_matcher(node);
|
||||
if (number_matcher.HasResolvedValue()) {
|
||||
Handle<Object> num_obj =
|
||||
DirectHandle<Object> num_obj =
|
||||
broker()
|
||||
->local_isolate_or_isolate()
|
||||
->factory()
|
||||
|
||||
@@ -45,7 +45,7 @@ inline constexpr char kRegisterAllocatorVerifierZoneName[] =
|
||||
|
||||
class TFPipelineData;
|
||||
class Schedule;
|
||||
void PrintCode(Isolate* isolate, Handle<Code> code,
|
||||
void PrintCode(Isolate* isolate, DirectHandle<Code> code,
|
||||
OptimizedCompilationInfo* info);
|
||||
void TraceSchedule(OptimizedCompilationInfo* info, TFPipelineData* data,
|
||||
Schedule* schedule, const char* phase_name);
|
||||
|
||||
@@ -332,9 +332,10 @@ class V8_NODISCARD LocalIsolateScope {
|
||||
};
|
||||
|
||||
void PrintFunctionSource(OptimizedCompilationInfo* info, Isolate* isolate,
|
||||
int source_id, Handle<SharedFunctionInfo> shared) {
|
||||
int source_id,
|
||||
DirectHandle<SharedFunctionInfo> shared) {
|
||||
if (!IsUndefined(shared->script(), isolate)) {
|
||||
Handle<Script> script(Script::cast(shared->script()), isolate);
|
||||
DirectHandle<Script> script(Script::cast(shared->script()), isolate);
|
||||
|
||||
if (!IsUndefined(script->source(), isolate)) {
|
||||
CodeTracer::StreamScope tracing_scope(isolate->GetCodeTracer());
|
||||
@@ -619,7 +620,7 @@ void TraceSchedule(OptimizedCompilationInfo* info, TFPipelineData* data,
|
||||
}
|
||||
|
||||
// Print the code after compiling it.
|
||||
void PrintCode(Isolate* isolate, Handle<Code> code,
|
||||
void PrintCode(Isolate* isolate, DirectHandle<Code> code,
|
||||
OptimizedCompilationInfo* info) {
|
||||
if (v8_flags.print_opt_source && info->IsOptimizing()) {
|
||||
PrintParticipatingSource(info, isolate);
|
||||
@@ -638,7 +639,7 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
|
||||
// Print the source code if available.
|
||||
const bool print_source = info->IsOptimizing();
|
||||
if (print_source) {
|
||||
Handle<SharedFunctionInfo> shared = info->shared_info();
|
||||
DirectHandle<SharedFunctionInfo> shared = info->shared_info();
|
||||
if (IsScript(shared->script()) &&
|
||||
!IsUndefined(Script::cast(shared->script())->source(), isolate)) {
|
||||
os << "--- Raw source ---\n";
|
||||
@@ -663,7 +664,7 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
|
||||
os << "--- Code ---\n";
|
||||
}
|
||||
if (print_source) {
|
||||
Handle<SharedFunctionInfo> shared = info->shared_info();
|
||||
DirectHandle<SharedFunctionInfo> shared = info->shared_info();
|
||||
os << "source_position = " << shared->StartPosition() << "\n";
|
||||
}
|
||||
code->Disassemble(debug_name.get(), os, isolate);
|
||||
@@ -685,7 +686,7 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
|
||||
// part of a CheckMaps, this check will always fail afterwards and deoptimize.
|
||||
// This in turn relies on a runtime invariant that map migrations always target
|
||||
// newly allocated maps.
|
||||
bool CheckNoDeprecatedMaps(Handle<Code> code, Isolate* isolate) {
|
||||
bool CheckNoDeprecatedMaps(DirectHandle<Code> code, Isolate* isolate) {
|
||||
int mode_mask = RelocInfo::EmbeddedObjectModeMask();
|
||||
for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
|
||||
DCHECK(RelocInfo::IsEmbeddedObjectMode(it.rinfo()->rmode()));
|
||||
|
||||
@@ -157,7 +157,7 @@ base::Optional<Node*> PropertyAccessBuilder::FoldLoadDictPrototypeConstant(
|
||||
if (!value) return {};
|
||||
|
||||
for (MapRef map : access_info.lookup_start_object_maps()) {
|
||||
Handle<Map> map_handle = map.object();
|
||||
DirectHandle<Map> map_handle = map.object();
|
||||
// Non-JSReceivers that passed AccessInfoFactory::ComputePropertyAccessInfo
|
||||
// must have different lookup start map.
|
||||
if (!IsJSReceiverMap(*map_handle)) {
|
||||
|
||||
@@ -1570,7 +1570,7 @@ OpIndex GraphBuilder::Process(
|
||||
CHECK(m.HasResolvedValue() && m.Ref(broker).IsString() &&
|
||||
m.Ref(broker).AsString().IsContentAccessible());
|
||||
StringRef type_string = m.Ref(broker).AsString();
|
||||
Handle<String> pattern_string =
|
||||
DirectHandle<String> pattern_string =
|
||||
*type_string.ObjectIfContentAccessible(broker);
|
||||
std::unique_ptr<char[]> pattern = pattern_string->ToCString();
|
||||
|
||||
|
||||
+9
-8
@@ -408,12 +408,13 @@ std::shared_ptr<Worker> GetWorkerFromInternalField(Isolate* isolate,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
i::Handle<i::Object> handle = Utils::OpenHandle(*object->GetInternalField(0));
|
||||
i::DirectHandle<i::Object> handle =
|
||||
Utils::OpenDirectHandle(*object->GetInternalField(0));
|
||||
if (IsSmi(*handle)) {
|
||||
ThrowError(isolate, "Worker is defunct because main thread is terminating");
|
||||
return nullptr;
|
||||
}
|
||||
auto managed = i::Handle<i::Managed<Worker>>::cast(handle);
|
||||
auto managed = i::Cast<i::Managed<Worker>>(handle);
|
||||
return managed->get();
|
||||
}
|
||||
|
||||
@@ -792,9 +793,9 @@ std::shared_ptr<ModuleEmbedderData> GetModuleDataFromContext(
|
||||
Local<Context> context) {
|
||||
v8::Local<v8::Value> module_data =
|
||||
context->GetEmbedderData(kModuleEmbedderDataIndex);
|
||||
i::Handle<i::Managed<ModuleEmbedderData>> module_data_managed =
|
||||
i::Handle<i::Managed<ModuleEmbedderData>>::cast(
|
||||
Utils::OpenHandle<Value, i::Object>(module_data));
|
||||
i::DirectHandle<i::Managed<ModuleEmbedderData>> module_data_managed =
|
||||
i::Cast<i::Managed<ModuleEmbedderData>>(
|
||||
Utils::OpenDirectHandle<Value, i::Object>(module_data));
|
||||
return module_data_managed->get();
|
||||
}
|
||||
|
||||
@@ -957,7 +958,7 @@ bool Shell::ExecuteString(Isolate* isolate, Local<String> source,
|
||||
}
|
||||
if (options.compile_only) return true;
|
||||
if (options.compile_options == ScriptCompiler::kConsumeCodeCache) {
|
||||
i::Handle<i::Script> i_script(
|
||||
i::DirectHandle<i::Script> i_script(
|
||||
i::Script::cast(Utils::OpenDirectHandle(*script)->shared()->script()),
|
||||
i_isolate);
|
||||
// TODO(cbruni, chromium:1244145): remove once context-allocated.
|
||||
@@ -2347,7 +2348,7 @@ void Shell::TestVerifySourcePositions(
|
||||
i_isolate);
|
||||
}
|
||||
|
||||
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(callable);
|
||||
i::DirectHandle<i::JSFunction> function = i::Cast<i::JSFunction>(callable);
|
||||
if (!function->shared()->HasBytecodeArray()) {
|
||||
ThrowError(isolate, "Function has no BytecodeArray attached.");
|
||||
return;
|
||||
@@ -5292,7 +5293,7 @@ int Shell::RunMain(v8::Isolate* isolate, bool last_run) {
|
||||
HandleScope handle_scope(isolate);
|
||||
static constexpr bool kClearRecompilableData = true;
|
||||
auto context = v8::Local<v8::Context>::New(isolate, evaluation_context_);
|
||||
i::Handle<i::Context> i_context = Utils::OpenHandle(*context);
|
||||
i::DirectHandle<i::Context> i_context = Utils::OpenDirectHandle(*context);
|
||||
// Stop concurrent compiles before mutating the heap.
|
||||
if (i_isolate->concurrent_recompilation_enabled()) {
|
||||
i_isolate->optimizing_compile_dispatcher()->Stop();
|
||||
|
||||
@@ -71,7 +71,7 @@ constexpr int kBlockCountSlotSize = kInt32Size;
|
||||
} // namespace
|
||||
|
||||
BasicBlockProfilerData::BasicBlockProfilerData(
|
||||
Handle<OnHeapBasicBlockProfilerData> js_heap_data, Isolate* isolate) {
|
||||
DirectHandle<OnHeapBasicBlockProfilerData> js_heap_data, Isolate* isolate) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
CopyFromJSHeap(*js_heap_data);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ Handle<OnHeapBasicBlockProfilerData> BasicBlockProfilerData::CopyToJSHeap(
|
||||
CHECK(id_array_size_in_bytes >= 0 &&
|
||||
static_cast<size_t>(id_array_size_in_bytes) / kBlockIdSlotSize ==
|
||||
n_blocks()); // Overflow
|
||||
Handle<FixedInt32Array> block_ids = FixedInt32Array::New(
|
||||
DirectHandle<FixedInt32Array> block_ids = FixedInt32Array::New(
|
||||
isolate, id_array_size_in_bytes, AllocationType::kOld);
|
||||
for (int i = 0; i < static_cast<int>(n_blocks()); ++i) {
|
||||
block_ids->set(i, block_ids_[i]);
|
||||
@@ -121,21 +121,21 @@ Handle<OnHeapBasicBlockProfilerData> BasicBlockProfilerData::CopyToJSHeap(
|
||||
CHECK(counts_array_size_in_bytes >= 0 &&
|
||||
static_cast<size_t>(counts_array_size_in_bytes) / kBlockCountSlotSize ==
|
||||
n_blocks()); // Overflow
|
||||
Handle<FixedUInt32Array> counts = FixedUInt32Array::New(
|
||||
DirectHandle<FixedUInt32Array> counts = FixedUInt32Array::New(
|
||||
isolate, counts_array_size_in_bytes, AllocationType::kOld);
|
||||
for (int i = 0; i < static_cast<int>(n_blocks()); ++i) {
|
||||
counts->set(i, counts_[i]);
|
||||
}
|
||||
|
||||
Handle<PodArray<std::pair<int32_t, int32_t>>> branches =
|
||||
DirectHandle<PodArray<std::pair<int32_t, int32_t>>> branches =
|
||||
PodArray<std::pair<int32_t, int32_t>>::New(
|
||||
isolate, static_cast<int>(branches_.size()), AllocationType::kOld);
|
||||
for (int i = 0; i < static_cast<int>(branches_.size()); ++i) {
|
||||
branches->set(i, branches_[i]);
|
||||
}
|
||||
Handle<String> name = CopyStringToJSHeap(function_name_, isolate);
|
||||
Handle<String> schedule = CopyStringToJSHeap(schedule_, isolate);
|
||||
Handle<String> code = CopyStringToJSHeap(code_, isolate);
|
||||
DirectHandle<String> name = CopyStringToJSHeap(function_name_, isolate);
|
||||
DirectHandle<String> schedule = CopyStringToJSHeap(schedule_, isolate);
|
||||
DirectHandle<String> code = CopyStringToJSHeap(code_, isolate);
|
||||
|
||||
return isolate->factory()->NewOnHeapBasicBlockProfilerData(
|
||||
block_ids, counts, branches, name, schedule, code, hash_,
|
||||
@@ -147,10 +147,10 @@ void BasicBlockProfiler::ResetCounts(Isolate* isolate) {
|
||||
data->ResetCounts();
|
||||
}
|
||||
HandleScope scope(isolate);
|
||||
Handle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
DirectHandle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
for (int i = 0; i < list->length(); ++i) {
|
||||
Handle<FixedUInt32Array> counts(
|
||||
DirectHandle<FixedUInt32Array> counts(
|
||||
OnHeapBasicBlockProfilerData::cast(list->get(i))->counts(), isolate);
|
||||
for (int j = 0; j < counts->length() / kBlockCountSlotSize; ++j) {
|
||||
counts->set(j, 0);
|
||||
@@ -169,8 +169,8 @@ void BasicBlockProfiler::Print(Isolate* isolate, std::ostream& os) {
|
||||
os << *data;
|
||||
}
|
||||
HandleScope scope(isolate);
|
||||
Handle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
DirectHandle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
std::unordered_set<std::string> builtin_names;
|
||||
for (int i = 0; i < list->length(); ++i) {
|
||||
BasicBlockProfilerData data(
|
||||
@@ -186,8 +186,8 @@ void BasicBlockProfiler::Print(Isolate* isolate, std::ostream& os) {
|
||||
|
||||
void BasicBlockProfiler::Log(Isolate* isolate, std::ostream& os) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
DirectHandle<ArrayList> list(isolate->heap()->basic_block_profiling_data(),
|
||||
isolate);
|
||||
std::unordered_set<std::string> builtin_names;
|
||||
for (int i = 0; i < list->length(); ++i) {
|
||||
BasicBlockProfilerData data(
|
||||
|
||||
@@ -25,7 +25,8 @@ class BasicBlockProfilerData {
|
||||
public:
|
||||
explicit BasicBlockProfilerData(size_t n_blocks);
|
||||
V8_EXPORT_PRIVATE BasicBlockProfilerData(
|
||||
Handle<OnHeapBasicBlockProfilerData> js_heap_data, Isolate* isolate);
|
||||
DirectHandle<OnHeapBasicBlockProfilerData> js_heap_data,
|
||||
Isolate* isolate);
|
||||
V8_EXPORT_PRIVATE BasicBlockProfilerData(
|
||||
Tagged<OnHeapBasicBlockProfilerData> js_heap_data);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ ExternalizeStringExtension::GetNativeFunctionTemplate(
|
||||
|
||||
namespace {
|
||||
|
||||
bool HasExternalForwardingIndex(Handle<String> string) {
|
||||
bool HasExternalForwardingIndex(DirectHandle<String> string) {
|
||||
if (!string->IsShared()) return false;
|
||||
uint32_t raw_hash = string->raw_hash_field(kAcquireLoad);
|
||||
return Name::IsExternalForwardingIndex(raw_hash);
|
||||
@@ -143,7 +143,7 @@ void ExternalizeStringExtension::Externalize(
|
||||
namespace {
|
||||
|
||||
MaybeHandle<String> CopyConsStringToOld(Isolate* isolate,
|
||||
Handle<ConsString> string) {
|
||||
DirectHandle<ConsString> string) {
|
||||
return isolate->factory()->NewConsString(handle(string->first(), isolate),
|
||||
handle(string->second(), isolate),
|
||||
AllocationType::kOld);
|
||||
|
||||
@@ -136,8 +136,8 @@ void CallOptimization::Initialize(IsolateT* isolate,
|
||||
}
|
||||
|
||||
template <class IsolateT>
|
||||
void CallOptimization::AnalyzePossibleApiFunction(IsolateT* isolate,
|
||||
Handle<JSFunction> function) {
|
||||
void CallOptimization::AnalyzePossibleApiFunction(
|
||||
IsolateT* isolate, DirectHandle<JSFunction> function) {
|
||||
if (!function->shared()->IsApiFunction()) return;
|
||||
Handle<FunctionTemplateInfo> function_template_info(
|
||||
function->shared()->api_func_data(), isolate);
|
||||
|
||||
@@ -73,7 +73,7 @@ class CallOptimization {
|
||||
// fast api call builtin.
|
||||
template <class IsolateT>
|
||||
void AnalyzePossibleApiFunction(IsolateT* isolate,
|
||||
Handle<JSFunction> function);
|
||||
DirectHandle<JSFunction> function);
|
||||
|
||||
Handle<JSFunction> constant_function_;
|
||||
Handle<FunctionTemplateInfo> expected_receiver_type_;
|
||||
|
||||
@@ -28,7 +28,7 @@ Tagged<Smi> SetBitFieldValue(Isolate* isolate, Tagged<Smi> smi_handler,
|
||||
template <typename ICHandler, bool fill_handler = true>
|
||||
int InitPrototypeChecksImpl(Isolate* isolate, Handle<ICHandler> handler,
|
||||
Tagged<Smi>* smi_handler,
|
||||
Handle<Map> lookup_start_object_map,
|
||||
DirectHandle<Map> lookup_start_object_map,
|
||||
MaybeObjectHandle data1,
|
||||
MaybeObjectHandle maybe_data2) {
|
||||
int data_size = 1;
|
||||
@@ -48,7 +48,7 @@ int InitPrototypeChecksImpl(Isolate* isolate, Handle<ICHandler> handler,
|
||||
// So we record the original native context to which this handler
|
||||
// corresponds.
|
||||
if (fill_handler) {
|
||||
Handle<Context> native_context = isolate->native_context();
|
||||
DirectHandle<Context> native_context = isolate->native_context();
|
||||
handler->set_data2(MakeWeak(*native_context));
|
||||
} else {
|
||||
// Enable access checks on the lookup start object.
|
||||
@@ -126,8 +126,9 @@ Handle<Object> LoadHandler::LoadFromPrototype(
|
||||
int data_size = GetHandlerDataSize<LoadHandler>(
|
||||
isolate, &smi_handler, lookup_start_object_map, data1, maybe_data2);
|
||||
|
||||
Handle<Object> validity_cell = Map::GetOrCreatePrototypeChainValidityCell(
|
||||
lookup_start_object_map, isolate);
|
||||
DirectHandle<Object> validity_cell =
|
||||
Map::GetOrCreatePrototypeChainValidityCell(lookup_start_object_map,
|
||||
isolate);
|
||||
|
||||
Handle<LoadHandler> handler = isolate->factory()->NewLoadHandler(data_size);
|
||||
|
||||
@@ -148,8 +149,9 @@ Handle<Object> LoadHandler::LoadFullChain(Isolate* isolate,
|
||||
int data_size = GetHandlerDataSize<LoadHandler>(
|
||||
isolate, &smi_handler, lookup_start_object_map, data1);
|
||||
|
||||
Handle<Object> validity_cell = Map::GetOrCreatePrototypeChainValidityCell(
|
||||
lookup_start_object_map, isolate);
|
||||
DirectHandle<Object> validity_cell =
|
||||
Map::GetOrCreatePrototypeChainValidityCell(lookup_start_object_map,
|
||||
isolate);
|
||||
if (IsSmi(*validity_cell)) {
|
||||
DCHECK_EQ(1, data_size);
|
||||
// Lookup on lookup start object isn't supported in case of a simple smi
|
||||
@@ -206,9 +208,11 @@ KeyedAccessStoreMode StoreHandler::GetKeyedAccessStoreMode(
|
||||
|
||||
// static
|
||||
Handle<Object> StoreHandler::StoreElementTransition(
|
||||
Isolate* isolate, Handle<Map> receiver_map, Handle<Map> transition,
|
||||
KeyedAccessStoreMode store_mode, MaybeHandle<Object> prev_validity_cell) {
|
||||
Handle<Object> code = ElementsTransitionAndStoreBuiltin(isolate, store_mode);
|
||||
Isolate* isolate, DirectHandle<Map> receiver_map,
|
||||
DirectHandle<Map> transition, KeyedAccessStoreMode store_mode,
|
||||
MaybeHandle<Object> prev_validity_cell) {
|
||||
DirectHandle<Object> code =
|
||||
ElementsTransitionAndStoreBuiltin(isolate, store_mode);
|
||||
Handle<Object> validity_cell;
|
||||
if (!prev_validity_cell.ToHandle(&validity_cell)) {
|
||||
validity_cell =
|
||||
@@ -228,7 +232,7 @@ MaybeObjectHandle StoreHandler::StoreOwnTransition(Isolate* isolate,
|
||||
#ifdef DEBUG
|
||||
if (!is_dictionary_map) {
|
||||
InternalIndex descriptor = transition_map->LastAdded();
|
||||
Handle<DescriptorArray> descriptors(
|
||||
DirectHandle<DescriptorArray> descriptors(
|
||||
transition_map->instance_descriptors(isolate), isolate);
|
||||
PropertyDetails details = descriptors->GetDetails(descriptor);
|
||||
if (descriptors->GetKey(descriptor)->IsPrivate()) {
|
||||
@@ -261,7 +265,7 @@ MaybeObjectHandle StoreHandler::StoreTransition(Isolate* isolate,
|
||||
#ifdef DEBUG
|
||||
if (!is_dictionary_map) {
|
||||
InternalIndex descriptor = transition_map->LastAdded();
|
||||
Handle<DescriptorArray> descriptors(
|
||||
DirectHandle<DescriptorArray> descriptors(
|
||||
transition_map->instance_descriptors(isolate), isolate);
|
||||
// Private fields must be added via StoreOwnTransition handler.
|
||||
DCHECK(!descriptors->GetKey(descriptor)->IsPrivateName());
|
||||
@@ -320,7 +324,7 @@ Handle<Object> StoreHandler::StoreThroughPrototype(
|
||||
int data_size = GetHandlerDataSize<StoreHandler>(
|
||||
isolate, &smi_handler, receiver_map, data1, maybe_data2);
|
||||
|
||||
Handle<Object> validity_cell =
|
||||
DirectHandle<Object> validity_cell =
|
||||
Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate);
|
||||
|
||||
Handle<StoreHandler> handler = isolate->factory()->NewStoreHandler(data_size);
|
||||
|
||||
@@ -337,8 +337,8 @@ class StoreHandler final : public DataHandler {
|
||||
MaybeObjectHandle maybe_data2 = MaybeObjectHandle());
|
||||
|
||||
static Handle<Object> StoreElementTransition(
|
||||
Isolate* isolate, Handle<Map> receiver_map, Handle<Map> transition,
|
||||
KeyedAccessStoreMode store_mode,
|
||||
Isolate* isolate, DirectHandle<Map> receiver_map,
|
||||
DirectHandle<Map> transition, KeyedAccessStoreMode store_mode,
|
||||
MaybeHandle<Object> prev_validity_cell = MaybeHandle<Object>());
|
||||
|
||||
static Handle<Object> StoreProxy(Isolate* isolate, Handle<Map> receiver_map,
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
void IC::update_lookup_start_object_map(Handle<Object> object) {
|
||||
void IC::update_lookup_start_object_map(DirectHandle<Object> object) {
|
||||
if (IsSmi(*object)) {
|
||||
lookup_start_object_map_ = isolate_->factory()->heap_number_map();
|
||||
} else {
|
||||
|
||||
+75
-67
@@ -112,14 +112,14 @@ const char* GetModifier(KeyedAccessStoreMode mode) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void IC::TraceIC(const char* type, Handle<Object> name) {
|
||||
void IC::TraceIC(const char* type, DirectHandle<Object> name) {
|
||||
if (V8_LIKELY(!TracingFlags::is_ic_stats_enabled())) return;
|
||||
State new_state =
|
||||
(state() == NO_FEEDBACK) ? NO_FEEDBACK : nexus()->ic_state();
|
||||
TraceIC(type, name, state(), new_state);
|
||||
}
|
||||
|
||||
void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
|
||||
void IC::TraceIC(const char* type, DirectHandle<Object> name, State old_state,
|
||||
State new_state) {
|
||||
if (V8_LIKELY(!TracingFlags::is_ic_stats_enabled())) return;
|
||||
|
||||
@@ -218,7 +218,7 @@ static void LookupForRead(LookupIterator* it, bool is_has_property) {
|
||||
return;
|
||||
case LookupIterator::INTERCEPTOR: {
|
||||
// If there is a getter, return; otherwise loop to perform the lookup.
|
||||
Handle<JSObject> holder = it->GetHolder<JSObject>();
|
||||
DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
|
||||
if (!IsUndefined(holder->GetNamedInterceptor()->getter(),
|
||||
it->isolate())) {
|
||||
return;
|
||||
@@ -248,7 +248,7 @@ static void LookupForRead(LookupIterator* it, bool is_has_property) {
|
||||
}
|
||||
}
|
||||
|
||||
bool IC::ShouldRecomputeHandler(Handle<String> name) {
|
||||
bool IC::ShouldRecomputeHandler(DirectHandle<String> name) {
|
||||
if (!RecomputeHandlerForName(name)) return false;
|
||||
|
||||
// This is a contextual access, always just update the handler and stay
|
||||
@@ -267,7 +267,7 @@ bool IC::ShouldRecomputeHandler(Handle<String> name) {
|
||||
if (!IsJSObjectMap(*lookup_start_object_map())) return false;
|
||||
Tagged<Map> first_map = FirstTargetMap();
|
||||
if (first_map.is_null()) return false;
|
||||
Handle<Map> old_map(first_map, isolate());
|
||||
DirectHandle<Map> old_map(first_map, isolate());
|
||||
if (old_map->is_deprecated()) return true;
|
||||
return IsMoreGeneralElementsKindTransition(
|
||||
old_map->elements_kind(), lookup_start_object_map()->elements_kind());
|
||||
@@ -276,7 +276,7 @@ bool IC::ShouldRecomputeHandler(Handle<String> name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IC::RecomputeHandlerForName(Handle<Object> name) {
|
||||
bool IC::RecomputeHandlerForName(DirectHandle<Object> name) {
|
||||
if (is_keyed()) {
|
||||
// Determine whether the failure is due to a name failure.
|
||||
if (!IsName(*name)) return false;
|
||||
@@ -287,7 +287,8 @@ bool IC::RecomputeHandlerForName(Handle<Object> name) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void IC::UpdateState(Handle<Object> lookup_start_object, Handle<Object> name) {
|
||||
void IC::UpdateState(DirectHandle<Object> lookup_start_object,
|
||||
Handle<Object> name) {
|
||||
if (state() == NO_FEEDBACK) return;
|
||||
update_lookup_start_object_map(lookup_start_object);
|
||||
if (!IsString(*name)) return;
|
||||
@@ -345,7 +346,7 @@ bool MigrateDeprecated(Isolate* isolate, Handle<Object> object) {
|
||||
|
||||
} // namespace
|
||||
|
||||
bool IC::ConfigureVectorState(IC::State new_state, Handle<Object> key) {
|
||||
bool IC::ConfigureVectorState(IC::State new_state, DirectHandle<Object> key) {
|
||||
DCHECK_EQ(MEGAMORPHIC, new_state);
|
||||
DCHECK_IMPLIES(!is_keyed(), IsName(*key));
|
||||
bool changed = nexus()->ConfigureMegamorphic(
|
||||
@@ -356,12 +357,12 @@ bool IC::ConfigureVectorState(IC::State new_state, Handle<Object> key) {
|
||||
return changed;
|
||||
}
|
||||
|
||||
void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map,
|
||||
void IC::ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
|
||||
Handle<Object> handler) {
|
||||
ConfigureVectorState(name, map, MaybeObjectHandle(handler));
|
||||
}
|
||||
|
||||
void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map,
|
||||
void IC::ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
|
||||
const MaybeObjectHandle& handler) {
|
||||
if (IsGlobalIC()) {
|
||||
nexus()->ConfigureHandlerMode(handler);
|
||||
@@ -485,12 +486,12 @@ MaybeHandle<Object> LoadGlobalIC::Load(Handle<Name> name,
|
||||
if (IsString(*name)) {
|
||||
// Look up in script context table.
|
||||
Handle<String> str_name = Handle<String>::cast(name);
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
DirectHandle<ScriptContextTable> script_contexts(
|
||||
global->native_context()->script_context_table(), isolate());
|
||||
|
||||
VariableLookupResult lookup_result;
|
||||
if (script_contexts->Lookup(str_name, &lookup_result)) {
|
||||
Handle<Context> script_context(
|
||||
DirectHandle<Context> script_context(
|
||||
script_contexts->get(lookup_result.context_index), isolate());
|
||||
Handle<Object> result(script_context->get(lookup_result.slot_index),
|
||||
isolate());
|
||||
@@ -572,7 +573,8 @@ Handle<NativeContext> GetAccessorContext(
|
||||
|
||||
} // namespace
|
||||
|
||||
bool IC::UpdateMegaDOMIC(const MaybeObjectHandle& handler, Handle<Name> name) {
|
||||
bool IC::UpdateMegaDOMIC(const MaybeObjectHandle& handler,
|
||||
DirectHandle<Name> name) {
|
||||
if (!v8_flags.mega_dom_ic) return false;
|
||||
|
||||
// TODO(gsathya): Enable fuzzing once this feature is more stable.
|
||||
@@ -721,7 +723,7 @@ void IC::UpdateMonomorphicIC(const MaybeObjectHandle& handler,
|
||||
ConfigureVectorState(name, lookup_start_object_map(), handler);
|
||||
}
|
||||
|
||||
void IC::CopyICToMegamorphicCache(Handle<Name> name) {
|
||||
void IC::CopyICToMegamorphicCache(DirectHandle<Name> name) {
|
||||
std::vector<MapAndHandler> maps_and_handlers;
|
||||
nexus()->ExtractMapsAndHandlers(&maps_and_handlers);
|
||||
for (const MapAndHandler& map_and_handler : maps_and_handlers) {
|
||||
@@ -847,7 +849,7 @@ StubCache* IC::stub_cache() {
|
||||
}
|
||||
}
|
||||
|
||||
void IC::UpdateMegamorphicCache(Handle<Map> map, Handle<Name> name,
|
||||
void IC::UpdateMegamorphicCache(DirectHandle<Map> map, DirectHandle<Name> name,
|
||||
const MaybeObjectHandle& handler) {
|
||||
if (!IsAnyHas()) {
|
||||
stub_cache()->Set(*name, *map, *handler);
|
||||
@@ -855,7 +857,7 @@ void IC::UpdateMegamorphicCache(Handle<Map> map, Handle<Name> name,
|
||||
}
|
||||
|
||||
MaybeObjectHandle LoadIC::ComputeHandler(LookupIterator* lookup) {
|
||||
Handle<Object> receiver = lookup->GetReceiver();
|
||||
DirectHandle<Object> receiver = lookup->GetReceiver();
|
||||
ReadOnlyRoots roots(isolate());
|
||||
|
||||
Handle<Object> lookup_start_object = lookup->lookup_start_object();
|
||||
@@ -930,7 +932,7 @@ MaybeObjectHandle LoadIC::ComputeHandler(LookupIterator* lookup) {
|
||||
LoadHandler::LoadField(isolate(), field_index));
|
||||
}
|
||||
if (IsJSModuleNamespace(*holder)) {
|
||||
Handle<ObjectHashTable> exports(
|
||||
DirectHandle<ObjectHashTable> exports(
|
||||
Handle<JSModuleNamespace>::cast(holder)->module()->exports(),
|
||||
isolate());
|
||||
InternalIndex entry =
|
||||
@@ -1035,7 +1037,7 @@ MaybeObjectHandle LoadIC::ComputeHandler(LookupIterator* lookup) {
|
||||
isolate(), map, holder, *smi_handler));
|
||||
}
|
||||
|
||||
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
|
||||
DirectHandle<AccessorInfo> info = Cast<AccessorInfo>(accessors);
|
||||
|
||||
if (info->replace_on_access()) {
|
||||
set_slow_stub_reason(
|
||||
@@ -1153,7 +1155,7 @@ MaybeObjectHandle LoadIC::ComputeHandler(LookupIterator* lookup) {
|
||||
}
|
||||
|
||||
KeyedAccessLoadMode KeyedLoadIC::GetKeyedAccessLoadModeFor(
|
||||
Handle<Map> receiver_map) const {
|
||||
DirectHandle<Map> receiver_map) const {
|
||||
const MaybeObjectHandle& handler = nexus()->FindHandlerForMap(receiver_map);
|
||||
if (handler.is_null()) return KeyedAccessLoadMode::kInBounds;
|
||||
return LoadHandler::GetKeyedAccessLoadMode(*handler);
|
||||
@@ -1253,7 +1255,7 @@ void KeyedLoadIC::UpdateLoadElement(Handle<HeapObject> receiver,
|
||||
namespace {
|
||||
|
||||
bool AllowConvertHoleElementToUndefined(Isolate* isolate,
|
||||
Handle<Map> receiver_map) {
|
||||
DirectHandle<Map> receiver_map) {
|
||||
if (IsJSTypedArrayMap(*receiver_map)) {
|
||||
// For JSTypedArray we never lookup elements in the prototype chain.
|
||||
return true;
|
||||
@@ -1269,7 +1271,8 @@ bool AllowConvertHoleElementToUndefined(Isolate* isolate,
|
||||
// the {receiver}s prototype is either the initial Object.prototype
|
||||
// or the initial Array.prototype, which are both guarded by the
|
||||
// "no elements" protector checked above.
|
||||
Handle<Object> receiver_prototype(receiver_map->prototype(), isolate);
|
||||
DirectHandle<Object> receiver_prototype(receiver_map->prototype(),
|
||||
isolate);
|
||||
|
||||
if (isolate->IsInAnyContext(*receiver_prototype,
|
||||
Context::INITIAL_ARRAY_PROTOTYPE_INDEX) ||
|
||||
@@ -1283,7 +1286,7 @@ bool AllowConvertHoleElementToUndefined(Isolate* isolate,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsOutOfBoundsAccess(Handle<Object> receiver, size_t index) {
|
||||
bool IsOutOfBoundsAccess(DirectHandle<Object> receiver, size_t index) {
|
||||
size_t length;
|
||||
if (IsJSArray(*receiver)) {
|
||||
length = Object::NumberValue(JSArray::cast(*receiver)->length());
|
||||
@@ -1306,7 +1309,8 @@ bool AllowReadingHoleElement(ElementsKind elements_kind) {
|
||||
KeyedAccessLoadMode GetNewKeyedLoadMode(Isolate* isolate,
|
||||
Handle<HeapObject> receiver,
|
||||
size_t index, bool is_found) {
|
||||
Handle<Map> receiver_map(Handle<HeapObject>::cast(receiver)->map(), isolate);
|
||||
DirectHandle<Map> receiver_map(Handle<HeapObject>::cast(receiver)->map(),
|
||||
isolate);
|
||||
if (!AllowConvertHoleElementToUndefined(isolate, receiver_map)) {
|
||||
return KeyedAccessLoadMode::kInBounds;
|
||||
}
|
||||
@@ -1339,7 +1343,8 @@ KeyedAccessLoadMode GetNewKeyedLoadMode(Isolate* isolate,
|
||||
: KeyedAccessLoadMode::kInBounds;
|
||||
}
|
||||
|
||||
KeyedAccessLoadMode GetUpdatedLoadModeForMap(Isolate* isolate, Handle<Map> map,
|
||||
KeyedAccessLoadMode GetUpdatedLoadModeForMap(Isolate* isolate,
|
||||
DirectHandle<Map> map,
|
||||
KeyedAccessLoadMode load_mode) {
|
||||
// If we are not allowed to convert a hole to undefined, then we should not
|
||||
// handle OOB nor reading holes.
|
||||
@@ -1366,7 +1371,7 @@ KeyedAccessLoadMode GetUpdatedLoadModeForMap(Isolate* isolate, Handle<Map> map,
|
||||
} // namespace
|
||||
|
||||
Handle<Object> KeyedLoadIC::LoadElementHandler(
|
||||
Handle<Map> receiver_map, KeyedAccessLoadMode new_load_mode) {
|
||||
DirectHandle<Map> receiver_map, KeyedAccessLoadMode new_load_mode) {
|
||||
// Has a getter interceptor, or is any has and has a query interceptor.
|
||||
if (receiver_map->has_indexed_interceptor() &&
|
||||
(!IsUndefined(receiver_map->GetIndexedInterceptor()->getter(),
|
||||
@@ -1434,10 +1439,10 @@ void KeyedLoadIC::LoadElementPolymorphicHandlers(
|
||||
receiver_maps->erase(
|
||||
std::remove_if(
|
||||
receiver_maps->begin(), receiver_maps->end(),
|
||||
[](const Handle<Map>& map) { return map->is_deprecated(); }),
|
||||
[](const DirectHandle<Map>& map) { return map->is_deprecated(); }),
|
||||
receiver_maps->end());
|
||||
|
||||
for (Handle<Map> receiver_map : *receiver_maps) {
|
||||
for (DirectHandle<Map> receiver_map : *receiver_maps) {
|
||||
// Mark all stable receiver maps that have elements kind transition map
|
||||
// among receiver_maps as unstable because the optimizing compilers may
|
||||
// generate an elements kind transition for this kind of receivers.
|
||||
@@ -1498,7 +1503,8 @@ KeyType TryConvertKey(Handle<Object> key, Isolate* isolate, intptr_t* index_out,
|
||||
return kBailout;
|
||||
}
|
||||
|
||||
bool IntPtrKeyToSize(intptr_t index, Handle<HeapObject> receiver, size_t* out) {
|
||||
bool IntPtrKeyToSize(intptr_t index, DirectHandle<HeapObject> receiver,
|
||||
size_t* out) {
|
||||
if (index < 0) {
|
||||
if (IsJSTypedArray(*receiver)) {
|
||||
// For JSTypedArray receivers, we can support negative keys, which we
|
||||
@@ -1524,7 +1530,7 @@ bool IntPtrKeyToSize(intptr_t index, Handle<HeapObject> receiver, size_t* out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CanCache(Handle<Object> receiver, InlineCacheState state) {
|
||||
bool CanCache(DirectHandle<Object> receiver, InlineCacheState state) {
|
||||
if (!v8_flags.use_ic || state == NO_FEEDBACK) return false;
|
||||
if (!IsJSReceiver(*receiver) && !IsString(*receiver)) return false;
|
||||
return !IsAccessCheckNeeded(*receiver) && !IsJSPrimitiveWrapper(*receiver);
|
||||
@@ -1619,7 +1625,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
case LookupIterator::JSPROXY:
|
||||
return true;
|
||||
case LookupIterator::INTERCEPTOR: {
|
||||
Handle<JSObject> holder = it->GetHolder<JSObject>();
|
||||
DirectHandle<JSObject> holder = it->GetHolder<JSObject>();
|
||||
Tagged<InterceptorInfo> info = holder->GetNamedInterceptor();
|
||||
if (it->HolderIsReceiverOrHiddenPrototype() ||
|
||||
!IsUndefined(info->getter(), isolate()) ||
|
||||
@@ -1706,7 +1712,7 @@ MaybeHandle<Object> StoreGlobalIC::Store(Handle<Name> name,
|
||||
// Look up in script context table.
|
||||
Handle<String> str_name = Handle<String>::cast(name);
|
||||
Handle<JSGlobalObject> global = isolate()->global_object();
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
DirectHandle<ScriptContextTable> script_contexts(
|
||||
global->native_context()->script_context_table(), isolate());
|
||||
|
||||
VariableLookupResult lookup_result;
|
||||
@@ -1980,7 +1986,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
|
||||
if (IsJSGlobalObject(*lookup_start_object_map())) {
|
||||
DCHECK(IsStoreGlobalIC());
|
||||
#ifdef DEBUG
|
||||
Handle<JSObject> holder = lookup->GetHolder<JSObject>();
|
||||
DirectHandle<JSObject> holder = lookup->GetHolder<JSObject>();
|
||||
DCHECK_EQ(*lookup->GetReceiver(), *holder);
|
||||
DCHECK_EQ(*store_target, *holder);
|
||||
#endif
|
||||
@@ -1994,7 +2000,8 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
|
||||
return MaybeObjectHandle(StoreHandler::StoreSlow(isolate()));
|
||||
}
|
||||
|
||||
Handle<Smi> smi_handler = StoreHandler::StoreGlobalProxy(isolate());
|
||||
DirectHandle<Smi> smi_handler =
|
||||
StoreHandler::StoreGlobalProxy(isolate());
|
||||
Handle<Object> handler = StoreHandler::StoreThroughPrototype(
|
||||
isolate(), lookup_start_object_map(), store_target, *smi_handler,
|
||||
MaybeObjectHandle::Weak(lookup->transition_cell()));
|
||||
@@ -2060,7 +2067,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
|
||||
}
|
||||
Handle<Object> accessors = lookup->GetAccessors();
|
||||
if (IsAccessorInfo(*accessors)) {
|
||||
Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
|
||||
DirectHandle<AccessorInfo> info = Cast<AccessorInfo>(accessors);
|
||||
if (!info->has_setter(isolate())) {
|
||||
set_slow_stub_reason("setter == kNullAddress");
|
||||
TRACE_HANDLER_STATS(isolate(), StoreIC_SlowStub);
|
||||
@@ -2112,7 +2119,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
|
||||
isolate(), lookup_start_object_map(), &holder_lookup);
|
||||
if (call_optimization.IsCompatibleReceiverMap(api_holder, holder,
|
||||
holder_lookup)) {
|
||||
Handle<Smi> smi_handler = StoreHandler::StoreApiSetter(
|
||||
DirectHandle<Smi> smi_handler = StoreHandler::StoreApiSetter(
|
||||
isolate(),
|
||||
holder_lookup == CallOptimization::kHolderIsReceiver);
|
||||
|
||||
@@ -2340,7 +2347,7 @@ void KeyedStoreIC::UpdateStoreElement(Handle<Map> receiver_map,
|
||||
if (!StoreModeIsInBounds(store_mode)) {
|
||||
size_t external_arrays = 0;
|
||||
for (MapAndHandler map_and_handler : target_maps_and_handlers) {
|
||||
Handle<Map> map = map_and_handler.first;
|
||||
DirectHandle<Map> map = map_and_handler.first;
|
||||
if (IsJSArrayMap(*map) && JSArray::MayHaveReadOnlyLength(*map)) {
|
||||
set_slow_stub_reason(
|
||||
"unsupported combination of arrays (potentially read-only length)");
|
||||
@@ -2373,7 +2380,7 @@ void KeyedStoreIC::UpdateStoreElement(Handle<Map> receiver_map,
|
||||
}
|
||||
|
||||
Handle<Object> KeyedStoreIC::StoreElementHandler(
|
||||
Handle<Map> receiver_map, KeyedAccessStoreMode store_mode,
|
||||
DirectHandle<Map> receiver_map, KeyedAccessStoreMode store_mode,
|
||||
MaybeHandle<Object> prev_validity_cell) {
|
||||
// The only case when could keep using non-slow element store handler for
|
||||
// a fast array with potentially read-only elements is when it's an
|
||||
@@ -2517,7 +2524,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
|
||||
|
||||
namespace {
|
||||
|
||||
bool MayHaveTypedArrayInPrototypeChain(Handle<JSObject> object) {
|
||||
bool MayHaveTypedArrayInPrototypeChain(DirectHandle<JSObject> object) {
|
||||
for (PrototypeIterator iter(object->GetIsolate(), *object); !iter.IsAtEnd();
|
||||
iter.Advance()) {
|
||||
// Be conservative, don't walk into proxies.
|
||||
@@ -2527,7 +2534,8 @@ bool MayHaveTypedArrayInPrototypeChain(Handle<JSObject> object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, size_t index) {
|
||||
KeyedAccessStoreMode GetStoreMode(DirectHandle<JSObject> receiver,
|
||||
size_t index) {
|
||||
bool oob_access = IsOutOfBoundsAccess(receiver, index);
|
||||
// Don't consider this a growing store if the store would send the receiver to
|
||||
// dictionary mode.
|
||||
@@ -2595,7 +2603,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
// Don't use ICs for maps of the objects in Array's prototype chain. We
|
||||
// expect to be able to trap element sets to objects with those maps in
|
||||
// the runtime to enable optimization of element hole access.
|
||||
Handle<HeapObject> heap_object = Handle<HeapObject>::cast(object);
|
||||
DirectHandle<HeapObject> heap_object = Cast<HeapObject>(object);
|
||||
if (heap_object->map()->IsMapInArrayPrototypeChain(isolate())) {
|
||||
set_slow_stub_reason("map in array prototype");
|
||||
use_ic = false;
|
||||
@@ -2613,14 +2621,14 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
bool key_is_valid_index = (key_type == kIntPtr);
|
||||
KeyedAccessStoreMode store_mode = KeyedAccessStoreMode::kInBounds;
|
||||
if (use_ic && IsJSReceiver(*object) && key_is_valid_index) {
|
||||
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
|
||||
DirectHandle<JSReceiver> receiver = Cast<JSReceiver>(object);
|
||||
old_receiver_map = handle(receiver->map(), isolate());
|
||||
is_arguments = IsJSArgumentsObject(*receiver);
|
||||
bool is_jsobject = IsJSObject(*receiver);
|
||||
size_t index;
|
||||
key_is_valid_index = IntPtrKeyToSize(maybe_index, receiver, &index);
|
||||
if (is_jsobject && !is_arguments && key_is_valid_index) {
|
||||
Handle<JSObject> receiver_object = Handle<JSObject>::cast(object);
|
||||
DirectHandle<JSObject> receiver_object = Cast<JSObject>(object);
|
||||
store_mode = GetStoreMode(receiver_object, index);
|
||||
}
|
||||
}
|
||||
@@ -2664,7 +2672,7 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
// prototype chain does have dictionary elements. This ensures that
|
||||
// other non-dictionary receivers in the polymorphic case benefit
|
||||
// from fast path keyed stores.
|
||||
Handle<HeapObject> receiver = Handle<HeapObject>::cast(object);
|
||||
DirectHandle<HeapObject> receiver = Cast<HeapObject>(object);
|
||||
UpdateStoreElement(old_receiver_map, store_mode,
|
||||
handle(receiver->map(), isolate()));
|
||||
} else {
|
||||
@@ -2815,7 +2823,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
// Runtime functions don't follow the IC's calling convention.
|
||||
Handle<JSGlobalObject> global = isolate->global_object();
|
||||
DirectHandle<JSGlobalObject> global = isolate->global_object();
|
||||
Handle<String> name = args.at<String>(0);
|
||||
int slot = args.tagged_index_value_at(1);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(2);
|
||||
@@ -2988,7 +2996,7 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalIC_Miss) {
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot);
|
||||
FeedbackSlotKind kind = vector->GetKind(vector_slot);
|
||||
StoreGlobalIC ic(isolate, vector, vector_slot, kind);
|
||||
Handle<JSGlobalObject> global = isolate->global_object();
|
||||
DirectHandle<JSGlobalObject> global = isolate->global_object();
|
||||
ic.UpdateState(global, key);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(key, value));
|
||||
}
|
||||
@@ -3018,24 +3026,24 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalIC_Slow) {
|
||||
#ifdef DEBUG
|
||||
{
|
||||
int slot = args.tagged_index_value_at(1);
|
||||
Handle<FeedbackVector> vector = args.at<FeedbackVector>(2);
|
||||
DirectHandle<FeedbackVector> vector = args.at<FeedbackVector>(2);
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot);
|
||||
FeedbackSlotKind slot_kind = vector->GetKind(vector_slot);
|
||||
DCHECK(IsStoreGlobalICKind(slot_kind));
|
||||
Handle<Object> receiver = args.at(3);
|
||||
DirectHandle<Object> receiver = args.at(3);
|
||||
DCHECK(IsJSGlobalProxy(*receiver));
|
||||
}
|
||||
#endif
|
||||
|
||||
Handle<JSGlobalObject> global = isolate->global_object();
|
||||
Handle<Context> native_context = isolate->native_context();
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
DirectHandle<Context> native_context = isolate->native_context();
|
||||
DirectHandle<ScriptContextTable> script_contexts(
|
||||
native_context->script_context_table(), isolate);
|
||||
|
||||
VariableLookupResult lookup_result;
|
||||
if (script_contexts->Lookup(name, &lookup_result)) {
|
||||
Handle<Context> script_context =
|
||||
handle(script_contexts->get(lookup_result.context_index), isolate);
|
||||
DirectHandle<Context> script_context(
|
||||
script_contexts->get(lookup_result.context_index), isolate);
|
||||
if (IsImmutableLexicalVariableMode(lookup_result.mode)) {
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewTypeError(MessageTemplate::kConstAssign, global, name));
|
||||
@@ -3203,9 +3211,9 @@ RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
Handle<Map> map = args.at<Map>(3);
|
||||
DirectHandle<Map> map = args.at<Map>(3);
|
||||
int slot = args.tagged_index_value_at(4);
|
||||
Handle<FeedbackVector> vector = args.at<FeedbackVector>(5);
|
||||
DirectHandle<FeedbackVector> vector = args.at<FeedbackVector>(5);
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot);
|
||||
FeedbackSlotKind kind = vector->GetKind(vector_slot);
|
||||
|
||||
@@ -3243,7 +3251,8 @@ enum class FastCloneObjectMode {
|
||||
kNotSupported,
|
||||
};
|
||||
|
||||
FastCloneObjectMode GetCloneModeForMap(Handle<Map> map, bool null_proto_literal,
|
||||
FastCloneObjectMode GetCloneModeForMap(DirectHandle<Map> map,
|
||||
bool null_proto_literal,
|
||||
Isolate* isolate) {
|
||||
DisallowGarbageCollection no_gc;
|
||||
if (!IsJSObjectMap(*map)) {
|
||||
@@ -3300,10 +3309,9 @@ FastCloneObjectMode GetCloneModeForMap(Handle<Map> map, bool null_proto_literal,
|
||||
return mode;
|
||||
}
|
||||
|
||||
bool CanCacheCloneTargetMapTransition(Handle<Map> source_map,
|
||||
std::optional<Handle<Map>> target_map,
|
||||
bool null_proto_literal,
|
||||
Isolate* isolate) {
|
||||
bool CanCacheCloneTargetMapTransition(
|
||||
DirectHandle<Map> source_map, std::optional<DirectHandle<Map>> target_map,
|
||||
bool null_proto_literal, Isolate* isolate) {
|
||||
if (!v8_flags.clone_object_sidestep_transitions || null_proto_literal) {
|
||||
return false;
|
||||
}
|
||||
@@ -3325,8 +3333,8 @@ bool CanCacheCloneTargetMapTransition(Handle<Map> source_map,
|
||||
return !(*target_map)->is_deprecated();
|
||||
}
|
||||
|
||||
bool CanFastCloneObjectWithDifferentMaps(Handle<Map> source_map,
|
||||
Handle<Map> target_map,
|
||||
bool CanFastCloneObjectWithDifferentMaps(DirectHandle<Map> source_map,
|
||||
DirectHandle<Map> target_map,
|
||||
bool null_proto_literal,
|
||||
Isolate* isolate) {
|
||||
DisallowGarbageCollection no_gc;
|
||||
@@ -3451,7 +3459,7 @@ static MaybeHandle<JSObject> CloneObjectSlowPath(Isolate* isolate,
|
||||
// surrounding literal.
|
||||
int properties = source_map->GetInObjectProperties() -
|
||||
source_map->UnusedInObjectProperties();
|
||||
Handle<Map> map = isolate->factory()->ObjectLiteralMapFromCache(
|
||||
DirectHandle<Map> map = isolate->factory()->ObjectLiteralMapFromCache(
|
||||
isolate->native_context(), properties);
|
||||
new_object = isolate->factory()->NewFastOrSlowJSObjectFromMap(map);
|
||||
} else {
|
||||
@@ -3484,7 +3492,7 @@ RUNTIME_FUNCTION(Runtime_CloneObjectIC_Slow) {
|
||||
namespace {
|
||||
|
||||
std::optional<Tagged<Map>> GetCloneTargetMap(Isolate* isolate,
|
||||
Handle<Map> source_map) {
|
||||
DirectHandle<Map> source_map) {
|
||||
if (!v8_flags.clone_object_sidestep_transitions) return {};
|
||||
ReadOnlyRoots roots(isolate);
|
||||
auto maybe_target =
|
||||
@@ -3522,7 +3530,7 @@ std::optional<Tagged<Map>> GetCloneTargetMap(Isolate* isolate,
|
||||
}
|
||||
|
||||
void SetCloneTargetMap(Isolate* isolate, Handle<Map> source_map,
|
||||
Handle<Map> new_target_map) {
|
||||
DirectHandle<Map> new_target_map) {
|
||||
if (!v8_flags.clone_object_sidestep_transitions) return;
|
||||
DCHECK(CanCacheCloneTargetMapTransition(source_map, new_target_map, false,
|
||||
isolate));
|
||||
@@ -3662,8 +3670,8 @@ RUNTIME_FUNCTION(Runtime_CloneObjectIC_Miss) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) {
|
||||
Handle<JSObject> receiver = args.at<JSObject>(0);
|
||||
Handle<JSObject> holder = args.at<JSObject>(1);
|
||||
Handle<AccessorInfo> info = args.at<AccessorInfo>(2);
|
||||
DirectHandle<JSObject> holder = args.at<JSObject>(1);
|
||||
DirectHandle<AccessorInfo> info = args.at<AccessorInfo>(2);
|
||||
Handle<Name> name = args.at<Name>(3);
|
||||
Handle<Object> value = args.at(4);
|
||||
HandleScope scope(isolate);
|
||||
@@ -3731,7 +3739,7 @@ RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptor) {
|
||||
if (it.IsFound()) return *result;
|
||||
|
||||
int slot = args.tagged_index_value_at(3);
|
||||
Handle<FeedbackVector> vector = args.at<FeedbackVector>(4);
|
||||
DirectHandle<FeedbackVector> vector = args.at<FeedbackVector>(4);
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot);
|
||||
FeedbackSlotKind slot_kind = vector->GetKind(vector_slot);
|
||||
// It could actually be any kind of load IC slot here but the predicate
|
||||
@@ -3764,7 +3772,7 @@ RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
|
||||
}
|
||||
DCHECK(interceptor_holder->HasNamedInterceptor());
|
||||
{
|
||||
Handle<InterceptorInfo> interceptor(
|
||||
DirectHandle<InterceptorInfo> interceptor(
|
||||
interceptor_holder->GetNamedInterceptor(), isolate);
|
||||
|
||||
DCHECK(!interceptor->non_masking());
|
||||
|
||||
+19
-16
@@ -39,10 +39,11 @@ class IC {
|
||||
|
||||
// Compute the current IC state based on the target stub, lookup_start_object
|
||||
// and name.
|
||||
void UpdateState(Handle<Object> lookup_start_object, Handle<Object> name);
|
||||
void UpdateState(DirectHandle<Object> lookup_start_object,
|
||||
Handle<Object> name);
|
||||
|
||||
bool RecomputeHandlerForName(Handle<Object> name);
|
||||
void MarkRecomputeHandler(Handle<Object> name) {
|
||||
bool RecomputeHandlerForName(DirectHandle<Object> name);
|
||||
void MarkRecomputeHandler(DirectHandle<Object> name) {
|
||||
DCHECK(RecomputeHandlerForName(name));
|
||||
old_state_ = state_;
|
||||
state_ = InlineCacheState::RECOMPUTE_HANDLER;
|
||||
@@ -80,11 +81,11 @@ class IC {
|
||||
inline bool vector_needs_update();
|
||||
|
||||
// Configure for most states.
|
||||
bool ConfigureVectorState(IC::State new_state, Handle<Object> key);
|
||||
bool ConfigureVectorState(IC::State new_state, DirectHandle<Object> key);
|
||||
// Configure the vector for MONOMORPHIC.
|
||||
void ConfigureVectorState(Handle<Name> name, Handle<Map> map,
|
||||
void ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
|
||||
Handle<Object> handler);
|
||||
void ConfigureVectorState(Handle<Name> name, Handle<Map> map,
|
||||
void ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
|
||||
const MaybeObjectHandle& handler);
|
||||
// Configure the vector for POLYMORPHIC.
|
||||
void ConfigureVectorState(Handle<Name> name, MapHandlesSpan maps,
|
||||
@@ -93,8 +94,8 @@ class IC {
|
||||
Handle<Name> name, std::vector<MapAndHandler> const& maps_and_handlers);
|
||||
|
||||
char TransitionMarkFromState(IC::State state);
|
||||
void TraceIC(const char* type, Handle<Object> name);
|
||||
void TraceIC(const char* type, Handle<Object> name, State old_state,
|
||||
void TraceIC(const char* type, DirectHandle<Object> name);
|
||||
void TraceIC(const char* type, DirectHandle<Object> name, State old_state,
|
||||
State new_state);
|
||||
|
||||
MaybeHandle<Object> TypeError(MessageTemplate, Handle<Object> object,
|
||||
@@ -102,14 +103,15 @@ class IC {
|
||||
MaybeHandle<Object> ReferenceError(Handle<Name> name);
|
||||
|
||||
void UpdateMonomorphicIC(const MaybeObjectHandle& handler, Handle<Name> name);
|
||||
bool UpdateMegaDOMIC(const MaybeObjectHandle& handler, Handle<Name> name);
|
||||
bool UpdateMegaDOMIC(const MaybeObjectHandle& handler,
|
||||
DirectHandle<Name> name);
|
||||
bool UpdatePolymorphicIC(Handle<Name> name, const MaybeObjectHandle& handler);
|
||||
void UpdateMegamorphicCache(Handle<Map> map, Handle<Name> name,
|
||||
void UpdateMegamorphicCache(DirectHandle<Map> map, DirectHandle<Name> name,
|
||||
const MaybeObjectHandle& handler);
|
||||
|
||||
StubCache* stub_cache();
|
||||
|
||||
void CopyICToMegamorphicCache(Handle<Name> name);
|
||||
void CopyICToMegamorphicCache(DirectHandle<Name> name);
|
||||
bool IsTransitionOfMonomorphicTarget(Tagged<Map> source_map,
|
||||
Tagged<Map> target_map);
|
||||
void SetCache(Handle<Name> name, Handle<Object> handler);
|
||||
@@ -132,10 +134,10 @@ class IC {
|
||||
return IsKeyedLoadIC() || IsKeyedStoreIC() || IsStoreInArrayLiteralIC() ||
|
||||
IsKeyedHasIC() || IsDefineKeyedOwnIC();
|
||||
}
|
||||
bool ShouldRecomputeHandler(Handle<String> name);
|
||||
bool ShouldRecomputeHandler(DirectHandle<String> name);
|
||||
|
||||
Handle<Map> lookup_start_object_map() { return lookup_start_object_map_; }
|
||||
inline void update_lookup_start_object_map(Handle<Object> object);
|
||||
inline void update_lookup_start_object_map(DirectHandle<Object> object);
|
||||
|
||||
void TargetMaps(MapHandles* list) {
|
||||
FindTargetMaps();
|
||||
@@ -244,14 +246,15 @@ class KeyedLoadIC : public LoadIC {
|
||||
private:
|
||||
friend class IC;
|
||||
|
||||
Handle<Object> LoadElementHandler(Handle<Map> receiver_map,
|
||||
Handle<Object> LoadElementHandler(DirectHandle<Map> receiver_map,
|
||||
KeyedAccessLoadMode new_load_mode);
|
||||
|
||||
void LoadElementPolymorphicHandlers(MapHandles* receiver_maps,
|
||||
MaybeObjectHandles* handlers,
|
||||
KeyedAccessLoadMode new_load_mode);
|
||||
|
||||
KeyedAccessLoadMode GetKeyedAccessLoadModeFor(Handle<Map> receiver_map) const;
|
||||
KeyedAccessLoadMode GetKeyedAccessLoadModeFor(
|
||||
DirectHandle<Map> receiver_map) const;
|
||||
};
|
||||
|
||||
class StoreIC : public IC {
|
||||
@@ -326,7 +329,7 @@ class KeyedStoreIC : public StoreIC {
|
||||
TransitionMode transition_mode);
|
||||
|
||||
Handle<Object> StoreElementHandler(
|
||||
Handle<Map> receiver_map, KeyedAccessStoreMode store_mode,
|
||||
DirectHandle<Map> receiver_map, KeyedAccessStoreMode store_mode,
|
||||
MaybeHandle<Object> prev_validity_cell = MaybeHandle<Object>());
|
||||
|
||||
void StoreElementPolymorphicHandlers(
|
||||
|
||||
+210
-201
File diff suppressed because it is too large.
Load diff
@@ -34,7 +34,7 @@ class SourceCodeCache final {
|
||||
Handle<SharedFunctionInfo>* handle);
|
||||
|
||||
void Add(Isolate* isolate, base::Vector<const char> name,
|
||||
Handle<SharedFunctionInfo> shared);
|
||||
DirectHandle<SharedFunctionInfo> shared);
|
||||
|
||||
private:
|
||||
Script::Type type_;
|
||||
|
||||
@@ -203,7 +203,7 @@ Handle<TrustedFixedArray> ConstantArrayBuilder::ToFixedArray(
|
||||
#endif
|
||||
// Copy objects from slice into array.
|
||||
for (size_t i = 0; i < slice->size(); ++i) {
|
||||
Handle<Object> value =
|
||||
DirectHandle<Object> value =
|
||||
slice->At(slice->start_index() + i).ToHandle(isolate);
|
||||
fixed_array->set(array_index++, *value);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class InterpreterCompilationJob final : public UnoptimizedCompilationJob {
|
||||
BytecodeGenerator* generator() { return &generator_; }
|
||||
template <typename IsolateT>
|
||||
void CheckAndPrintBytecodeMismatch(IsolateT* isolate, Handle<Script> script,
|
||||
Handle<BytecodeArray> bytecode);
|
||||
DirectHandle<BytecodeArray> bytecode);
|
||||
|
||||
template <typename IsolateT>
|
||||
Status DoFinalizeJobImpl(Handle<SharedFunctionInfo> shared_info,
|
||||
@@ -152,7 +152,7 @@ void MaybePrintAst(ParseInfo* parse_info,
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
bool ShouldPrintBytecode(Handle<SharedFunctionInfo> shared) {
|
||||
bool ShouldPrintBytecode(DirectHandle<SharedFunctionInfo> shared) {
|
||||
if (!v8_flags.print_bytecode) return false;
|
||||
|
||||
// Checks whether function passed the filter.
|
||||
@@ -207,13 +207,14 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
|
||||
#ifdef DEBUG
|
||||
template <typename IsolateT>
|
||||
void InterpreterCompilationJob::CheckAndPrintBytecodeMismatch(
|
||||
IsolateT* isolate, Handle<Script> script, Handle<BytecodeArray> bytecode) {
|
||||
IsolateT* isolate, Handle<Script> script,
|
||||
DirectHandle<BytecodeArray> bytecode) {
|
||||
int first_mismatch = generator()->CheckBytecodeMatches(*bytecode);
|
||||
if (first_mismatch >= 0) {
|
||||
parse_info()->ast_value_factory()->Internalize(isolate);
|
||||
DeclarationScope::AllocateScopeInfos(parse_info(), isolate);
|
||||
|
||||
Handle<BytecodeArray> new_bytecode =
|
||||
DirectHandle<BytecodeArray> new_bytecode =
|
||||
generator()->FinalizeBytecode(isolate, script);
|
||||
|
||||
std::cerr << "Bytecode mismatch";
|
||||
@@ -275,7 +276,7 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::DoFinalizeJobImpl(
|
||||
|
||||
if (compilation_info()->SourcePositionRecordingMode() ==
|
||||
SourcePositionTableBuilder::RecordingMode::RECORD_SOURCE_POSITIONS) {
|
||||
Handle<TrustedByteArray> source_position_table =
|
||||
DirectHandle<TrustedByteArray> source_position_table =
|
||||
generator()->FinalizeSourcePositionTable(isolate);
|
||||
bytecodes->set_source_position_table(*source_position_table, kReleaseStore);
|
||||
}
|
||||
@@ -340,7 +341,7 @@ void Interpreter::Initialize() {
|
||||
|
||||
// Set the interpreter entry trampoline entry point now that builtins are
|
||||
// initialized.
|
||||
Handle<Code> code = BUILTIN_CODE(isolate_, InterpreterEntryTrampoline);
|
||||
DirectHandle<Code> code = BUILTIN_CODE(isolate_, InterpreterEntryTrampoline);
|
||||
DCHECK(builtins->is_initialized());
|
||||
DCHECK(!code->has_instruction_stream());
|
||||
interpreter_entry_trampoline_instruction_start_ = code->instruction_start();
|
||||
|
||||
+13
-10
@@ -1391,8 +1391,8 @@ void AppendCodeCreateHeader(Isolate* isolate, LogFile::MessageBuilder& msg,
|
||||
// <fns> is the function table encoded as a sequence of strings
|
||||
// S<shared-function-info-address>
|
||||
|
||||
void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
|
||||
Handle<SharedFunctionInfo> shared) {
|
||||
void V8FileLogger::LogSourceCodeInformation(
|
||||
Handle<AbstractCode> code, DirectHandle<SharedFunctionInfo> shared) {
|
||||
PtrComprCageBase cage_base(isolate_);
|
||||
Tagged<Object> script_object = shared->script(cage_base);
|
||||
if (!IsScript(script_object, cage_base)) return;
|
||||
@@ -1460,7 +1460,7 @@ void V8FileLogger::LogSourceCodeInformation(Handle<AbstractCode> code,
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
void V8FileLogger::LogCodeDisassemble(Handle<AbstractCode> code) {
|
||||
void V8FileLogger::LogCodeDisassemble(DirectHandle<AbstractCode> code) {
|
||||
if (!v8_flags.log_code_disassemble) return;
|
||||
VMStateIfMainThread<LOGGING> state(isolate_);
|
||||
PtrComprCageBase cage_base(isolate_);
|
||||
@@ -1613,7 +1613,8 @@ void V8FileLogger::CodeCreateEvent(CodeTag tag, const wasm::WasmCode* code,
|
||||
}
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
|
||||
void V8FileLogger::CallbackEventInternal(const char* prefix, Handle<Name> name,
|
||||
void V8FileLogger::CallbackEventInternal(const char* prefix,
|
||||
DirectHandle<Name> name,
|
||||
Address entry_point) {
|
||||
if (!v8_flags.log_code) return;
|
||||
VMStateIfMainThread<LOGGING> state(isolate_);
|
||||
@@ -1684,8 +1685,9 @@ void V8FileLogger::CodeDisableOptEvent(Handle<AbstractCode> code,
|
||||
msg.WriteToLogFile();
|
||||
}
|
||||
|
||||
void V8FileLogger::ProcessDeoptEvent(Handle<Code> code, SourcePosition position,
|
||||
const char* kind, const char* reason) {
|
||||
void V8FileLogger::ProcessDeoptEvent(DirectHandle<Code> code,
|
||||
SourcePosition position, const char* kind,
|
||||
const char* reason) {
|
||||
VMStateIfMainThread<LOGGING> state(isolate_);
|
||||
MSG_BUILDER();
|
||||
msg << Event::kCodeDeopt << kNext << Time() << kNext
|
||||
@@ -1967,8 +1969,9 @@ void V8FileLogger::TickEvent(TickSample* sample, bool overflow) {
|
||||
}
|
||||
|
||||
void V8FileLogger::ICEvent(const char* type, bool keyed, Handle<Map> map,
|
||||
Handle<Object> key, char old_state, char new_state,
|
||||
const char* modifier, const char* slow_stub_reason) {
|
||||
DirectHandle<Object> key, char old_state,
|
||||
char new_state, const char* modifier,
|
||||
const char* slow_stub_reason) {
|
||||
if (!v8_flags.log_ic) return;
|
||||
VMStateIfMainThread<LOGGING> state(isolate_);
|
||||
int line;
|
||||
@@ -2645,8 +2648,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
|
||||
}
|
||||
} else if (shared->IsApiFunction()) {
|
||||
// API function.
|
||||
Handle<FunctionTemplateInfo> fun_data =
|
||||
handle(shared->api_func_data(), isolate_);
|
||||
DirectHandle<FunctionTemplateInfo> fun_data(shared->api_func_data(),
|
||||
isolate_);
|
||||
if (fun_data->has_callback(isolate_)) {
|
||||
Address entry_point = fun_data->callback(isolate_);
|
||||
#if USES_FUNCTION_DESCRIPTORS
|
||||
|
||||
+5
-5
@@ -208,7 +208,7 @@ class V8FileLogger : public LogEventListener {
|
||||
Tagged<AbstractCode> code);
|
||||
void WeakCodeClearEvent() override {}
|
||||
|
||||
void ProcessDeoptEvent(Handle<Code> code, SourcePosition position,
|
||||
void ProcessDeoptEvent(DirectHandle<Code> code, SourcePosition position,
|
||||
const char* kind, const char* reason);
|
||||
|
||||
// Emits a code line info record event.
|
||||
@@ -223,7 +223,7 @@ class V8FileLogger : public LogEventListener {
|
||||
void CodeNameEvent(Address addr, int pos, const char* code_name);
|
||||
|
||||
void ICEvent(const char* type, bool keyed, Handle<Map> map,
|
||||
Handle<Object> key, char old_state, char new_state,
|
||||
DirectHandle<Object> key, char old_state, char new_state,
|
||||
const char* modifier, const char* slow_stub_reason);
|
||||
|
||||
void MapEvent(const char* type, Handle<Map> from, Handle<Map> to,
|
||||
@@ -308,7 +308,7 @@ class V8FileLogger : public LogEventListener {
|
||||
void ProfilerBeginEvent();
|
||||
|
||||
// Emits callback event messages.
|
||||
void CallbackEventInternal(const char* prefix, Handle<Name> name,
|
||||
void CallbackEventInternal(const char* prefix, DirectHandle<Name> name,
|
||||
Address entry_point);
|
||||
|
||||
// Internal configurable move event.
|
||||
@@ -329,8 +329,8 @@ class V8FileLogger : public LogEventListener {
|
||||
bool EnsureLogScriptSource(Tagged<Script> script);
|
||||
|
||||
void LogSourceCodeInformation(Handle<AbstractCode> code,
|
||||
Handle<SharedFunctionInfo> shared);
|
||||
void LogCodeDisassemble(Handle<AbstractCode> code);
|
||||
DirectHandle<SharedFunctionInfo> shared);
|
||||
void LogCodeDisassemble(DirectHandle<AbstractCode> code);
|
||||
|
||||
void WriteApiSecurityCheck();
|
||||
void WriteApiNamedPropertyAccess(const char* tag, Tagged<JSObject> holder,
|
||||
|
||||
@@ -378,7 +378,8 @@ inline bool ClobberedBy(RegList written_registers, Register reg) {
|
||||
inline bool ClobberedBy(RegList written_registers, DoubleRegister reg) {
|
||||
return false;
|
||||
}
|
||||
inline bool ClobberedBy(RegList written_registers, Handle<Object> handle) {
|
||||
inline bool ClobberedBy(RegList written_registers,
|
||||
DirectHandle<Object> handle) {
|
||||
return false;
|
||||
}
|
||||
inline bool ClobberedBy(RegList written_registers, Tagged<Smi> smi) {
|
||||
@@ -405,7 +406,7 @@ inline bool ClobberedBy(DoubleRegList written_registers, DoubleRegister reg) {
|
||||
return written_registers.has(reg);
|
||||
}
|
||||
inline bool ClobberedBy(DoubleRegList written_registers,
|
||||
Handle<Object> handle) {
|
||||
DirectHandle<Object> handle) {
|
||||
return false;
|
||||
}
|
||||
inline bool ClobberedBy(DoubleRegList written_registers, Tagged<Smi> smi) {
|
||||
@@ -437,7 +438,8 @@ inline bool MachineTypeMatches(MachineType type, DoubleRegister reg) {
|
||||
inline bool MachineTypeMatches(MachineType type, MemOperand reg) {
|
||||
return true;
|
||||
}
|
||||
inline bool MachineTypeMatches(MachineType type, Handle<HeapObject> handle) {
|
||||
inline bool MachineTypeMatches(MachineType type,
|
||||
DirectHandle<HeapObject> handle) {
|
||||
return type.IsTagged() && !type.IsTaggedSigned();
|
||||
}
|
||||
inline bool MachineTypeMatches(MachineType type, Tagged<Smi> smi) {
|
||||
|
||||
@@ -1306,7 +1306,7 @@ class MaglevFrameTranslationBuilder {
|
||||
}
|
||||
|
||||
void BuildHeapNumber(Float64 number) {
|
||||
Handle<Object> value =
|
||||
DirectHandle<Object> value =
|
||||
local_isolate_->factory()->NewHeapNumberFromBits<AllocationType::kOld>(
|
||||
number.get_bits());
|
||||
translation_array_builder_->StoreLiteral(GetDeoptLiteral(*value));
|
||||
@@ -1567,7 +1567,7 @@ GlobalHandleVector<Map> MaglevCodeGenerator::RetainedMaps(Isolate* isolate) {
|
||||
DisallowGarbageCollection no_gc;
|
||||
GlobalHandleVector<Map> maps(isolate->heap());
|
||||
maps.Reserve(retained_maps_.size());
|
||||
for (Handle<Map> map : retained_maps_) maps.Push(*map);
|
||||
for (DirectHandle<Map> map : retained_maps_) maps.Push(*map);
|
||||
return maps;
|
||||
}
|
||||
|
||||
@@ -1750,7 +1750,7 @@ MaybeHandle<Code> MaglevCodeGenerator::BuildCodeObject(
|
||||
}
|
||||
|
||||
GlobalHandleVector<Map> MaglevCodeGenerator::CollectRetainedMaps(
|
||||
Handle<Code> code) {
|
||||
DirectHandle<Code> code) {
|
||||
DCHECK(code->is_optimized_code());
|
||||
|
||||
DisallowGarbageCollection no_gc;
|
||||
@@ -1781,10 +1781,10 @@ Handle<DeoptimizationData> MaglevCodeGenerator::GenerateDeoptimizationData(
|
||||
Handle<DeoptimizationData> data =
|
||||
DeoptimizationData::New(local_isolate, deopt_count);
|
||||
|
||||
Handle<DeoptimizationFrameTranslation> translations =
|
||||
DirectHandle<DeoptimizationFrameTranslation> translations =
|
||||
frame_translation_builder_.ToFrameTranslation(local_isolate->factory());
|
||||
|
||||
Handle<SharedFunctionInfoWrapper> sfi_wrapper =
|
||||
DirectHandle<SharedFunctionInfoWrapper> sfi_wrapper =
|
||||
local_isolate->factory()->NewSharedFunctionInfoWrapper(
|
||||
code_gen_state_.compilation_info()
|
||||
->toplevel_compilation_unit()
|
||||
@@ -1809,10 +1809,10 @@ Handle<DeoptimizationData> MaglevCodeGenerator::GenerateDeoptimizationData(
|
||||
|
||||
int inlined_functions_size =
|
||||
static_cast<int>(graph_->inlined_functions().size());
|
||||
Handle<DeoptimizationLiteralArray> literals =
|
||||
DirectHandle<DeoptimizationLiteralArray> literals =
|
||||
local_isolate->factory()->NewDeoptimizationLiteralArray(
|
||||
deopt_literals_.size() + inlined_functions_size + 1);
|
||||
Handle<TrustedPodArray<InliningPosition>> inlining_positions =
|
||||
DirectHandle<TrustedPodArray<InliningPosition>> inlining_positions =
|
||||
TrustedPodArray<InliningPosition>::New(local_isolate,
|
||||
inlined_functions_size);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class MaglevCodeGenerator final {
|
||||
void EmitMetadata();
|
||||
void RecordInlinedFunctions();
|
||||
|
||||
GlobalHandleVector<Map> CollectRetainedMaps(Handle<Code> code);
|
||||
GlobalHandleVector<Map> CollectRetainedMaps(DirectHandle<Code> code);
|
||||
Handle<DeoptimizationData> GenerateDeoptimizationData(
|
||||
LocalIsolate* local_isolate);
|
||||
MaybeHandle<Code> BuildCodeObject(LocalIsolate* local_isolate);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace internal {
|
||||
namespace maglev {
|
||||
|
||||
MaglevCompilationUnit::MaglevCompilationUnit(MaglevCompilationInfo* info,
|
||||
Handle<JSFunction> function)
|
||||
DirectHandle<JSFunction> function)
|
||||
: MaglevCompilationUnit(
|
||||
info, nullptr,
|
||||
MakeRef(info->broker(), info->broker()->CanonicalPersistentHandle(
|
||||
|
||||
@@ -43,7 +43,7 @@ class MaglevCompilationUnit : public ZoneObject {
|
||||
}
|
||||
|
||||
MaglevCompilationUnit(MaglevCompilationInfo* info,
|
||||
Handle<JSFunction> function);
|
||||
DirectHandle<JSFunction> function);
|
||||
|
||||
MaglevCompilationUnit(MaglevCompilationInfo* info,
|
||||
const MaglevCompilationUnit* caller,
|
||||
|
||||
@@ -165,7 +165,7 @@ CompilationJob::Status MaglevCompilationJob::FinalizeJobImpl(Isolate* isolate) {
|
||||
}
|
||||
|
||||
GlobalHandleVector<Map> MaglevCompilationJob::CollectRetainedMaps(
|
||||
Isolate* isolate, Handle<Code> code) {
|
||||
Isolate* isolate, DirectHandle<Code> code) {
|
||||
if (v8_flags.maglev_build_code_on_background) {
|
||||
return info()->code_generator()->RetainedMaps(isolate);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class MaglevCompilationJob final : public OptimizedCompilationJob {
|
||||
void BeginPhaseKind(const char* name);
|
||||
void EndPhaseKind();
|
||||
GlobalHandleVector<Map> CollectRetainedMaps(Isolate* isolate,
|
||||
Handle<Code> code);
|
||||
DirectHandle<Code> code);
|
||||
|
||||
MaglevCompilationInfo* info() const { return info_.get(); }
|
||||
|
||||
|
||||
@@ -4083,7 +4083,7 @@ MaglevGraphBuilder::TryFoldLoadDictPrototypeConstant(
|
||||
if (!constant.has_value()) return {};
|
||||
|
||||
for (compiler::MapRef map : access_info.lookup_start_object_maps()) {
|
||||
Handle<Map> map_handle = map.object();
|
||||
DirectHandle<Map> map_handle = map.object();
|
||||
// Non-JSReceivers that passed AccessInfoFactory::ComputePropertyAccessInfo
|
||||
// must have different lookup start map.
|
||||
if (!IsJSReceiverMap(*map_handle)) {
|
||||
|
||||
+12
-10
@@ -561,7 +561,7 @@ void MaybeProcessSourceRanges(ParseInfo* parse_info, Expression* root,
|
||||
|
||||
} // namespace
|
||||
|
||||
void Parser::ParseProgram(Isolate* isolate, Handle<Script> script,
|
||||
void Parser::ParseProgram(Isolate* isolate, DirectHandle<Script> script,
|
||||
ParseInfo* info,
|
||||
MaybeHandle<ScopeInfo> maybe_outer_scope_info) {
|
||||
DCHECK_EQ(script->id(), flags().script_id());
|
||||
@@ -764,7 +764,8 @@ ZonePtrList<const AstRawString>* Parser::PrepareWrappedArguments(
|
||||
Isolate* isolate, ParseInfo* info, Zone* zone) {
|
||||
DCHECK(parsing_on_main_thread_);
|
||||
DCHECK_NOT_NULL(isolate);
|
||||
Handle<FixedArray> arguments = maybe_wrapped_arguments_.ToHandleChecked();
|
||||
DirectHandle<FixedArray> arguments =
|
||||
maybe_wrapped_arguments_.ToHandleChecked();
|
||||
int arguments_length = arguments->length();
|
||||
ZonePtrList<const AstRawString>* arguments_for_wrapped_function =
|
||||
zone->New<ZonePtrList<const AstRawString>>(arguments_length, zone);
|
||||
@@ -868,7 +869,7 @@ Expression* Parser::WrapREPLResult(Expression* value) {
|
||||
}
|
||||
|
||||
void Parser::ParseFunction(Isolate* isolate, ParseInfo* info,
|
||||
Handle<SharedFunctionInfo> shared_info) {
|
||||
DirectHandle<SharedFunctionInfo> shared_info) {
|
||||
// It's OK to use the Isolate & counters here, since this function is only
|
||||
// called in the main thread.
|
||||
DCHECK(parsing_on_main_thread_);
|
||||
@@ -893,7 +894,7 @@ void Parser::ParseFunction(Isolate* isolate, ParseInfo* info,
|
||||
shared_info->HasOuterScopeInfo() &&
|
||||
maybe_outer_scope_info.ToHandleChecked()->scope_type() == CLASS_SCOPE &&
|
||||
maybe_outer_scope_info.ToHandleChecked()->EndPosition() == end_position) {
|
||||
Handle<ScopeInfo> outer_scope_info =
|
||||
DirectHandle<ScopeInfo> outer_scope_info =
|
||||
maybe_outer_scope_info.ToHandleChecked();
|
||||
if (outer_scope_info->HasOuterScopeInfo()) {
|
||||
deserialize_start_scope =
|
||||
@@ -915,7 +916,7 @@ void Parser::ParseFunction(Isolate* isolate, ParseInfo* info,
|
||||
}
|
||||
DCHECK_EQ(factory()->zone(), info->zone());
|
||||
|
||||
Handle<Script> script = handle(Script::cast(shared_info->script()), isolate);
|
||||
DirectHandle<Script> script(Script::cast(shared_info->script()), isolate);
|
||||
if (shared_info->is_wrapped()) {
|
||||
maybe_wrapped_arguments_ = handle(script->wrapped_arguments(), isolate);
|
||||
}
|
||||
@@ -3411,7 +3412,8 @@ void Parser::InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope) {
|
||||
// Parser support
|
||||
|
||||
template <typename IsolateT>
|
||||
void Parser::HandleSourceURLComments(IsolateT* isolate, Handle<Script> script) {
|
||||
void Parser::HandleSourceURLComments(IsolateT* isolate,
|
||||
DirectHandle<Script> script) {
|
||||
Handle<String> source_url = scanner_.SourceUrl(isolate);
|
||||
if (!source_url.is_null()) {
|
||||
script->set_source_url(*source_url);
|
||||
@@ -3426,11 +3428,11 @@ void Parser::HandleSourceURLComments(IsolateT* isolate, Handle<Script> script) {
|
||||
}
|
||||
|
||||
template void Parser::HandleSourceURLComments(Isolate* isolate,
|
||||
Handle<Script> script);
|
||||
DirectHandle<Script> script);
|
||||
template void Parser::HandleSourceURLComments(LocalIsolate* isolate,
|
||||
Handle<Script> script);
|
||||
DirectHandle<Script> script);
|
||||
|
||||
void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) {
|
||||
void Parser::UpdateStatistics(Isolate* isolate, DirectHandle<Script> script) {
|
||||
CHECK_NOT_NULL(isolate);
|
||||
|
||||
// Move statistics to Isolate.
|
||||
@@ -3455,7 +3457,7 @@ void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) {
|
||||
}
|
||||
|
||||
void Parser::UpdateStatistics(
|
||||
Handle<Script> script,
|
||||
DirectHandle<Script> script,
|
||||
base::SmallVector<v8::Isolate::UseCounterFeature, 8>* use_counts,
|
||||
int* preparse_skipped) {
|
||||
// Move statistics to Isolate.
|
||||
|
||||
@@ -163,13 +163,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
|
||||
Scope::DeserializationMode::kScopesOnly);
|
||||
|
||||
// Move statistics to Isolate
|
||||
void UpdateStatistics(Isolate* isolate, Handle<Script> script);
|
||||
void UpdateStatistics(Isolate* isolate, DirectHandle<Script> script);
|
||||
void UpdateStatistics(
|
||||
Handle<Script> script,
|
||||
DirectHandle<Script> script,
|
||||
base::SmallVector<v8::Isolate::UseCounterFeature, 8>* use_counters,
|
||||
int* preparse_skipped);
|
||||
template <typename IsolateT>
|
||||
void HandleSourceURLComments(IsolateT* isolate, Handle<Script> script);
|
||||
void HandleSourceURLComments(IsolateT* isolate, DirectHandle<Script> script);
|
||||
|
||||
private:
|
||||
friend class ParserBase<Parser>;
|
||||
@@ -221,12 +221,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
|
||||
void PrepareGeneratorVariables();
|
||||
|
||||
// Sets the literal on |info| if parsing succeeded.
|
||||
void ParseProgram(Isolate* isolate, Handle<Script> script, ParseInfo* info,
|
||||
void ParseProgram(Isolate* isolate, DirectHandle<Script> script,
|
||||
ParseInfo* info,
|
||||
MaybeHandle<ScopeInfo> maybe_outer_scope_info);
|
||||
|
||||
// Sets the literal on |info| if parsing succeeded.
|
||||
void ParseFunction(Isolate* isolate, ParseInfo* info,
|
||||
Handle<SharedFunctionInfo> shared_info);
|
||||
DirectHandle<SharedFunctionInfo> shared_info);
|
||||
|
||||
template <typename IsolateT>
|
||||
void PostProcessParseResult(IsolateT* isolate, ParseInfo* info,
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace parsing {
|
||||
|
||||
namespace {
|
||||
|
||||
void MaybeReportStatistics(ParseInfo* info, Handle<Script> script,
|
||||
void MaybeReportStatistics(ParseInfo* info, DirectHandle<Script> script,
|
||||
Isolate* isolate, Parser* parser,
|
||||
ReportStatisticsMode mode) {
|
||||
switch (mode) {
|
||||
|
||||
@@ -147,9 +147,9 @@ void PendingCompilationErrorHandler::ReportWarnings(
|
||||
|
||||
for (const MessageDetails& warning : warning_messages_) {
|
||||
MessageLocation location = warning.GetLocation(script);
|
||||
Handle<String> argument = warning.ArgString(isolate, 0);
|
||||
DirectHandle<String> argument = warning.ArgString(isolate, 0);
|
||||
DCHECK_LT(warning.ArgCount(), 2); // Arg1 is only used for errors.
|
||||
Handle<JSMessageObject> message =
|
||||
DirectHandle<JSMessageObject> message =
|
||||
MessageHandler::MakeMessageObject(isolate, warning.message(), &location,
|
||||
argument, Handle<FixedArray>::null());
|
||||
message->set_error_level(v8::Isolate::kMessageWarning);
|
||||
|
||||
@@ -457,7 +457,7 @@ Handle<PreparseData> PreparseDataBuilder::Serialize(Isolate* isolate) {
|
||||
DCHECK(finalized_children_);
|
||||
for (const auto& builder : children_) {
|
||||
if (!builder->HasData()) continue;
|
||||
Handle<PreparseData> child_data = builder->Serialize(isolate);
|
||||
DirectHandle<PreparseData> child_data = builder->Serialize(isolate);
|
||||
data->set_child(i++, *child_data);
|
||||
}
|
||||
DCHECK_EQ(i, data->children_length());
|
||||
@@ -473,7 +473,7 @@ Handle<PreparseData> PreparseDataBuilder::Serialize(LocalIsolate* isolate) {
|
||||
DCHECK(finalized_children_);
|
||||
for (const auto& builder : children_) {
|
||||
if (!builder->HasData()) continue;
|
||||
Handle<PreparseData> child_data = builder->Serialize(isolate);
|
||||
DirectHandle<PreparseData> child_data = builder->Serialize(isolate);
|
||||
data->set_child(i++, *child_data);
|
||||
}
|
||||
DCHECK_EQ(i, data->children_length());
|
||||
@@ -799,7 +799,7 @@ Handle<PreparseData> ZonePreparseData::Serialize(Isolate* isolate) {
|
||||
for (int i = 0; i < child_data_length; i++) {
|
||||
ZonePreparseData* child = get_child(i);
|
||||
DCHECK_NOT_NULL(child);
|
||||
Handle<PreparseData> child_data = child->Serialize(isolate);
|
||||
DirectHandle<PreparseData> child_data = child->Serialize(isolate);
|
||||
result->set_child(i, *child_data);
|
||||
}
|
||||
return result;
|
||||
@@ -815,7 +815,7 @@ Handle<PreparseData> ZonePreparseData::Serialize(LocalIsolate* isolate) {
|
||||
for (int i = 0; i < child_data_length; i++) {
|
||||
ZonePreparseData* child = get_child(i);
|
||||
DCHECK_NOT_NULL(child);
|
||||
Handle<PreparseData> child_data = child->Serialize(isolate);
|
||||
DirectHandle<PreparseData> child_data = child->Serialize(isolate);
|
||||
result->set_child(i, *child_data);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -224,7 +224,7 @@ HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
|
||||
return snapshots_.at(index).get();
|
||||
}
|
||||
|
||||
SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Object> obj) {
|
||||
SnapshotObjectId HeapProfiler::GetSnapshotObjectId(DirectHandle<Object> obj) {
|
||||
if (!IsHeapObject(*obj)) return v8::HeapProfiler::kUnknownObjectId;
|
||||
return ids_->FindEntry(HeapObject::cast(*obj).address());
|
||||
}
|
||||
@@ -292,7 +292,7 @@ Heap* HeapProfiler::heap() const { return ids_->heap(); }
|
||||
|
||||
Isolate* HeapProfiler::isolate() const { return heap()->isolate(); }
|
||||
|
||||
void HeapProfiler::QueryObjects(Handle<Context> context,
|
||||
void HeapProfiler::QueryObjects(DirectHandle<Context> context,
|
||||
v8::QueryObjectPredicate* predicate,
|
||||
std::vector<v8::Global<v8::Object>>* objects) {
|
||||
// We need a stack marker here to allow deterministic passes over the stack.
|
||||
|
||||
@@ -86,7 +86,7 @@ class HeapProfiler : public HeapObjectAllocationTracker {
|
||||
int GetSnapshotsCount() const;
|
||||
bool IsTakingSnapshot() const;
|
||||
HeapSnapshot* GetSnapshot(int index);
|
||||
SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
|
||||
SnapshotObjectId GetSnapshotObjectId(DirectHandle<Object> obj);
|
||||
SnapshotObjectId GetSnapshotObjectId(NativeObject obj);
|
||||
void DeleteAllSnapshots();
|
||||
void RemoveSnapshot(HeapSnapshot* snapshot);
|
||||
@@ -122,7 +122,8 @@ class HeapProfiler : public HeapObjectAllocationTracker {
|
||||
|
||||
Isolate* isolate() const;
|
||||
|
||||
void QueryObjects(Handle<Context> context, QueryObjectPredicate* predicate,
|
||||
void QueryObjects(DirectHandle<Context> context,
|
||||
QueryObjectPredicate* predicate,
|
||||
std::vector<v8::Global<v8::Object>>* objects);
|
||||
void set_native_move_listener(
|
||||
std::unique_ptr<HeapProfilerNativeMoveListener> listener) {
|
||||
|
||||
@@ -120,8 +120,8 @@ void ProfilerListener::CodeCreateEvent(CodeTag tag,
|
||||
cached_inline_entries;
|
||||
bool is_shared_cross_origin = false;
|
||||
if (IsScript(shared->script(cage_base), cage_base)) {
|
||||
Handle<Script> script =
|
||||
handle(Script::cast(shared->script(cage_base)), isolate_);
|
||||
DirectHandle<Script> script(Script::cast(shared->script(cage_base)),
|
||||
isolate_);
|
||||
line_table.reset(new SourcePositionTable());
|
||||
|
||||
is_shared_cross_origin = script->origin_options().IsSharedCrossOrigin();
|
||||
@@ -392,7 +392,7 @@ const char* ProfilerListener::GetFunctionName(
|
||||
}
|
||||
}
|
||||
|
||||
void ProfilerListener::AttachDeoptInlinedFrames(Handle<Code> code,
|
||||
void ProfilerListener::AttachDeoptInlinedFrames(DirectHandle<Code> code,
|
||||
CodeDeoptEventRecord* rec) {
|
||||
int deopt_id = rec->deopt_id;
|
||||
SourcePosition last_position = SourcePosition::Unknown();
|
||||
|
||||
@@ -96,7 +96,8 @@ class V8_EXPORT_PRIVATE ProfilerListener : public LogEventListener,
|
||||
private:
|
||||
const char* GetFunctionName(Tagged<SharedFunctionInfo>);
|
||||
|
||||
void AttachDeoptInlinedFrames(Handle<Code> code, CodeDeoptEventRecord* rec);
|
||||
void AttachDeoptInlinedFrames(DirectHandle<Code> code,
|
||||
CodeDeoptEventRecord* rec);
|
||||
Tagged<Name> InferScriptName(Tagged<Name> name,
|
||||
Tagged<SharedFunctionInfo> info);
|
||||
V8_INLINE void DispatchCodeEvent(const CodeEventsContainer& evt_rec) {
|
||||
|
||||
@@ -23,7 +23,8 @@ void Untrack(CodeEntry* entry) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void WeakCodeRegistry::Track(CodeEntry* entry, Handle<AbstractCode> code) {
|
||||
void WeakCodeRegistry::Track(CodeEntry* entry,
|
||||
DirectHandle<AbstractCode> code) {
|
||||
DCHECK(!*entry->heap_object_location_address());
|
||||
DisallowGarbageCollection no_gc;
|
||||
Handle<AbstractCode> handle = isolate_->global_handles()->Create(*code);
|
||||
|
||||
@@ -23,7 +23,7 @@ class V8_EXPORT_PRIVATE WeakCodeRegistry {
|
||||
explicit WeakCodeRegistry(Isolate* isolate) : isolate_(isolate) {}
|
||||
~WeakCodeRegistry() { Clear(); }
|
||||
|
||||
void Track(CodeEntry* entry, Handle<AbstractCode> code);
|
||||
void Track(CodeEntry* entry, DirectHandle<AbstractCode> code);
|
||||
|
||||
// Removes all dead code objects from the registry, invoking the provided
|
||||
// listener for each new CodeEntry that is no longer referenced on the heap
|
||||
|
||||
Reference in new issue
Block a user