[GetIsolate] Remove 1-arg handles around ScriptIterator
Change the ScriptIterator to: a) construct its script list handle using the given isolate, and b) take the Script (which it doesn't store) by pointer instead of by Handle, to avoid callers needing to allocate a handle. Bug: v8:7786 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I72c1ee13f1b72fe962f4b1bccba69ae4e97088a7 Reviewed-on: https://chromium-review.googlesource.com/1113316 Reviewed-by: Dan Elphick <delphick@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#54018}
This commit is contained in:
parent
82535f12c7
commit
733b15744f
@ -9592,7 +9592,8 @@ void debug::ResetBlackboxedStateCache(Isolate* v8_isolate,
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
i::DisallowHeapAllocation no_gc;
|
||||
i::SharedFunctionInfo::ScriptIterator iter(Utils::OpenHandle(*script));
|
||||
i::SharedFunctionInfo::ScriptIterator iter(isolate,
|
||||
*Utils::OpenHandle(*script));
|
||||
while (i::SharedFunctionInfo* info = iter.Next()) {
|
||||
info->set_computed_debug_is_blackboxed(false);
|
||||
}
|
||||
|
@ -1786,7 +1786,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
|
||||
if (maybe_result.is_null()) isolate->ReportPendingMessages();
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, top_level, maybe_result, JSFunction);
|
||||
|
||||
SharedFunctionInfo::ScriptIterator infos(script);
|
||||
SharedFunctionInfo::ScriptIterator infos(isolate, *script);
|
||||
while (SharedFunctionInfo* info = infos.Next()) {
|
||||
if (info->is_wrapped()) {
|
||||
wrapped = Handle<SharedFunctionInfo>(info, isolate);
|
||||
|
@ -505,7 +505,7 @@ std::unique_ptr<Coverage> Coverage::Collect(
|
||||
|
||||
{
|
||||
// Sort functions by start position, from outer to inner functions.
|
||||
SharedFunctionInfo::ScriptIterator infos(script_handle);
|
||||
SharedFunctionInfo::ScriptIterator infos(isolate, *script_handle);
|
||||
while (SharedFunctionInfo* info = infos.Next()) {
|
||||
sorted.push_back(info);
|
||||
}
|
||||
|
@ -1371,7 +1371,7 @@ bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position,
|
||||
while (true) {
|
||||
HandleScope scope(isolate_);
|
||||
std::vector<Handle<SharedFunctionInfo>> candidates;
|
||||
SharedFunctionInfo::ScriptIterator iterator(script);
|
||||
SharedFunctionInfo::ScriptIterator iterator(isolate_, *script);
|
||||
for (SharedFunctionInfo* info = iterator.Next(); info != nullptr;
|
||||
info = iterator.Next()) {
|
||||
if (info->EndPosition() < start_position ||
|
||||
@ -1478,7 +1478,7 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
|
||||
SharedFunctionInfo* shared;
|
||||
{
|
||||
SharedFunctionInfoFinder finder(position);
|
||||
SharedFunctionInfo::ScriptIterator iterator(script);
|
||||
SharedFunctionInfo::ScriptIterator iterator(isolate_, *script);
|
||||
for (SharedFunctionInfo* info = iterator.Next(); info != nullptr;
|
||||
info = iterator.Next()) {
|
||||
finder.NewCandidate(info);
|
||||
|
@ -13364,7 +13364,7 @@ bool Script::IsUserJavaScript() { return type() == Script::TYPE_NORMAL; }
|
||||
|
||||
bool Script::ContainsAsmModule() {
|
||||
DisallowHeapAllocation no_gc;
|
||||
SharedFunctionInfo::ScriptIterator iter(Handle<Script>(this));
|
||||
SharedFunctionInfo::ScriptIterator iter(this->GetIsolate(), this);
|
||||
while (SharedFunctionInfo* info = iter.Next()) {
|
||||
if (info->HasAsmWasmData()) return true;
|
||||
}
|
||||
@ -13561,10 +13561,10 @@ Script::Iterator::Iterator(Isolate* isolate)
|
||||
|
||||
Script* Script::Iterator::Next() { return iterator_.Next<Script>(); }
|
||||
|
||||
|
||||
SharedFunctionInfo::ScriptIterator::ScriptIterator(Handle<Script> script)
|
||||
: ScriptIterator(script->GetIsolate(),
|
||||
handle(script->shared_function_infos())) {}
|
||||
SharedFunctionInfo::ScriptIterator::ScriptIterator(Isolate* isolate,
|
||||
Script* script)
|
||||
: ScriptIterator(isolate,
|
||||
handle(script->shared_function_infos(), isolate)) {}
|
||||
|
||||
SharedFunctionInfo::ScriptIterator::ScriptIterator(
|
||||
Isolate* isolate, Handle<WeakFixedArray> shared_function_infos)
|
||||
@ -13585,7 +13585,7 @@ SharedFunctionInfo* SharedFunctionInfo::ScriptIterator::Next() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SharedFunctionInfo::ScriptIterator::Reset(Handle<Script> script) {
|
||||
void SharedFunctionInfo::ScriptIterator::Reset(Script* script) {
|
||||
shared_function_infos_ = handle(script->shared_function_infos(), isolate_);
|
||||
index_ = 0;
|
||||
}
|
||||
@ -13593,7 +13593,7 @@ void SharedFunctionInfo::ScriptIterator::Reset(Handle<Script> script) {
|
||||
SharedFunctionInfo::GlobalIterator::GlobalIterator(Isolate* isolate)
|
||||
: script_iterator_(isolate),
|
||||
noscript_sfi_iterator_(isolate->heap()->noscript_shared_function_infos()),
|
||||
sfi_iterator_(handle(script_iterator_.Next(), isolate)) {}
|
||||
sfi_iterator_(isolate, script_iterator_.Next()) {}
|
||||
|
||||
SharedFunctionInfo* SharedFunctionInfo::GlobalIterator::Next() {
|
||||
SharedFunctionInfo* next = noscript_sfi_iterator_.Next<SharedFunctionInfo>();
|
||||
@ -13603,7 +13603,7 @@ SharedFunctionInfo* SharedFunctionInfo::GlobalIterator::Next() {
|
||||
if (next != nullptr) return next;
|
||||
Script* next_script = script_iterator_.Next();
|
||||
if (next_script == nullptr) return nullptr;
|
||||
sfi_iterator_.Reset(handle(next_script, next_script->GetIsolate()));
|
||||
sfi_iterator_.Reset(next_script);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,13 +435,13 @@ class SharedFunctionInfo : public HeapObject {
|
||||
// Iterate over all shared function infos in a given script.
|
||||
class ScriptIterator {
|
||||
public:
|
||||
explicit ScriptIterator(Handle<Script> script);
|
||||
ScriptIterator(Isolate* isolate, Script* script);
|
||||
ScriptIterator(Isolate* isolate,
|
||||
Handle<WeakFixedArray> shared_function_infos);
|
||||
SharedFunctionInfo* Next();
|
||||
|
||||
// Reset the iterator to run on |script|.
|
||||
void Reset(Handle<Script> script);
|
||||
void Reset(Script* script);
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
|
@ -30,9 +30,8 @@ void GetTopLevelFunctionInfo(
|
||||
// Get the v8::internal::Script object from the API v8::Script.
|
||||
// The API object 'wraps' the compiled top-level function, not the i::Script.
|
||||
Handle<JSFunction> toplevel_fn = v8::Utils::OpenHandle(*script);
|
||||
Handle<Script> i_script = handle(
|
||||
Script::cast(toplevel_fn->shared()->script()), toplevel_fn->GetIsolate());
|
||||
SharedFunctionInfo::ScriptIterator iterator(i_script);
|
||||
SharedFunctionInfo::ScriptIterator iterator(
|
||||
toplevel_fn->GetIsolate(), Script::cast(toplevel_fn->shared()->script()));
|
||||
|
||||
while (SharedFunctionInfo* shared = iterator.Next()) {
|
||||
std::unique_ptr<char[]> name = String::cast(shared->Name())->ToCString();
|
||||
|
@ -2018,8 +2018,8 @@ v8::ScriptCompiler::CachedData* CompileRunAndProduceCache(
|
||||
|
||||
void CheckDeserializedFlag(v8::Local<v8::UnboundScript> script) {
|
||||
i::Handle<i::SharedFunctionInfo> sfi = v8::Utils::OpenHandle(*script);
|
||||
i::Handle<i::Script> i_script(Script::cast(sfi->script()));
|
||||
i::SharedFunctionInfo::ScriptIterator iterator(i_script);
|
||||
i::SharedFunctionInfo::ScriptIterator iterator(sfi->GetIsolate(),
|
||||
Script::cast(sfi->script()));
|
||||
while (SharedFunctionInfo* next = iterator.Next()) {
|
||||
CHECK_EQ(next->is_compiled(), next->deserialized());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user