Skip to content

Commit 9087056

Browse files
targosnodejs-github-bot
authored andcommitted
deps: patch V8 to 12.8.374.31
Refs: v8/v8@12.8.374.22...12.8.374.31 PR-URL: #54682 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6bce6f6 commit 9087056

File tree

86 files changed

+673
-774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+673
-774
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 12
1212
#define V8_MINOR_VERSION 8
1313
#define V8_BUILD_NUMBER 374
14-
#define V8_PATCH_LEVEL 22
14+
#define V8_PATCH_LEVEL 31
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/ast/ast-function-literal-id-reindexer.cc

-7
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ void AstFunctionLiteralIdReindexer::VisitFunctionLiteral(FunctionLiteral* lit) {
3131
lit->set_function_literal_id(lit->function_literal_id() + delta_);
3232
}
3333

34-
void AstFunctionLiteralIdReindexer::VisitCall(Call* expr) {
35-
AstTraversalVisitor::VisitCall(expr);
36-
if (expr->is_possibly_eval()) {
37-
expr->adjust_eval_scope_info_index(delta_);
38-
}
39-
}
40-
4134
void AstFunctionLiteralIdReindexer::VisitClassLiteral(ClassLiteral* expr) {
4235
// Manually visit the class literal so that we can change the property walk.
4336
// This should be kept in-sync with AstTraversalVisitor::VisitClassLiteral.

deps/v8/src/ast/ast-function-literal-id-reindexer.h

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class AstFunctionLiteralIdReindexer final
3030
// AstTraversalVisitor implementation.
3131
void VisitFunctionLiteral(FunctionLiteral* lit);
3232
void VisitClassLiteral(ClassLiteral* lit);
33-
void VisitCall(Call* lit);
3433

3534
private:
3635
int delta_;

deps/v8/src/ast/ast.h

+20-23
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ class CallBase : public Expression {
17311731
class Call final : public CallBase {
17321732
public:
17331733
bool is_possibly_eval() const {
1734-
return EvalScopeInfoIndexField::decode(bit_field_) > 0;
1734+
return IsPossiblyEvalField::decode(bit_field_);
17351735
}
17361736

17371737
bool is_tagged_template() const {
@@ -1742,15 +1742,6 @@ class Call final : public CallBase {
17421742
return IsOptionalChainLinkField::decode(bit_field_);
17431743
}
17441744

1745-
uint32_t eval_scope_info_index() const {
1746-
return EvalScopeInfoIndexField::decode(bit_field_);
1747-
}
1748-
1749-
void adjust_eval_scope_info_index(int delta) {
1750-
bit_field_ = EvalScopeInfoIndexField::update(
1751-
bit_field_, eval_scope_info_index() + delta);
1752-
}
1753-
17541745
enum CallType {
17551746
GLOBAL_CALL,
17561747
WITH_CALL,
@@ -1766,6 +1757,11 @@ class Call final : public CallBase {
17661757
OTHER_CALL,
17671758
};
17681759

1760+
enum PossiblyEval {
1761+
IS_POSSIBLY_EVAL,
1762+
NOT_EVAL,
1763+
};
1764+
17691765
// Helpers to determine how to handle the call.
17701766
CallType GetCallType() const;
17711767

@@ -1777,26 +1773,26 @@ class Call final : public CallBase {
17771773

17781774
Call(Zone* zone, Expression* expression,
17791775
const ScopedPtrList<Expression>& arguments, int pos, bool has_spread,
1780-
int eval_scope_info_index, bool optional_chain)
1776+
PossiblyEval possibly_eval, bool optional_chain)
17811777
: CallBase(zone, kCall, expression, arguments, pos, has_spread) {
1782-
bit_field_ |= IsTaggedTemplateField::encode(false) |
1783-
IsOptionalChainLinkField::encode(optional_chain) |
1784-
EvalScopeInfoIndexField::encode(eval_scope_info_index);
1785-
DCHECK_EQ(eval_scope_info_index > 0, is_possibly_eval());
1778+
bit_field_ |=
1779+
IsPossiblyEvalField::encode(possibly_eval == IS_POSSIBLY_EVAL) |
1780+
IsTaggedTemplateField::encode(false) |
1781+
IsOptionalChainLinkField::encode(optional_chain);
17861782
}
17871783

17881784
Call(Zone* zone, Expression* expression,
17891785
const ScopedPtrList<Expression>& arguments, int pos,
17901786
TaggedTemplateTag tag)
17911787
: CallBase(zone, kCall, expression, arguments, pos, false) {
1792-
bit_field_ |= IsTaggedTemplateField::encode(true) |
1793-
IsOptionalChainLinkField::encode(false) |
1794-
EvalScopeInfoIndexField::encode(0);
1788+
bit_field_ |= IsPossiblyEvalField::encode(false) |
1789+
IsTaggedTemplateField::encode(true) |
1790+
IsOptionalChainLinkField::encode(false);
17951791
}
17961792

1797-
using IsTaggedTemplateField = CallBase::NextBitField<bool, 1>;
1793+
using IsPossiblyEvalField = CallBase::NextBitField<bool, 1>;
1794+
using IsTaggedTemplateField = IsPossiblyEvalField::Next<bool, 1>;
17981795
using IsOptionalChainLinkField = IsTaggedTemplateField::Next<bool, 1>;
1799-
using EvalScopeInfoIndexField = IsOptionalChainLinkField::Next<uint32_t, 20>;
18001796
};
18011797

18021798
class CallNew final : public CallBase {
@@ -3188,11 +3184,12 @@ class AstNodeFactory final {
31883184

31893185
Call* NewCall(Expression* expression,
31903186
const ScopedPtrList<Expression>& arguments, int pos,
3191-
bool has_spread, int eval_scope_info_index = 0,
3187+
bool has_spread,
3188+
Call::PossiblyEval possibly_eval = Call::NOT_EVAL,
31923189
bool optional_chain = false) {
3193-
DCHECK_IMPLIES(eval_scope_info_index > 0, !optional_chain);
3190+
DCHECK_IMPLIES(possibly_eval == Call::IS_POSSIBLY_EVAL, !optional_chain);
31943191
return zone_->New<Call>(zone_, expression, arguments, pos, has_spread,
3195-
eval_scope_info_index, optional_chain);
3192+
possibly_eval, optional_chain);
31963193
}
31973194

31983195
SuperCallForwardArgs* NewSuperCallForwardArgs(SuperCallReference* expression,

deps/v8/src/ast/scopes.cc

+13-104
Original file line numberDiff line numberDiff line change
@@ -2607,23 +2607,6 @@ void ModuleScope::AllocateModuleVariables() {
26072607
}
26082608
}
26092609

2610-
// Needs to be kept in sync with ScopeInfo::UniqueIdInScript.
2611-
int Scope::UniqueIdInScript() const {
2612-
// Script scopes start "before" the script to avoid clashing with a scope that
2613-
// starts on character 0.
2614-
if (is_script_scope() || scope_type() == EVAL_SCOPE ||
2615-
scope_type() == MODULE_SCOPE) {
2616-
return -1;
2617-
}
2618-
if (is_declaration_scope()) {
2619-
// Default constructors have the same start position as their parent class
2620-
// scope. Use the next char position to distinguish this scope.
2621-
return start_position() +
2622-
IsDefaultConstructor(AsDeclarationScope()->function_kind());
2623-
}
2624-
return start_position();
2625-
}
2626-
26272610
void Scope::AllocateVariablesRecursively() {
26282611
this->ForEach([](Scope* scope) -> Iteration {
26292612
DCHECK(!scope->already_resolved_);
@@ -2675,63 +2658,33 @@ void Scope::AllocateVariablesRecursively() {
26752658
}
26762659

26772660
template <typename IsolateT>
2678-
void Scope::AllocateScopeInfosRecursively(
2679-
IsolateT* isolate, MaybeHandle<ScopeInfo> outer_scope,
2680-
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse) {
2661+
void Scope::AllocateScopeInfosRecursively(IsolateT* isolate,
2662+
MaybeHandle<ScopeInfo> outer_scope) {
26812663
DCHECK(scope_info_.is_null());
26822664
MaybeHandle<ScopeInfo> next_outer_scope = outer_scope;
26832665

2684-
auto it = scope_infos_to_reuse.find(UniqueIdInScript());
2685-
if (it != scope_infos_to_reuse.end()) {
2686-
scope_info_ = it->second;
2687-
CHECK(NeedsContext());
2688-
// The ScopeInfo chain mirrors the context chain, so we only link to the
2689-
// next outer scope that needs a context.
2690-
next_outer_scope = scope_info_;
2691-
DCHECK(!scope_info_.is_null());
2692-
DCHECK(!is_hidden_catch_scope());
2693-
CHECK_EQ(scope_info_->scope_type(), scope_type_);
2694-
CHECK_EQ(scope_info_->ContextLength(), num_heap_slots_);
2695-
#ifdef DEBUG
2696-
// Consume the scope info.
2697-
it->second = {};
2698-
#endif
2699-
} else if (NeedsScopeInfo()) {
2700-
#ifdef DEBUG
2701-
// Mark this ID as being used. Skip hidden scopes because they are
2702-
// synthetic, unreusable, but hard to make unique.
2703-
if (v8_flags.reuse_scope_infos && !is_hidden_catch_scope()) {
2704-
scope_infos_to_reuse[UniqueIdInScript()] = {};
2705-
}
2706-
#endif
2666+
if (NeedsScopeInfo()) {
27072667
scope_info_ = ScopeInfo::Create(isolate, zone(), this, outer_scope);
2708-
DCHECK_EQ(UniqueIdInScript(), scope_info_->UniqueIdInScript());
2709-
// The ScopeInfo chain mirrors the context chain, so we only link to the
2710-
// next outer scope that needs a context.
2668+
// The ScopeInfo chain should mirror the context chain, so we only link to
2669+
// the next outer scope that needs a context.
27112670
if (NeedsContext()) next_outer_scope = scope_info_;
27122671
}
27132672

27142673
// Allocate ScopeInfos for inner scopes.
27152674
for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) {
2716-
DCHECK_GT(scope->UniqueIdInScript(), UniqueIdInScript());
2717-
DCHECK_IMPLIES(scope->sibling_, scope->sibling_->UniqueIdInScript() !=
2718-
scope->UniqueIdInScript());
27192675
if (!scope->is_function_scope() ||
27202676
scope->AsDeclarationScope()->ShouldEagerCompile()) {
2721-
scope->AllocateScopeInfosRecursively(isolate, next_outer_scope,
2722-
scope_infos_to_reuse);
2677+
scope->AllocateScopeInfosRecursively(isolate, next_outer_scope);
27232678
}
27242679
}
27252680
}
27262681

27272682
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
2728-
AllocateScopeInfosRecursively<Isolate>(
2729-
Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope,
2730-
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
2683+
AllocateScopeInfosRecursively<Isolate>(Isolate* isolate,
2684+
MaybeHandle<ScopeInfo> outer_scope);
27312685
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void Scope::
27322686
AllocateScopeInfosRecursively<LocalIsolate>(
2733-
LocalIsolate* isolate, MaybeHandle<ScopeInfo> outer_scope,
2734-
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
2687+
LocalIsolate* isolate, MaybeHandle<ScopeInfo> outer_scope);
27352688

27362689
void DeclarationScope::RecalcPrivateNameContextChain() {
27372690
// The outermost scope in a class heritage expression is marked to skip the
@@ -2776,9 +2729,7 @@ void DeclarationScope::RecordNeedsPrivateNameContextChainRecalc() {
27762729

27772730
// static
27782731
template <typename IsolateT>
2779-
void DeclarationScope::AllocateScopeInfos(ParseInfo* info,
2780-
Handle<Script> script,
2781-
IsolateT* isolate) {
2732+
void DeclarationScope::AllocateScopeInfos(ParseInfo* info, IsolateT* isolate) {
27822733
DeclarationScope* scope = info->literal()->scope();
27832734

27842735
// No one else should have allocated a scope info for this scope yet.
@@ -2793,49 +2744,7 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info,
27932744
if (scope->needs_private_name_context_chain_recalc()) {
27942745
scope->RecalcPrivateNameContextChain();
27952746
}
2796-
2797-
Tagged<WeakFixedArray> infos = script->infos();
2798-
std::unordered_map<int, Handle<ScopeInfo>> scope_infos_to_reuse;
2799-
if (v8_flags.reuse_scope_infos && infos->length() != 0) {
2800-
Tagged<SharedFunctionInfo> sfi = *info->literal()->shared_function_info();
2801-
Tagged<ScopeInfo> outer = sfi->HasOuterScopeInfo()
2802-
? sfi->GetOuterScopeInfo()
2803-
: Tagged<ScopeInfo>();
2804-
// Look at all the existing inner functions (they are numbered id+1 until
2805-
// max_id+1) to reattach their outer scope infos to corresponding scopes.
2806-
for (int i = info->literal()->function_literal_id() + 1;
2807-
i < info->max_info_id() + 1; ++i) {
2808-
Tagged<MaybeObject> maybe_info = infos->get(i);
2809-
if (maybe_info.IsWeak()) {
2810-
Tagged<Object> info = maybe_info.GetHeapObjectAssumeWeak();
2811-
Tagged<ScopeInfo> scope_info;
2812-
if (Is<SharedFunctionInfo>(info)) {
2813-
Tagged<SharedFunctionInfo> sfi = Cast<SharedFunctionInfo>(info);
2814-
// Reuse outer scope infos. Don't look at sfi->scope_info() because
2815-
// that might be empty if the sfi isn't compiled yet.
2816-
if (!sfi->HasOuterScopeInfo()) continue;
2817-
scope_info = sfi->GetOuterScopeInfo();
2818-
} else {
2819-
scope_info = Cast<ScopeInfo>(info);
2820-
}
2821-
while (true) {
2822-
if (scope_info == outer) break;
2823-
int id = scope_info->UniqueIdInScript();
2824-
auto it = scope_infos_to_reuse.find(id);
2825-
if (it != scope_infos_to_reuse.end()) {
2826-
CHECK_EQ(*it->second, scope_info);
2827-
break;
2828-
}
2829-
scope_infos_to_reuse[id] = handle(scope_info, isolate);
2830-
if (!scope_info->HasOuterScopeInfo()) break;
2831-
scope_info = scope_info->OuterScopeInfo();
2832-
}
2833-
}
2834-
}
2835-
}
2836-
2837-
scope->AllocateScopeInfosRecursively(isolate, outer_scope,
2838-
scope_infos_to_reuse);
2747+
scope->AllocateScopeInfosRecursively(isolate, outer_scope);
28392748

28402749
// The debugger expects all shared function infos to contain a scope info.
28412750
// Since the top-most scope will end up in a shared function info, make sure
@@ -2854,9 +2763,9 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info,
28542763
}
28552764

28562765
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos(
2857-
ParseInfo* info, Handle<Script> script, Isolate* isolate);
2766+
ParseInfo* info, Isolate* isolate);
28582767
template V8_EXPORT_PRIVATE void DeclarationScope::AllocateScopeInfos(
2859-
ParseInfo* info, Handle<Script> script, LocalIsolate* isolate);
2768+
ParseInfo* info, LocalIsolate* isolate);
28602769

28612770
int Scope::ContextLocalCount() const {
28622771
if (num_heap_slots() == 0) return 0;

deps/v8/src/ast/scopes.h

+9-13
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
101101
}
102102
#endif
103103

104-
// An ID that uniquely identifies this scope within the script. Inner scopes
105-
// have a higher ID than their outer scopes. ScopeInfo created from a scope
106-
// has the same ID as the scope.
107-
int UniqueIdInScript() const;
108-
109104
DeclarationScope* AsDeclarationScope();
110105
const DeclarationScope* AsDeclarationScope() const;
111106
ModuleScope* AsModuleScope();
@@ -339,10 +334,6 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
339334
bool is_hidden() const { return is_hidden_; }
340335
void set_is_hidden() { is_hidden_ = true; }
341336

342-
bool is_hidden_catch_scope() const {
343-
return is_hidden() && scope_type() == CATCH_SCOPE;
344-
}
345-
346337
void ForceContextAllocationForParameters() {
347338
DCHECK(!already_resolved_);
348339
force_context_allocation_for_parameters_ = true;
@@ -728,9 +719,11 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
728719
void AllocateVariablesRecursively();
729720

730721
template <typename IsolateT>
731-
void AllocateScopeInfosRecursively(
732-
IsolateT* isolate, MaybeHandle<ScopeInfo> outer_scope,
733-
std::unordered_map<int, Handle<ScopeInfo>>& scope_infos_to_reuse);
722+
void AllocateScopeInfosRecursively(IsolateT* isolate,
723+
MaybeHandle<ScopeInfo> outer_scope);
724+
725+
void AllocateDebuggerScopeInfos(Isolate* isolate,
726+
MaybeHandle<ScopeInfo> outer_scope);
734727

735728
// Construct a scope based on the scope info.
736729
Scope(Zone* zone, ScopeType type, AstValueFactory* ast_value_factory,
@@ -830,6 +823,10 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
830823

831824
bool must_use_preparsed_scope_data_ : 1;
832825

826+
// True if this is a script scope that originated from
827+
// DebugEvaluate::GlobalREPL().
828+
bool is_repl_mode_scope_ : 1;
829+
833830
// True if this is a deserialized scope which caches its lookups on another
834831
// Scope's variable map. This will be true for every scope above the first
835832
// non-eval declaration scope above the compilation entry point, e.g. for
@@ -1164,7 +1161,6 @@ class V8_EXPORT_PRIVATE DeclarationScope : public Scope {
11641161
// Does nothing if ScopeInfo is already allocated.
11651162
template <typename IsolateT>
11661163
V8_EXPORT_PRIVATE static void AllocateScopeInfos(ParseInfo* info,
1167-
Handle<Script> script,
11681164
IsolateT* isolate);
11691165

11701166
// Determine if we can use lazy compilation for this scope.

deps/v8/src/builtins/builtins-function.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ MaybeHandle<Object> CreateDynamicFunction(Isolate* isolate,
8484
// come from here.
8585
Handle<JSFunction> function;
8686
{
87-
ASSIGN_RETURN_ON_EXCEPTION(isolate, function,
88-
Compiler::GetFunctionFromString(
89-
handle(target->native_context(), isolate),
90-
source, parameters_end_pos, is_code_like));
87+
ASSIGN_RETURN_ON_EXCEPTION(
88+
isolate, function,
89+
Compiler::GetFunctionFromString(
90+
handle(target->native_context(), isolate), source,
91+
ONLY_SINGLE_FUNCTION_LITERAL, parameters_end_pos, is_code_like));
9192
Handle<Object> result;
9293
ASSIGN_RETURN_ON_EXCEPTION(
9394
isolate, result,

deps/v8/src/codegen/background-merge-task.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class V8_EXPORT_PRIVATE BackgroundMergeTask {
7373
// SharedFunctionInfo in the cached script. The main thread must:
7474
// 1. Check whether the cached script gained corresponding SharedFunctionInfos
7575
// for any of these, and if so, redo the merge.
76-
// 2. Update the cached script's infos list to refer to these.
76+
// 2. Update the cached script's shared_function_infos list to refer to these.
7777
std::vector<Handle<SharedFunctionInfo>> used_new_sfis_;
7878

7979
// SharedFunctionInfos from the cached script which were not compiled, with

0 commit comments

Comments
 (0)