Skip to content

Commit 676ece1

Browse files
committed
update to Chromium 97.0.4692.56
1 parent 6889158 commit 676ece1

17 files changed

+72
-31
lines changed

include/v8-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 9
1212
#define V8_MINOR_VERSION 7
1313
#define V8_BUILD_NUMBER 106
14-
#define V8_PATCH_LEVEL 13
14+
#define V8_PATCH_LEVEL 18
1515

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

include/v8-wasm.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,12 @@ class V8_EXPORT WasmStreaming final {
154154
* {Finish} should be called after all received bytes where passed to
155155
* {OnBytesReceived} to tell V8 that there will be no more bytes. {Finish}
156156
* does not have to be called after {Abort} has been called already.
157+
* If {can_use_compiled_module} is true and {SetCompiledModuleBytes} was
158+
* previously called, the compiled module bytes can be used.
159+
* If {can_use_compiled_module} is false, the compiled module bytes previously
160+
* set by {SetCompiledModuleBytes} should not be used.
157161
*/
158-
void Finish();
162+
void Finish(bool can_use_compiled_module = true);
159163

160164
/**
161165
* Abort streaming compilation. If {exception} has a value, then the promise
@@ -170,6 +174,8 @@ class V8_EXPORT WasmStreaming final {
170174
* can be used, false otherwise. The buffer passed via {bytes} and {size}
171175
* is owned by the caller. If {SetCompiledModuleBytes} returns true, the
172176
* buffer must remain valid until either {Finish} or {Abort} completes.
177+
* The compiled module bytes should not be used until {Finish(true)} is
178+
* called, because they can be invalidated later by {Finish(false)}.
173179
*/
174180
bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size);
175181

src/api/api.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10509,7 +10509,7 @@ void WasmStreaming::OnBytesReceived(const uint8_t* bytes, size_t size) {
1050910509
UNREACHABLE();
1051010510
}
1051110511

10512-
void WasmStreaming::Finish() { UNREACHABLE(); }
10512+
void WasmStreaming::Finish(bool can_use_compiled_module) { UNREACHABLE(); }
1051310513

1051410514
void WasmStreaming::Abort(MaybeLocal<Value> exception) { UNREACHABLE(); }
1051510515

src/builtins/typed-array-createtypedarray.tq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ transitioning macro ConstructByArrayBuffer(implicit context: Context)(
292292
// in the step 12 branch.
293293
newByteLength = bufferByteLength - offset;
294294
newLength = elementsInfo.CalculateLength(newByteLength)
295-
otherwise IfInvalidOffset;
295+
otherwise IfInvalidLength;
296296

297297
// 12. Else,
298298
} else {

src/compiler/simplified-operator-reducer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
7777
case IrOpcode::kChangeInt32ToTagged: {
7878
Int32Matcher m(node->InputAt(0));
7979
if (m.HasResolvedValue()) return ReplaceNumber(m.ResolvedValue());
80-
if (m.IsChangeTaggedToInt32() || m.IsChangeTaggedSignedToInt32()) {
80+
if (m.IsChangeTaggedSignedToInt32()) {
8181
return Replace(m.InputAt(0));
8282
}
8383
break;

src/objects/js-array-buffer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ void JSArrayBuffer::Attach(std::shared_ptr<BackingStore> backing_store) {
8282
// invariant that their byte_length field is always 0.
8383
set_byte_length(0);
8484
} else {
85+
CHECK_LE(backing_store->byte_length(), kMaxByteLength);
8586
set_byte_length(backing_store->byte_length());
8687
}
8788
set_max_byte_length(backing_store->max_byte_length());

src/regexp/regexp-ast.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class CharacterRange {
138138
static void Negate(ZoneList<CharacterRange>* src,
139139
ZoneList<CharacterRange>* dst, Zone* zone);
140140

141+
// Remove all ranges outside the one-byte range.
142+
static void ClampToOneByte(ZoneList<CharacterRange>* ranges);
143+
141144
private:
142145
CharacterRange(base::uc32 from, base::uc32 to) : from_(from), to_(to) {}
143146

src/regexp/regexp-compiler-tonode.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,7 @@ void CharacterSet::Canonicalize() {
14161416
CharacterRange::Canonicalize(ranges_);
14171417
}
14181418

1419+
// static
14191420
void CharacterRange::Canonicalize(ZoneList<CharacterRange>* character_ranges) {
14201421
if (character_ranges->length() <= 1) return;
14211422
// Check whether ranges are already canonical (increasing, non-overlapping,
@@ -1451,6 +1452,7 @@ void CharacterRange::Canonicalize(ZoneList<CharacterRange>* character_ranges) {
14511452
DCHECK(CharacterRange::IsCanonical(character_ranges));
14521453
}
14531454

1455+
// static
14541456
void CharacterRange::Negate(ZoneList<CharacterRange>* ranges,
14551457
ZoneList<CharacterRange>* negated_ranges,
14561458
Zone* zone) {
@@ -1474,6 +1476,27 @@ void CharacterRange::Negate(ZoneList<CharacterRange>* ranges,
14741476
}
14751477
}
14761478

1479+
// static
1480+
void CharacterRange::ClampToOneByte(ZoneList<CharacterRange>* ranges) {
1481+
DCHECK(IsCanonical(ranges));
1482+
1483+
// Drop all ranges that don't contain one-byte code units, and clamp the last
1484+
// range s.t. it likewise only contains one-byte code units. Note this relies
1485+
// on `ranges` being canonicalized, i.e. sorted and non-overlapping.
1486+
1487+
static constexpr base::uc32 max_char = String::kMaxOneByteCharCodeU;
1488+
int n = ranges->length();
1489+
for (; n > 0; n--) {
1490+
CharacterRange& r = ranges->at(n - 1);
1491+
if (r.from() <= max_char) {
1492+
r.to_ = std::min(r.to_, max_char);
1493+
break;
1494+
}
1495+
}
1496+
1497+
ranges->Rewind(n);
1498+
}
1499+
14771500
namespace {
14781501

14791502
// Scoped object to keep track of how much we unroll quantifier loops in the

src/regexp/regexp-compiler.cc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,20 +1222,11 @@ void EmitCharClass(RegExpMacroAssembler* macro_assembler,
12221222
ZoneList<CharacterRange>* ranges = cc->ranges(zone);
12231223
CharacterRange::Canonicalize(ranges);
12241224

1225-
const base::uc32 max_char = MaxCodeUnit(one_byte);
1226-
1227-
// Determine the 'interesting' set of ranges; may be a subset of the given
1228-
// range set if it contains ranges not representable by the current string
1229-
// representation.
1230-
int ranges_length = ranges->length();
1231-
while (ranges_length > 0) {
1232-
CharacterRange& range = ranges->at(ranges_length - 1);
1233-
if (range.from() <= max_char) break;
1234-
ranges_length--;
1235-
}
1236-
1237-
ranges->Rewind(ranges_length); // Drop all uninteresting ranges.
1225+
// Now that all processing (like case-insensitivity) is done, clamp the
1226+
// ranges to the set of ranges that may actually occur in the subject string.
1227+
if (one_byte) CharacterRange::ClampToOneByte(ranges);
12381228

1229+
const int ranges_length = ranges->length();
12391230
if (ranges_length == 0) {
12401231
if (!cc->is_negated()) {
12411232
macro_assembler->GoTo(on_failure);
@@ -1246,6 +1237,7 @@ void EmitCharClass(RegExpMacroAssembler* macro_assembler,
12461237
return;
12471238
}
12481239

1240+
const base::uc32 max_char = MaxCodeUnit(one_byte);
12491241
if (ranges_length == 1 && ranges->at(0).IsEverything(max_char)) {
12501242
if (cc->is_negated()) {
12511243
macro_assembler->GoTo(on_failure);

src/wasm/streaming-decoder.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class V8_EXPORT_PRIVATE AsyncStreamingDecoder : public StreamingDecoder {
3535
// The buffer passed into OnBytesReceived is owned by the caller.
3636
void OnBytesReceived(base::Vector<const uint8_t> bytes) override;
3737

38-
void Finish() override;
38+
void Finish(bool can_use_compiled_module) override;
3939

4040
void Abort() override;
4141

@@ -258,7 +258,7 @@ size_t AsyncStreamingDecoder::DecodingState::ReadBytes(
258258
return num_bytes;
259259
}
260260

261-
void AsyncStreamingDecoder::Finish() {
261+
void AsyncStreamingDecoder::Finish(bool can_use_compiled_module) {
262262
TRACE_STREAMING("Finish\n");
263263
DCHECK(!stream_finished_);
264264
stream_finished_ = true;
@@ -268,9 +268,12 @@ void AsyncStreamingDecoder::Finish() {
268268
base::Vector<const uint8_t> wire_bytes =
269269
base::VectorOf(wire_bytes_for_deserializing_);
270270
// Try to deserialize the module from wire bytes and module bytes.
271-
if (processor_->Deserialize(compiled_module_bytes_, wire_bytes)) return;
271+
if (can_use_compiled_module &&
272+
processor_->Deserialize(compiled_module_bytes_, wire_bytes))
273+
return;
272274

273-
// Deserialization failed. Restart decoding using |wire_bytes|.
275+
// Compiled module bytes are invalidated by can_use_compiled_module = false
276+
// or the deserialization failed. Restart decoding using |wire_bytes|.
274277
compiled_module_bytes_ = {};
275278
DCHECK(!deserializing());
276279
OnBytesReceived(wire_bytes);

src/wasm/streaming-decoder.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class V8_EXPORT_PRIVATE StreamingDecoder {
7878
// The buffer passed into OnBytesReceived is owned by the caller.
7979
virtual void OnBytesReceived(base::Vector<const uint8_t> bytes) = 0;
8080

81-
virtual void Finish() = 0;
81+
virtual void Finish(bool can_use_compiled_module = true) = 0;
8282

8383
virtual void Abort() = 0;
8484

@@ -96,6 +96,7 @@ class V8_EXPORT_PRIVATE StreamingDecoder {
9696
}
9797

9898
// Passes previously compiled module bytes from the embedder's cache.
99+
// The content shouldn't be used until Finish(true) is called.
99100
bool SetCompiledModuleBytes(
100101
base::Vector<const uint8_t> compiled_module_bytes) {
101102
compiled_module_bytes_ = compiled_module_bytes;
@@ -124,6 +125,8 @@ class V8_EXPORT_PRIVATE StreamingDecoder {
124125

125126
std::string url_;
126127
ModuleCompiledCallback module_compiled_callback_;
128+
// The content of `compiled_module_bytes_` shouldn't be used until
129+
// Finish(true) is called.
127130
base::Vector<const uint8_t> compiled_module_bytes_;
128131
};
129132

src/wasm/sync-streaming-decoder.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class V8_EXPORT_PRIVATE SyncStreamingDecoder : public StreamingDecoder {
3232
buffer_size_ += bytes.size();
3333
}
3434

35-
void Finish() override {
35+
void Finish(bool can_use_compiled_module) override {
3636
// We copy all received chunks into one byte buffer.
3737
auto bytes = std::make_unique<uint8_t[]>(buffer_size_);
3838
uint8_t* destination = bytes.get();
@@ -43,7 +43,7 @@ class V8_EXPORT_PRIVATE SyncStreamingDecoder : public StreamingDecoder {
4343
CHECK_EQ(destination - bytes.get(), buffer_size_);
4444

4545
// Check if we can deserialize the module from cache.
46-
if (deserializing()) {
46+
if (can_use_compiled_module && deserializing()) {
4747
HandleScope scope(isolate_);
4848
SaveAndSwitchContext saved_context(isolate_, *context_);
4949

src/wasm/wasm-engine.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,9 @@ WasmCodeManager* GetWasmCodeManager() {
16451645

16461646
// {max_mem_pages} is declared in wasm-limits.h.
16471647
uint32_t max_mem_pages() {
1648+
static_assert(
1649+
kV8MaxWasmMemoryPages * kWasmPageSize <= JSArrayBuffer::kMaxByteLength,
1650+
"Wasm memories must not be bigger than JSArrayBuffers");
16481651
STATIC_ASSERT(kV8MaxWasmMemoryPages <= kMaxUInt32);
16491652
return std::min(uint32_t{kV8MaxWasmMemoryPages}, FLAG_wasm_max_mem_pages);
16501653
}

src/wasm/wasm-js.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ class WasmStreaming::WasmStreamingImpl {
6363
void OnBytesReceived(const uint8_t* bytes, size_t size) {
6464
streaming_decoder_->OnBytesReceived(base::VectorOf(bytes, size));
6565
}
66-
void Finish() { streaming_decoder_->Finish(); }
66+
void Finish(bool can_use_compiled_module) {
67+
streaming_decoder_->Finish(can_use_compiled_module);
68+
}
6769

6870
void Abort(MaybeLocal<Value> exception) {
6971
i::HandleScope scope(reinterpret_cast<i::Isolate*>(isolate_));
@@ -116,9 +118,9 @@ void WasmStreaming::OnBytesReceived(const uint8_t* bytes, size_t size) {
116118
impl_->OnBytesReceived(bytes, size);
117119
}
118120

119-
void WasmStreaming::Finish() {
121+
void WasmStreaming::Finish(bool can_use_compiled_module) {
120122
TRACE_EVENT0("v8.wasm", "wasm.FinishStreaming");
121-
impl_->Finish();
123+
impl_->Finish(can_use_compiled_module);
122124
}
123125

124126
void WasmStreaming::Abort(MaybeLocal<Value> exception) {

src/wasm/wasm-limits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ constexpr size_t kV8MaxWasmDataSegments = 100000;
4040
// Also, do not use this limit to validate declared memory, use
4141
// kSpecMaxMemoryPages for that.
4242
constexpr size_t kV8MaxWasmMemoryPages = kSystemPointerSize == 4
43-
? 32768 // = 2 GiB
43+
? 32767 // = 2 GiB
4444
: 65536; // = 4 GiB
4545
constexpr size_t kV8MaxWasmStringSize = 100000;
4646
constexpr size_t kV8MaxWasmModuleSize = 1024 * 1024 * 1024; // = 1 GiB
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2021 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: --no-regexp-tier-up
6+
7+
/[\u{0}zPudf\u{d3}-\ud809\udccc]/iu.exec(""); // Don't crash :)

tools/mb/mb.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ def WriteIsolateFiles(self, build_dir, target, runtime_deps):
804804
self.WriteJSON(
805805
{
806806
'args': [
807-
'--isolated',
808-
self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
809807
'--isolate',
810808
self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
811809
],

0 commit comments

Comments
 (0)