Skip to content

Commit 8f907b6

Browse files
committed
deps: update V8 to 5.9.211.37
PR-URL: #13631 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f40caf7 commit 8f907b6

File tree

8 files changed

+131
-3
lines changed

8 files changed

+131
-3
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 5
1212
#define V8_MINOR_VERSION 9
1313
#define V8_BUILD_NUMBER 211
14-
#define V8_PATCH_LEVEL 32
14+
#define V8_PATCH_LEVEL 37
1515

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

deps/v8/src/builtins/builtins-promise-gen.cc

+12
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ Node* PromiseBuiltinsAssembler::NewPromiseCapability(Node* context,
106106
debug_event = TrueConstant();
107107
}
108108

109+
Label if_not_constructor(this, Label::kDeferred);
110+
GotoIf(TaggedIsSmi(constructor), &if_not_constructor);
111+
GotoIfNot(IsConstructorMap(LoadMap(constructor)), &if_not_constructor);
112+
109113
Node* native_context = LoadNativeContext(context);
110114

111115
Node* map = LoadRoot(Heap::kJSPromiseCapabilityMapRootIndex);
@@ -189,6 +193,13 @@ Node* PromiseBuiltinsAssembler::NewPromiseCapability(Node* context,
189193
Unreachable();
190194
}
191195

196+
BIND(&if_not_constructor);
197+
{
198+
Node* const message_id = SmiConstant(MessageTemplate::kNotConstructor);
199+
CallRuntime(Runtime::kThrowTypeError, context, message_id, constructor);
200+
Unreachable();
201+
}
202+
192203
BIND(&out);
193204
return var_result.value();
194205
}
@@ -312,6 +323,7 @@ Node* PromiseBuiltinsAssembler::SpeciesConstructor(Node* context, Node* object,
312323

313324
// 7. If IsConstructor(S) is true, return S.
314325
Label throw_error(this);
326+
GotoIf(TaggedIsSmi(species), &throw_error);
315327
Node* species_bitfield = LoadMapBitField(LoadMap(species));
316328
GotoIfNot(Word32Equal(Word32And(species_bitfield,
317329
Int32Constant((1 << Map::kIsConstructor))),

deps/v8/src/compiler/escape-analysis.cc

+7
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,13 @@ bool EscapeStatusAnalysis::CheckUsesForEscape(Node* uses, Node* rep,
853853
case IrOpcode::kObjectIsString:
854854
case IrOpcode::kObjectIsSymbol:
855855
case IrOpcode::kObjectIsUndetectable:
856+
case IrOpcode::kNumberLessThan:
857+
case IrOpcode::kNumberLessThanOrEqual:
858+
case IrOpcode::kNumberEqual:
859+
#define CASE(opcode) case IrOpcode::k##opcode:
860+
SIMPLIFIED_NUMBER_BINOP_LIST(CASE)
861+
SIMPLIFIED_NUMBER_UNOP_LIST(CASE)
862+
#undef CASE
856863
if (SetEscaped(rep)) {
857864
TRACE("Setting #%d (%s) to escaped because of use by #%d (%s)\n",
858865
rep->id(), rep->op()->mnemonic(), use->id(),

deps/v8/src/safepoint-table.cc

+65-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ SafepointTable::SafepointTable(Code* code) {
5252

5353
SafepointEntry SafepointTable::FindEntry(Address pc) const {
5454
unsigned pc_offset = static_cast<unsigned>(pc - code_->instruction_start());
55-
for (unsigned i = 0; i < length(); i++) {
55+
// We use kMaxUInt32 as sentinel value, so check that we don't hit that.
56+
DCHECK_NE(kMaxUInt32, pc_offset);
57+
unsigned len = length();
58+
// If pc == kMaxUInt32, then this entry covers all call sites in the function.
59+
if (len == 1 && GetPcOffset(0) == kMaxUInt32) return GetEntry(0);
60+
for (unsigned i = 0; i < len; i++) {
5661
// TODO(kasperl): Replace the linear search with binary search.
5762
if (GetPcOffset(i) == pc_offset) return GetEntry(i);
5863
}
@@ -137,6 +142,8 @@ unsigned SafepointTableBuilder::GetCodeOffset() const {
137142

138143

139144
void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) {
145+
RemoveDuplicates();
146+
140147
// Make sure the safepoint table is properly aligned. Pad with nops.
141148
assembler->Align(kIntSize);
142149
assembler->RecordComment(";;; Safepoint table.");
@@ -211,6 +218,63 @@ uint32_t SafepointTableBuilder::EncodeExceptPC(const DeoptimizationInfo& info,
211218
return encoding;
212219
}
213220

221+
void SafepointTableBuilder::RemoveDuplicates() {
222+
// If the table contains more than one entry, and all entries are identical
223+
// (except for the pc), replace the whole table by a single entry with pc =
224+
// kMaxUInt32. This especially compacts the table for wasm code without tagged
225+
// pointers and without deoptimization info.
226+
227+
int length = deoptimization_info_.length();
228+
DCHECK_EQ(length, deopt_index_list_.length());
229+
DCHECK_EQ(length, indexes_.length());
230+
DCHECK_EQ(length, registers_.length());
231+
232+
if (length < 2) return;
233+
234+
// Check that all entries (1, length] are identical to entry 0.
235+
for (int i = 1; i < length; ++i) {
236+
if (!IsIdenticalExceptForPc(0, i)) return;
237+
}
238+
239+
// If we get here, all entries were identical. Rewind all lists to just one
240+
// entry, and set the pc to kMaxUInt32.
241+
deoptimization_info_.Rewind(1);
242+
deopt_index_list_.Rewind(1);
243+
indexes_.Rewind(1);
244+
registers_.Rewind(1);
245+
deoptimization_info_[0].pc = kMaxUInt32;
246+
}
247+
248+
bool SafepointTableBuilder::IsIdenticalExceptForPc(int index1,
249+
int index2) const {
250+
DeoptimizationInfo& deopt_info_1 = deoptimization_info_[index1];
251+
DeoptimizationInfo& deopt_info_2 = deoptimization_info_[index2];
252+
if (deopt_info_1.arguments != deopt_info_2.arguments) return false;
253+
if (deopt_info_1.has_doubles != deopt_info_2.has_doubles) return false;
254+
255+
if (deopt_index_list_[index1] != deopt_index_list_[index2]) return false;
256+
257+
ZoneList<int>* indexes1 = indexes_[index1];
258+
ZoneList<int>* indexes2 = indexes_[index2];
259+
if (indexes1->length() != indexes2->length()) return false;
260+
for (int i = 0; i < indexes1->length(); ++i) {
261+
if (indexes1->at(i) != indexes2->at(i)) return false;
262+
}
263+
264+
ZoneList<int>* registers1 = registers_[index1];
265+
ZoneList<int>* registers2 = registers_[index2];
266+
if (registers1) {
267+
if (!registers2) return false;
268+
if (registers1->length() != registers2->length()) return false;
269+
for (int i = 0; i < registers1->length(); ++i) {
270+
if (registers1->at(i) != registers2->at(i)) return false;
271+
}
272+
} else if (registers2) {
273+
return false;
274+
}
275+
276+
return true;
277+
}
214278

215279
} // namespace internal
216280
} // namespace v8

deps/v8/src/safepoint-table.h

+4
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ class SafepointTableBuilder BASE_EMBEDDED {
216216

217217
uint32_t EncodeExceptPC(const DeoptimizationInfo& info, unsigned index);
218218

219+
bool IsIdenticalExceptForPc(int index1, int index2) const;
220+
// If all entries are identical, replace them by 1 entry with pc = kMaxUInt32.
221+
void RemoveDuplicates();
222+
219223
ZoneList<DeoptimizationInfo> deoptimization_info_;
220224
ZoneList<unsigned> deopt_index_list_;
221225
ZoneList<ZoneList<int>*> indexes_;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class WasmSectionIterator {
214214

215215
TRACE("Section: %s\n", SectionName(section_code_));
216216
if (section_code_ == kUnknownSectionCode &&
217-
section_end_ > decoder_.pc()) {
217+
section_end_ >= decoder_.pc()) {
218218
// skip to the end of the unknown section.
219219
uint32_t remaining =
220220
static_cast<uint32_t>(section_end_ - decoder_.pc());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2017 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 --turbo-escape
6+
7+
function foo() {
8+
var a = {x:1};
9+
var b = {x:1.5, y: 1};
10+
var x = 0;
11+
for (var i = 0; i < 1; i = {}) {
12+
// The second iteration of this loop is dead code, leading to a
13+
// contradiction between dynamic and static information.
14+
x += a.x + 0.5;
15+
x += a.x % 0.5;
16+
x += Math.abs(a.x);
17+
x += a.x < 6;
18+
x += a.x === 7;
19+
x += a.x <= 8;
20+
a = b;
21+
}
22+
return x;
23+
}
24+
foo();
25+
foo();
26+
%OptimizeFunctionOnNextCall(foo);
27+
foo();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2017 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
6+
7+
Object.defineProperty(Promise, Symbol.species, { value: 0 });
8+
var p = new Promise(function() {});
9+
try {
10+
p.then();
11+
assertUnreachable();
12+
} catch(e) {
13+
assertTrue(e instanceof TypeError);
14+
}

0 commit comments

Comments
 (0)