Skip to content

Commit 929979d

Browse files
targosjasnell
authored andcommitted
deps: update V8 to 5.4.500.36
PR-URL: #9253 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5532a7a commit 929979d

14 files changed

+152
-25
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 4
1313
#define V8_BUILD_NUMBER 500
14-
#define V8_PATCH_LEVEL 31
14+
#define V8_PATCH_LEVEL 36
1515

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

deps/v8/src/compiler/js-builtin-reducer.cc

+10-1
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,16 @@ bool CanInlineArrayResizeOperation(Handle<Map> receiver_map) {
145145
if (!receiver_map->prototype()->IsJSArray()) return false;
146146
Handle<JSArray> receiver_prototype(JSArray::cast(receiver_map->prototype()),
147147
isolate);
148+
// Ensure that all prototypes of the {receiver} are stable.
149+
for (PrototypeIterator it(isolate, receiver_prototype, kStartAtReceiver);
150+
!it.IsAtEnd(); it.Advance()) {
151+
Handle<JSReceiver> current = PrototypeIterator::GetCurrent<JSReceiver>(it);
152+
if (!current->map()->is_stable()) return false;
153+
}
148154
return receiver_map->instance_type() == JS_ARRAY_TYPE &&
149155
IsFastElementsKind(receiver_map->elements_kind()) &&
150156
!receiver_map->is_dictionary_map() && receiver_map->is_extensible() &&
151157
(!receiver_map->is_prototype_map() || receiver_map->is_stable()) &&
152-
receiver_prototype->map()->is_stable() &&
153158
isolate->IsFastArrayConstructorPrototypeChainIntact() &&
154159
isolate->IsAnyInitialArrayPrototype(receiver_prototype) &&
155160
!IsReadOnlyLengthDescriptor(receiver_map);
@@ -308,6 +313,10 @@ Reduction JSBuiltinReducer::ReduceArrayPush(Node* node) {
308313
AccessBuilder::ForFixedArrayElement(receiver_map->elements_kind())),
309314
elements, length, value, effect, control);
310315

316+
// Return the new length of the {receiver}.
317+
value = graph()->NewNode(simplified()->NumberAdd(), length,
318+
jsgraph()->OneConstant());
319+
311320
ReplaceWithValue(node, value, effect, control);
312321
return Replace(value);
313322
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
614614
fallthrough_control);
615615
this_controls.push_back(
616616
graph()->NewNode(common()->IfTrue(), branch));
617-
this_effects.push_back(effect);
617+
this_effects.push_back(this_effect);
618618
fallthrough_control =
619619
graph()->NewNode(common()->IfFalse(), branch);
620620
}

deps/v8/src/compiler/typer.cc

+2
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,8 @@ Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) {
13521352
case kArrayIndexOf:
13531353
case kArrayLastIndexOf:
13541354
return Type::Range(-1, kMaxSafeInteger, t->zone());
1355+
case kArrayPush:
1356+
return t->cache_.kPositiveSafeInteger;
13551357
// Object functions.
13561358
case kObjectHasOwnProperty:
13571359
return Type::Boolean();

deps/v8/src/crankshaft/hydrogen-instructions.cc

+29-15
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ bool Range::AddAndCheckOverflow(const Representation& r, Range* other) {
259259
bool may_overflow = false;
260260
lower_ = AddWithoutOverflow(r, lower_, other->lower(), &may_overflow);
261261
upper_ = AddWithoutOverflow(r, upper_, other->upper(), &may_overflow);
262-
KeepOrder();
262+
if (may_overflow) {
263+
Clear();
264+
} else {
265+
KeepOrder();
266+
}
263267
#ifdef DEBUG
264268
Verify();
265269
#endif
@@ -271,13 +275,21 @@ bool Range::SubAndCheckOverflow(const Representation& r, Range* other) {
271275
bool may_overflow = false;
272276
lower_ = SubWithoutOverflow(r, lower_, other->upper(), &may_overflow);
273277
upper_ = SubWithoutOverflow(r, upper_, other->lower(), &may_overflow);
274-
KeepOrder();
278+
if (may_overflow) {
279+
Clear();
280+
} else {
281+
KeepOrder();
282+
}
275283
#ifdef DEBUG
276284
Verify();
277285
#endif
278286
return may_overflow;
279287
}
280288

289+
void Range::Clear() {
290+
lower_ = kMinInt;
291+
upper_ = kMaxInt;
292+
}
281293

282294
void Range::KeepOrder() {
283295
if (lower_ > upper_) {
@@ -301,8 +313,12 @@ bool Range::MulAndCheckOverflow(const Representation& r, Range* other) {
301313
int v2 = MulWithoutOverflow(r, lower_, other->upper(), &may_overflow);
302314
int v3 = MulWithoutOverflow(r, upper_, other->lower(), &may_overflow);
303315
int v4 = MulWithoutOverflow(r, upper_, other->upper(), &may_overflow);
304-
lower_ = Min(Min(v1, v2), Min(v3, v4));
305-
upper_ = Max(Max(v1, v2), Max(v3, v4));
316+
if (may_overflow) {
317+
Clear();
318+
} else {
319+
lower_ = Min(Min(v1, v2), Min(v3, v4));
320+
upper_ = Max(Max(v1, v2), Max(v3, v4));
321+
}
306322
#ifdef DEBUG
307323
Verify();
308324
#endif
@@ -3184,6 +3200,13 @@ bool HAllocate::HandleSideEffectDominator(GVNFlag side_effect,
31843200
return false;
31853201
}
31863202

3203+
if (IsAllocationFoldingDominator()) {
3204+
if (FLAG_trace_allocation_folding) {
3205+
PrintF("#%d (%s) cannot fold into #%d (%s), already dominator\n", id(),
3206+
Mnemonic(), dominator->id(), dominator->Mnemonic());
3207+
}
3208+
return false;
3209+
}
31873210

31883211
if (!IsFoldable(dominator_allocate)) {
31893212
if (FLAG_trace_allocation_folding) {
@@ -3235,17 +3258,6 @@ bool HAllocate::HandleSideEffectDominator(GVNFlag side_effect,
32353258
}
32363259
}
32373260

3238-
if (IsAllocationFoldingDominator()) {
3239-
DeleteAndReplaceWith(dominator_allocate);
3240-
if (FLAG_trace_allocation_folding) {
3241-
PrintF(
3242-
"#%d (%s) folded dominator into #%d (%s), new dominator size: %d\n",
3243-
id(), Mnemonic(), dominator_allocate->id(),
3244-
dominator_allocate->Mnemonic(), new_dominator_size);
3245-
}
3246-
return true;
3247-
}
3248-
32493261
if (!dominator_allocate->IsAllocationFoldingDominator()) {
32503262
HAllocate* first_alloc =
32513263
HAllocate::New(isolate, zone, dominator_allocate->context(),
@@ -3280,6 +3292,8 @@ std::ostream& HAllocate::PrintDataTo(std::ostream& os) const { // NOLINT
32803292
if (IsOldSpaceAllocation()) os << "P";
32813293
if (MustAllocateDoubleAligned()) os << "A";
32823294
if (MustPrefillWithFiller()) os << "F";
3295+
if (IsAllocationFoldingDominator()) os << "d";
3296+
if (IsAllocationFolded()) os << "f";
32833297
return os << ")";
32843298
}
32853299

deps/v8/src/crankshaft/hydrogen-instructions.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ class Range final : public ZoneObject {
237237
lower_ = Max(lower_, Smi::kMinValue);
238238
upper_ = Min(upper_, Smi::kMaxValue);
239239
}
240+
void Clear();
240241
void KeepOrder();
241242
#ifdef DEBUG
242243
void Verify() const;
@@ -4935,7 +4936,7 @@ class HAllocate final : public HTemplateInstruction<3> {
49354936
static_cast<HAllocate::Flags>(flags_ | ALLOCATION_FOLDING_DOMINATOR);
49364937
}
49374938

4938-
bool IsAllocationFoldingDominator() {
4939+
bool IsAllocationFoldingDominator() const {
49394940
return (flags_ & ALLOCATION_FOLDING_DOMINATOR) != 0;
49404941
}
49414942

@@ -4946,7 +4947,7 @@ class HAllocate final : public HTemplateInstruction<3> {
49464947
SetOperandAt(2, dominator);
49474948
}
49484949

4949-
bool IsAllocationFolded() { return (flags_ & ALLOCATION_FOLDED) != 0; }
4950+
bool IsAllocationFolded() const { return (flags_ & ALLOCATION_FOLDED) != 0; }
49504951

49514952
bool HandleSideEffectDominator(GVNFlag side_effect,
49524953
HValue* dominator) override;

deps/v8/src/parsing/parser.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -4506,9 +4506,6 @@ Block* Parser::BuildParameterInitializationBlock(
45064506
// TODO(adamk): Should this be kNoSourcePosition, since
45074507
// it's just copying from a temp var to the real param var?
45084508
descriptor.initialization_pos = parameter.pattern->position();
4509-
// The initializer position which will end up in,
4510-
// Variable::initializer_position(), used for hole check elimination.
4511-
int initializer_position = parameter.pattern->position();
45124509
Expression* initial_value =
45134510
factory()->NewVariableProxy(parameters.scope->parameter(i));
45144511
if (parameter.initializer != nullptr) {
@@ -4524,7 +4521,6 @@ Block* Parser::BuildParameterInitializationBlock(
45244521
initial_value = factory()->NewConditional(
45254522
condition, parameter.initializer, initial_value, kNoSourcePosition);
45264523
descriptor.initialization_pos = parameter.initializer->position();
4527-
initializer_position = parameter.initializer_end_position;
45284524
}
45294525

45304526
Scope* param_scope = scope();
@@ -4547,7 +4543,7 @@ Block* Parser::BuildParameterInitializationBlock(
45474543

45484544
BlockState block_state(&scope_state_, param_scope);
45494545
DeclarationParsingResult::Declaration decl(
4550-
parameter.pattern, initializer_position, initial_value);
4546+
parameter.pattern, parameter.initializer_end_position, initial_value);
45514547
PatternRewriter::DeclareAndInitializeVariables(param_block, &descriptor,
45524548
&decl, nullptr, CHECK_OK);
45534549

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2016 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+
assertThrows(function(...[b = !b]) { }, ReferenceError);
6+
assertThrows(() => (function([b = !b]) { })([]), ReferenceError);
7+
assertThrows(() => (function({b = !b}) { })({}), ReferenceError);
8+
9+
assertThrows((...[b = !b]) => { }, ReferenceError);
10+
assertThrows(() => (([b = !b]) => { })([]), ReferenceError);
11+
assertThrows(() => (({b = !b}) => { })({}), ReferenceError);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2016 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 --verify-heap
6+
7+
function f(a) { // First parameter is tagged.
8+
var n = 1 + a;
9+
}
10+
11+
function g() {
12+
f();
13+
var d = {x : f()};
14+
return [d];
15+
}
16+
17+
g();
18+
g();
19+
%OptimizeFunctionOnNextCall(g);
20+
g();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2016 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+
for (var i = 0; i < 1024; ++i) Object.prototype["i" + i] = i;
8+
9+
function foo() { [].push(1); }
10+
11+
foo();
12+
foo();
13+
%OptimizeFunctionOnNextCall(foo);
14+
foo();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2016 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+
for (var i = 0; i < 1024; ++i) Object.prototype["i" + i] = i;
8+
9+
function foo() { [1].pop(); }
10+
11+
foo();
12+
foo();
13+
%OptimizeFunctionOnNextCall(foo);
14+
foo();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 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+
function n(x,y){
8+
y = (y-(0x80000000|0)|0);
9+
return (x/y)|0;
10+
};
11+
var x = -0x80000000;
12+
var y = 0x7fffffff;
13+
n(x,y);
14+
n(x,y);
15+
%OptimizeFunctionOnNextCall(n);
16+
assertEquals(x, n(x,y));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2016 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+
function foo(a) {
8+
a.x = 0;
9+
if (a.x === 0) a[1] = 0.1;
10+
a.x = {};
11+
}
12+
foo(new Array(1));
13+
foo(new Array(1));
14+
%OptimizeFunctionOnNextCall(foo);
15+
foo(new Array(1));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2016 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+
function foo(a) {
8+
return a.push(true);
9+
}
10+
11+
var a = [];
12+
assertEquals(1, foo(a));
13+
assertEquals(2, foo(a));
14+
%OptimizeFunctionOnNextCall(foo);
15+
assertEquals(3, foo(a));

0 commit comments

Comments
 (0)