Skip to content

Commit e4a51ad

Browse files
Hakerh400BridgeAR
authored andcommitted
deps: patch V8 to 7.7.299.10
Refs: v8/v8@7.7.299.8...7.7.299.10 PR-URL: #29472 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent 13fa966 commit e4a51ad

File tree

7 files changed

+77
-24
lines changed

7 files changed

+77
-24
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 7
1212
#define V8_MINOR_VERSION 7
1313
#define V8_BUILD_NUMBER 299
14-
#define V8_PATCH_LEVEL 8
14+
#define V8_PATCH_LEVEL 10
1515

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

deps/v8/src/builtins/base.tq

+6
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,16 @@ macro NewJSObject(implicit context: Context)(): JSObject {
336336
};
337337
}
338338

339+
extern macro HasPrototypeSlot(JSFunction): bool;
340+
339341
macro GetDerivedMap(implicit context: Context)(
340342
target: JSFunction, newTarget: JSReceiver): Map {
341343
try {
342344
const constructor = Cast<JSFunction>(newTarget) otherwise SlowPath;
345+
if (!HasPrototypeSlot(constructor)) {
346+
goto SlowPath;
347+
}
348+
assert(IsConstructor(constructor));
343349
const map =
344350
Cast<Map>(constructor.prototype_or_initial_map) otherwise SlowPath;
345351
if (LoadConstructorOrBackPointer(map) != target) {

deps/v8/src/codegen/code-stub-assembler.cc

+5
Original file line numberDiff line numberDiff line change
@@ -2622,6 +2622,11 @@ TNode<BoolT> CodeStubAssembler::IsGeneratorFunction(
26222622
Int32Constant(FunctionKind::kConciseGeneratorMethod))));
26232623
}
26242624

2625+
TNode<BoolT> CodeStubAssembler::HasPrototypeSlot(TNode<JSFunction> function) {
2626+
return TNode<BoolT>::UncheckedCast(IsSetWord32<Map::HasPrototypeSlotBit>(
2627+
LoadMapBitField(LoadMap(function))));
2628+
}
2629+
26252630
TNode<BoolT> CodeStubAssembler::HasPrototypeProperty(TNode<JSFunction> function,
26262631
TNode<Map> map) {
26272632
// (has_prototype_slot() && IsConstructor()) ||

deps/v8/src/codegen/code-stub-assembler.h

+1
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
12721272
TNode<Map> LoadJSArrayElementsMap(SloppyTNode<Int32T> kind,
12731273
SloppyTNode<Context> native_context);
12741274

1275+
TNode<BoolT> HasPrototypeSlot(TNode<JSFunction> function);
12751276
TNode<BoolT> IsGeneratorFunction(TNode<JSFunction> function);
12761277
TNode<BoolT> HasPrototypeProperty(TNode<JSFunction> function, TNode<Map> map);
12771278
void GotoIfPrototypeRequiresRuntimeLookup(TNode<JSFunction> function,

deps/v8/src/compiler/js-native-context-specialization.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
10601060
Node* control = NodeProperties::GetControlInput(node);
10611061

10621062
ZoneVector<PropertyAccessInfo> access_infos(zone());
1063-
AccessInfoFactory access_info_factory(broker(), dependencies(), zone());
1063+
AccessInfoFactory access_info_factory(broker(), dependencies(),
1064+
graph()->zone());
10641065
if (!access_info_factory.FinalizePropertyAccessInfos(
10651066
feedback.access_infos(), access_mode, &access_infos)) {
10661067
return NoChange();
@@ -1765,7 +1766,7 @@ Reduction JSNativeContextSpecialization::ReducePropertyAccess(
17651766
if (name.has_value()) {
17661767
ZoneVector<PropertyAccessInfo> access_infos(zone());
17671768
AccessInfoFactory access_info_factory(broker(), dependencies(),
1768-
zone());
1769+
graph()->zone());
17691770
access_info_factory.ComputePropertyAccessInfos(
17701771
receiver_maps, name->object(), access_mode, &access_infos);
17711772
processed = new (zone()) NamedAccessFeedback(*name, access_infos);

deps/v8/src/regexp/regexp-compiler.cc

+52-21
Original file line numberDiff line numberDiff line change
@@ -1970,9 +1970,11 @@ void ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details,
19701970
}
19711971
}
19721972

1973+
namespace {
1974+
19731975
// Check for [0-9A-Z_a-z].
1974-
static void EmitWordCheck(RegExpMacroAssembler* assembler, Label* word,
1975-
Label* non_word, bool fall_through_on_word) {
1976+
void EmitWordCheck(RegExpMacroAssembler* assembler, Label* word,
1977+
Label* non_word, bool fall_through_on_word) {
19761978
if (assembler->CheckSpecialCharacterClass(
19771979
fall_through_on_word ? 'w' : 'W',
19781980
fall_through_on_word ? non_word : word)) {
@@ -1994,24 +1996,37 @@ static void EmitWordCheck(RegExpMacroAssembler* assembler, Label* word,
19941996

19951997
// Emit the code to check for a ^ in multiline mode (1-character lookbehind
19961998
// that matches newline or the start of input).
1997-
static void EmitHat(RegExpCompiler* compiler, RegExpNode* on_success,
1998-
Trace* trace) {
1999+
void EmitHat(RegExpCompiler* compiler, RegExpNode* on_success, Trace* trace) {
19992000
RegExpMacroAssembler* assembler = compiler->macro_assembler();
2000-
// We will be loading the previous character into the current character
2001-
// register.
2001+
2002+
// We will load the previous character into the current character register.
20022003
Trace new_trace(*trace);
20032004
new_trace.InvalidateCurrentCharacter();
20042005

2006+
// A positive (> 0) cp_offset means we've already successfully matched a
2007+
// non-empty-width part of the pattern, and thus cannot be at or before the
2008+
// start of the subject string. We can thus skip both at-start and
2009+
// bounds-checks when loading the one-character lookbehind.
2010+
const bool may_be_at_or_before_subject_string_start =
2011+
new_trace.cp_offset() <= 0;
2012+
20052013
Label ok;
2006-
if (new_trace.cp_offset() == 0) {
2007-
// The start of input counts as a newline in this context, so skip to
2008-
// ok if we are at the start.
2009-
assembler->CheckAtStart(&ok);
2014+
if (may_be_at_or_before_subject_string_start) {
2015+
// The start of input counts as a newline in this context, so skip to ok if
2016+
// we are at the start.
2017+
// TODO(jgruber): It would be less awkward to use CheckAtStart here, but
2018+
// that currently does not support a non-zero cp_offset.
2019+
Label not_at_start;
2020+
assembler->CheckNotAtStart(new_trace.cp_offset(), &not_at_start);
2021+
assembler->GoTo(&ok);
2022+
assembler->Bind(&not_at_start);
20102023
}
2011-
// We already checked that we are not at the start of input so it must be
2012-
// OK to load the previous character.
2024+
2025+
// If we've already checked that we are not at the start of input, it's okay
2026+
// to load the previous character without bounds checks.
2027+
const bool can_skip_bounds_check = !may_be_at_or_before_subject_string_start;
20132028
assembler->LoadCurrentCharacter(new_trace.cp_offset() - 1,
2014-
new_trace.backtrack(), false);
2029+
new_trace.backtrack(), can_skip_bounds_check);
20152030
if (!assembler->CheckSpecialCharacterClass('n', new_trace.backtrack())) {
20162031
// Newline means \n, \r, 0x2028 or 0x2029.
20172032
if (!compiler->one_byte()) {
@@ -2024,6 +2039,8 @@ static void EmitHat(RegExpCompiler* compiler, RegExpNode* on_success,
20242039
on_success->Emit(compiler, &new_trace);
20252040
}
20262041

2042+
} // namespace
2043+
20272044
// Emit the code to handle \b and \B (word-boundary or non-word-boundary).
20282045
void AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) {
20292046
RegExpMacroAssembler* assembler = compiler->macro_assembler();
@@ -2080,21 +2097,35 @@ void AssertionNode::BacktrackIfPrevious(
20802097
Trace new_trace(*trace);
20812098
new_trace.InvalidateCurrentCharacter();
20822099

2083-
Label fall_through, dummy;
2084-
2100+
Label fall_through;
20852101
Label* non_word = backtrack_if_previous == kIsNonWord ? new_trace.backtrack()
20862102
: &fall_through;
20872103
Label* word = backtrack_if_previous == kIsNonWord ? &fall_through
20882104
: new_trace.backtrack();
20892105

2090-
if (new_trace.cp_offset() == 0) {
2106+
// A positive (> 0) cp_offset means we've already successfully matched a
2107+
// non-empty-width part of the pattern, and thus cannot be at or before the
2108+
// start of the subject string. We can thus skip both at-start and
2109+
// bounds-checks when loading the one-character lookbehind.
2110+
const bool may_be_at_or_before_subject_string_start =
2111+
new_trace.cp_offset() <= 0;
2112+
2113+
if (may_be_at_or_before_subject_string_start) {
20912114
// The start of input counts as a non-word character, so the question is
20922115
// decided if we are at the start.
2093-
assembler->CheckAtStart(non_word);
2094-
}
2095-
// We already checked that we are not at the start of input so it must be
2096-
// OK to load the previous character.
2097-
assembler->LoadCurrentCharacter(new_trace.cp_offset() - 1, &dummy, false);
2116+
// TODO(jgruber): It would be less awkward to use CheckAtStart here, but
2117+
// that currently does not support a non-zero cp_offset.
2118+
Label not_at_start;
2119+
assembler->CheckNotAtStart(new_trace.cp_offset(), &not_at_start);
2120+
assembler->GoTo(non_word);
2121+
assembler->Bind(&not_at_start);
2122+
}
2123+
2124+
// If we've already checked that we are not at the start of input, it's okay
2125+
// to load the previous character without bounds checks.
2126+
const bool can_skip_bounds_check = !may_be_at_or_before_subject_string_start;
2127+
assembler->LoadCurrentCharacter(new_trace.cp_offset() - 1, non_word,
2128+
can_skip_bounds_check);
20982129
EmitWordCheck(assembler, word, non_word, backtrack_if_previous == kIsNonWord);
20992130

21002131
assembler->Bind(&fall_through);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2019 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --regexp-interpret-all
6+
7+
assertArrayEquals(["o"], /.(?<!^.)/m.exec("foobar"));
8+
assertArrayEquals(["o"], /.(?<!\b.)/m.exec("foobar"));
9+
assertArrayEquals(["f"], /.(?<!\B.)/m.exec("foobar"));

0 commit comments

Comments
 (0)