Commit 2c499ad6 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[runtime] Hoist cage in InlinedLocalNamesLookup

Change-Id: I7cde42eb5c3a2df81950cc622dd9b3fa3f74caa3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3422634
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78832}
parent f9b6964a
......@@ -858,6 +858,12 @@ String ScopeInfo::ContextInlinedLocalName(int var) const {
return context_local_names(var);
}
String ScopeInfo::ContextInlinedLocalName(PtrComprCageBase cage_base,
int var) const {
DCHECK(HasInlinedLocalNames());
return context_local_names(cage_base, var);
}
VariableMode ScopeInfo::ContextLocalMode(int var) const {
int value = context_local_infos(var);
return VariableModeBits::decode(value);
......@@ -928,9 +934,11 @@ int ScopeInfo::ModuleIndex(String name, VariableMode* mode,
}
int ScopeInfo::InlinedLocalNamesLookup(String name) {
DisallowGarbageCollection no_gc;
PtrComprCageBase cage_base = GetPtrComprCageBase(*this);
int local_count = context_local_count();
for (int i = 0; i < local_count; ++i) {
if (name == ContextInlinedLocalName(i)) {
if (name == ContextInlinedLocalName(cage_base, i)) {
return i;
}
}
......
......@@ -158,6 +158,7 @@ class ScopeInfo : public TorqueGeneratedScopeInfo<ScopeInfo, HeapObject> {
// Return the name of a given context local.
// It should only be used if inlined local names.
String ContextInlinedLocalName(int var) const;
String ContextInlinedLocalName(PtrComprCageBase cage_base, int var) const;
// Return the mode of the given context local.
VariableMode ContextLocalMode(int var) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment