Skip to content

Commit 9cefbba

Browse files
targosBridgeAR
authored andcommitted
deps: patch V8 to 7.0.276.38
Refs: v8/v8@7.0.276.36...7.0.276.38 PR-URL: #24271 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2b48c71 commit 9cefbba

File tree

6 files changed

+101
-82
lines changed

6 files changed

+101
-82
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 0
1313
#define V8_BUILD_NUMBER 276
14-
#define V8_PATCH_LEVEL 36
14+
#define V8_PATCH_LEVEL 38
1515

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

deps/v8/src/wasm/module-compiler.cc

+32-26
Original file line numberDiff line numberDiff line change
@@ -2329,12 +2329,6 @@ void AsyncCompileJob::CancelPendingForegroundTask() {
23292329
pending_foreground_task_ = nullptr;
23302330
}
23312331

2332-
template <typename Step, typename... Args>
2333-
void AsyncCompileJob::DoSync(Args&&... args) {
2334-
NextStep<Step>(std::forward<Args>(args)...);
2335-
StartForegroundTask();
2336-
}
2337-
23382332
void AsyncCompileJob::StartBackgroundTask() {
23392333
auto task = base::make_unique<CompileTask>(this, false);
23402334

@@ -2347,6 +2341,18 @@ void AsyncCompileJob::StartBackgroundTask() {
23472341
}
23482342
}
23492343

2344+
template <typename Step, typename... Args>
2345+
void AsyncCompileJob::DoSync(Args&&... args) {
2346+
NextStep<Step>(std::forward<Args>(args)...);
2347+
StartForegroundTask();
2348+
}
2349+
2350+
template <typename Step, typename... Args>
2351+
void AsyncCompileJob::DoImmediately(Args&&... args) {
2352+
NextStep<Step>(std::forward<Args>(args)...);
2353+
ExecuteForegroundTaskImmediately();
2354+
}
2355+
23502356
template <typename Step, typename... Args>
23512357
void AsyncCompileJob::DoAsync(Args&&... args) {
23522358
NextStep<Step>(std::forward<Args>(args)...);
@@ -2686,11 +2692,10 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(size_t functions_count,
26862692
FinishAsyncCompileJobWithError(decoder_.FinishDecoding(false));
26872693
return false;
26882694
}
2689-
job_->NextStep<AsyncCompileJob::PrepareAndStartCompile>(
2690-
decoder_.shared_module(), false);
26912695
// Execute the PrepareAndStartCompile step immediately and not in a separate
26922696
// task.
2693-
job_->ExecuteForegroundTaskImmediately();
2697+
job_->DoImmediately<AsyncCompileJob::PrepareAndStartCompile>(
2698+
decoder_.shared_module(), false);
26942699

26952700
job_->native_module_->compilation_state()->SetNumberOfFunctionsToCompile(
26962701
functions_count);
@@ -2734,25 +2739,26 @@ void AsyncStreamingProcessor::OnFinishedChunk() {
27342739
// Finish the processing of the stream.
27352740
void AsyncStreamingProcessor::OnFinishedStream(OwnedVector<uint8_t> bytes) {
27362741
TRACE_STREAMING("Finish stream...\n");
2737-
if (job_->native_module_) {
2738-
job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector());
2739-
job_->native_module_->set_wire_bytes(std::move(bytes));
2740-
}
27412742
ModuleResult result = decoder_.FinishDecoding(false);
27422743
DCHECK(result.ok());
2743-
if (job_->DecrementAndCheckFinisherCount()) {
2744-
if (job_->native_module_ == nullptr) {
2745-
// We are processing a WebAssembly module without code section. We need to
2746-
// prepare compilation first before we can finish it.
2747-
// {PrepareAndStartCompile} will call {FinishCompile} by itself if there
2748-
// is no code section.
2749-
job_->DoSync<AsyncCompileJob::PrepareAndStartCompile>(result.val, true);
2750-
} else {
2751-
HandleScope scope(job_->isolate_);
2752-
SaveContext saved_context(job_->isolate_);
2753-
job_->isolate_->set_context(*job_->native_context_);
2754-
job_->FinishCompile();
2755-
}
2744+
bool needs_finish = job_->DecrementAndCheckFinisherCount();
2745+
if (job_->native_module_ == nullptr) {
2746+
// We are processing a WebAssembly module without code section. We need to
2747+
// prepare compilation first before we can finish it.
2748+
// {PrepareAndStartCompile} will call {FinishCompile} by itself if there
2749+
// is no code section.
2750+
DCHECK(needs_finish);
2751+
needs_finish = false;
2752+
job_->DoImmediately<AsyncCompileJob::PrepareAndStartCompile>(result.val,
2753+
true);
2754+
}
2755+
job_->wire_bytes_ = ModuleWireBytes(bytes.as_vector());
2756+
job_->native_module_->set_wire_bytes(std::move(bytes));
2757+
if (needs_finish) {
2758+
HandleScope scope(job_->isolate_);
2759+
SaveContext saved_context(job_->isolate_);
2760+
job_->isolate_->set_context(*job_->native_context_);
2761+
job_->FinishCompile();
27562762
}
27572763
}
27582764

deps/v8/src/wasm/module-compiler.h

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ class AsyncCompileJob {
126126
template <typename Step, typename... Args>
127127
void DoSync(Args&&... args);
128128

129+
// Switches to the compilation step {Step} and immediately executes that step.
130+
template <typename Step, typename... Args>
131+
void DoImmediately(Args&&... args);
132+
129133
// Switches to the compilation step {Step} and starts a background task to
130134
// execute it.
131135
template <typename Step, typename... Args>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2018 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: --gc-interval=100
6+
7+
let xs = [];
8+
for (let i = 0; i < 205; ++i) {
9+
xs.push(i);
10+
}
11+
xs.sort((a, b) => {
12+
xs.shift();
13+
xs[xs.length] = -246;
14+
return a - b;
15+
});

deps/v8/test/mjsunit/wasm/async-compile.js

+7
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ assertPromiseResult(async function badFunctionInTheMiddle() {
7070
let buffer = builder.toBuffer();
7171
await assertCompileError(buffer);
7272
}());
73+
74+
assertPromiseResult(async function importWithoutCode() {
75+
// Regression test for https://crbug.com/898310.
76+
let builder = new WasmModuleBuilder();
77+
builder.addImport('m', 'q', kSig_i_i);
78+
await builder.asyncInstantiate({'m': {'q': i => i}});
79+
}());

deps/v8/third_party/v8/builtins/array-sort.tq

+42-55
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ module array {
826826
assert(i >= 0);
827827
assert(i == stack_size - 2 || i == stack_size - 3);
828828

829-
const elements: HeapObject = ReloadElements(sortState);
829+
let elements: HeapObject = ReloadElements(sortState);
830830
const Load: LoadFn = GetLoadFn(sortState);
831831

832832
const pending_runs: FixedArray =
@@ -859,6 +859,7 @@ module array {
859859
const k: Smi = CallGallopRight(
860860
context, sortState, Load, key_right, base_a, length_a, 0, False)
861861
otherwise Bailout;
862+
elements = ReloadElements(sortState);
862863
assert(k >= 0);
863864

864865
base_a = base_a + k;
@@ -874,6 +875,7 @@ module array {
874875
length_b = CallGallopLeft(
875876
context, sortState, Load, key_left, base_b, length_b, length_b - 1,
876877
False) otherwise Bailout;
878+
elements = ReloadElements(sortState);
877879
assert(length_b >= 0);
878880
if (length_b == 0) return kSuccess;
879881

@@ -893,6 +895,12 @@ module array {
893895
}
894896
}
895897

898+
macro LoadElementsOrTempArray(
899+
useTempArray: Boolean, sortState: FixedArray): HeapObject {
900+
return useTempArray == True ? GetTempArray(sortState) :
901+
ReloadElements(sortState);
902+
}
903+
896904
// Locates the proper position of key in a sorted array; if the array contains
897905
// an element equal to key, return the position immediately to the left of
898906
// the leftmost equal element. (GallopRight does the same except returns the
@@ -916,25 +924,17 @@ module array {
916924
assert(length > 0 && base >= 0);
917925
assert(0 <= hint && hint < length);
918926

919-
// We cannot leave a pointer to elements on the stack (see comment at
920-
// ReloadElements). For this reason we pass a flag whether to reload
921-
// and which array to use.
922-
let elements: HeapObject = useTempArray == True ? GetTempArray(sortState) :
923-
ReloadElements(sortState);
924-
925927
let last_ofs: Smi = 0;
926928
let offset: Smi = 1;
927929

928930
try {
929-
const base_hint_element: Object =
930-
CallLoad(context, sortState, Load, elements, base + hint)
931+
const base_hint_element: Object = CallLoad(
932+
context, sortState, Load,
933+
LoadElementsOrTempArray(useTempArray, sortState), base + hint)
931934
otherwise Bailout;
932935
let order: Number =
933936
CallCompareFn(context, sortState, base_hint_element, key)
934937
otherwise Bailout;
935-
if (useTempArray == False) {
936-
elements = ReloadElements(sortState);
937-
}
938938

939939
if (order < 0) {
940940
// a[base + hint] < key: gallop right, until
@@ -943,14 +943,13 @@ module array {
943943
// a[base + length - 1] is highest.
944944
let max_ofs: Smi = length - hint;
945945
while (offset < max_ofs) {
946-
const offset_element: Object =
947-
CallLoad(context, sortState, Load, elements, base + hint + offset)
946+
const offset_element: Object = CallLoad(
947+
context, sortState, Load,
948+
LoadElementsOrTempArray(useTempArray, sortState),
949+
base + hint + offset)
948950
otherwise Bailout;
949951
order = CallCompareFn(context, sortState, offset_element, key)
950952
otherwise Bailout;
951-
if (useTempArray == False) {
952-
elements = ReloadElements(sortState);
953-
}
954953

955954
// a[base + hint + offset] >= key? Break.
956955
if (order >= 0) break;
@@ -975,14 +974,13 @@ module array {
975974
// a[base + hint] is lowest.
976975
let max_ofs: Smi = hint + 1;
977976
while (offset < max_ofs) {
978-
const offset_element: Object =
979-
CallLoad(context, sortState, Load, elements, base + hint - offset)
977+
const offset_element: Object = CallLoad(
978+
context, sortState, Load,
979+
LoadElementsOrTempArray(useTempArray, sortState),
980+
base + hint - offset)
980981
otherwise Bailout;
981982
order = CallCompareFn(context, sortState, offset_element, key)
982983
otherwise Bailout;
983-
if (useTempArray == False) {
984-
elements = ReloadElements(sortState);
985-
}
986984

987985
if (order < 0) break;
988986

@@ -1011,14 +1009,12 @@ module array {
10111009
while (last_ofs < offset) {
10121010
const m: Smi = last_ofs + ((offset - last_ofs) >>> 1);
10131011

1014-
const base_m_element: Object =
1015-
CallLoad(context, sortState, Load, elements, base + m)
1012+
const base_m_element: Object = CallLoad(
1013+
context, sortState, Load,
1014+
LoadElementsOrTempArray(useTempArray, sortState), base + m)
10161015
otherwise Bailout;
10171016
order = CallCompareFn(context, sortState, base_m_element, key)
10181017
otherwise Bailout;
1019-
if (useTempArray == False) {
1020-
elements = ReloadElements(sortState);
1021-
}
10221018

10231019
if (order < 0) {
10241020
last_ofs = m + 1; // a[base + m] < key.
@@ -1051,25 +1047,17 @@ module array {
10511047
assert(length > 0 && base >= 0);
10521048
assert(0 <= hint && hint < length);
10531049

1054-
// We cannot leave a pointer to elements on the stack (see comment at
1055-
// ReloadElements). For this reason we pass a flag whether to reload
1056-
// and which array to use.
1057-
let elements: HeapObject = useTempArray == True ? GetTempArray(sortState) :
1058-
ReloadElements(sortState);
1059-
10601050
let last_ofs: Smi = 0;
10611051
let offset: Smi = 1;
10621052

10631053
try {
1064-
const base_hint_element: Object =
1065-
CallLoad(context, sortState, Load, elements, base + hint)
1054+
const base_hint_element: Object = CallLoad(
1055+
context, sortState, Load,
1056+
LoadElementsOrTempArray(useTempArray, sortState), base + hint)
10661057
otherwise Bailout;
10671058
let order: Number =
10681059
CallCompareFn(context, sortState, key, base_hint_element)
10691060
otherwise Bailout;
1070-
if (useTempArray == False) {
1071-
elements = ReloadElements(sortState);
1072-
}
10731061

10741062
if (order < 0) {
10751063
// key < a[base + hint]: gallop left, until
@@ -1078,14 +1066,13 @@ module array {
10781066
// a[base + hint] is lowest.
10791067
let max_ofs: Smi = hint + 1;
10801068
while (offset < max_ofs) {
1081-
const offset_element: Object =
1082-
CallLoad(context, sortState, Load, elements, base + hint - offset)
1069+
const offset_element: Object = CallLoad(
1070+
context, sortState, Load,
1071+
LoadElementsOrTempArray(useTempArray, sortState),
1072+
base + hint - offset)
10831073
otherwise Bailout;
10841074
order = CallCompareFn(context, sortState, key, offset_element)
10851075
otherwise Bailout;
1086-
if (useTempArray == False) {
1087-
elements = ReloadElements(sortState);
1088-
}
10891076

10901077
if (order >= 0) break;
10911078

@@ -1109,14 +1096,13 @@ module array {
11091096
// a[base + length - 1] is highest.
11101097
let max_ofs: Smi = length - hint;
11111098
while (offset < max_ofs) {
1112-
const offset_element: Object =
1113-
CallLoad(context, sortState, Load, elements, base + hint + offset)
1099+
const offset_element: Object = CallLoad(
1100+
context, sortState, Load,
1101+
LoadElementsOrTempArray(useTempArray, sortState),
1102+
base + hint + offset)
11141103
otherwise Bailout;
11151104
order = CallCompareFn(context, sortState, key, offset_element)
11161105
otherwise Bailout;
1117-
if (useTempArray == False) {
1118-
elements = ReloadElements(sortState);
1119-
}
11201106

11211107
// a[base + hint + ofs] <= key.
11221108
if (order < 0) break;
@@ -1144,14 +1130,12 @@ module array {
11441130
while (last_ofs < offset) {
11451131
const m: Smi = last_ofs + ((offset - last_ofs) >>> 1);
11461132

1147-
const base_m_element: Object =
1148-
CallLoad(context, sortState, Load, elements, base + m)
1133+
const base_m_element: Object = CallLoad(
1134+
context, sortState, Load,
1135+
LoadElementsOrTempArray(useTempArray, sortState), base + m)
11491136
otherwise Bailout;
11501137
order = CallCompareFn(context, sortState, key, base_m_element)
11511138
otherwise Bailout;
1152-
if (useTempArray == False) {
1153-
elements = ReloadElements(sortState);
1154-
}
11551139

11561140
if (order < 0) {
11571141
offset = m; // key < a[base + m].
@@ -1288,6 +1272,7 @@ module array {
12881272
nof_wins_a = CallGallopRight(
12891273
context, sortState, Load<TempArrayElements>, key_right,
12901274
cursor_temp, length_a, 0, True) otherwise Bailout;
1275+
elements = ReloadElements(sortState);
12911276
assert(nof_wins_a >= 0);
12921277

12931278
if (nof_wins_a > 0) {
@@ -1313,6 +1298,7 @@ module array {
13131298
context, sortState, LoadF, temp_array[cursor_temp], cursor_b,
13141299
length_b, 0, False)
13151300
otherwise Bailout;
1301+
elements = ReloadElements(sortState);
13161302
assert(nof_wins_b >= 0);
13171303
if (nof_wins_b > 0) {
13181304
CallCopyWithinSortArray(
@@ -1461,6 +1447,7 @@ module array {
14611447
context, sortState, LoadF, temp_array[cursor_temp], baseA,
14621448
length_a, length_a - 1, False)
14631449
otherwise Bailout;
1450+
elements = ReloadElements(sortState);
14641451
assert(k >= 0);
14651452
nof_wins_a = length_a - k;
14661453

@@ -1487,6 +1474,7 @@ module array {
14871474
k = CallGallopLeft(
14881475
context, sortState, Load<TempArrayElements>, key, 0, length_b,
14891476
length_b - 1, True) otherwise Bailout;
1477+
elements = ReloadElements(sortState);
14901478
assert(k >= 0);
14911479
nof_wins_b = length_b - k;
14921480

@@ -1743,8 +1731,7 @@ module array {
17431731
// 2. Let obj be ? ToObject(this value).
17441732
const obj: JSReceiver = ToObject(context, receiver);
17451733

1746-
const sort_state: FixedArray =
1747-
AllocateZeroedFixedArray(kSortStateSize);
1734+
const sort_state: FixedArray = AllocateZeroedFixedArray(kSortStateSize);
17481735
FillFixedArrayWithSmiZero(sort_state, SmiTag(kSortStateSize));
17491736

17501737
sort_state[kReceiverIdx] = obj;

0 commit comments

Comments
 (0)