Skip to content

Commit 039f0c3

Browse files
committed
deps: update V8 to 5.4.500.31
PR-URL: #8852 Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2893bd2 commit 039f0c3

19 files changed

+84
-79
lines changed

deps/v8/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 5
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 500
14-
#define V8_PATCH_LEVEL 27
14+
#define V8_PATCH_LEVEL 31
1515

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

deps/v8/src/api.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class HandleScopeImplementer {
389389
call_depth_(0),
390390
microtasks_depth_(0),
391391
microtasks_suppressions_(0),
392+
entered_context_count_during_microtasks_(0),
392393
#ifdef DEBUG
393394
debug_microtasks_depth_(0),
394395
#endif
@@ -454,6 +455,11 @@ class HandleScopeImplementer {
454455
inline void EnterMicrotaskContext(Handle<Context> context);
455456
inline void LeaveMicrotaskContext();
456457
inline Handle<Context> MicrotaskContext();
458+
inline bool MicrotaskContextIsLastEnteredContext() const {
459+
return microtask_context_ &&
460+
entered_context_count_during_microtasks_ ==
461+
entered_contexts_.length();
462+
}
457463

458464
inline void SaveContext(Context* context);
459465
inline Context* RestoreContext();
@@ -474,6 +480,7 @@ class HandleScopeImplementer {
474480
entered_contexts_.Initialize(0);
475481
saved_contexts_.Initialize(0);
476482
microtask_context_ = nullptr;
483+
entered_context_count_during_microtasks_ = 0;
477484
spare_ = NULL;
478485
last_handle_before_deferred_block_ = NULL;
479486
call_depth_ = 0;
@@ -508,6 +515,7 @@ class HandleScopeImplementer {
508515
int call_depth_;
509516
int microtasks_depth_;
510517
int microtasks_suppressions_;
518+
int entered_context_count_during_microtasks_;
511519
#ifdef DEBUG
512520
int debug_microtasks_depth_;
513521
#endif
@@ -579,11 +587,13 @@ Handle<Context> HandleScopeImplementer::LastEnteredContext() {
579587
void HandleScopeImplementer::EnterMicrotaskContext(Handle<Context> context) {
580588
DCHECK(!microtask_context_);
581589
microtask_context_ = *context;
590+
entered_context_count_during_microtasks_ = entered_contexts_.length();
582591
}
583592

584593
void HandleScopeImplementer::LeaveMicrotaskContext() {
585594
DCHECK(microtask_context_);
586595
microtask_context_ = nullptr;
596+
entered_context_count_during_microtasks_ = 0;
587597
}
588598

589599
Handle<Context> HandleScopeImplementer::MicrotaskContext() {

deps/v8/src/builtins/builtins.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,12 @@ bool Builtins::AllowDynamicFunction(Isolate* isolate, Handle<JSFunction> target,
280280
Handle<JSObject> target_global_proxy) {
281281
if (FLAG_allow_unsafe_function_constructor) return true;
282282
HandleScopeImplementer* impl = isolate->handle_scope_implementer();
283-
Handle<Context> responsible_context = impl->LastEnteredContext();
283+
Handle<Context> responsible_context =
284+
impl->MicrotaskContextIsLastEnteredContext() ? impl->MicrotaskContext()
285+
: impl->LastEnteredContext();
286+
// TODO(jochen): Remove this.
284287
if (responsible_context.is_null()) {
285-
responsible_context = impl->MicrotaskContext();
286-
// TODO(jochen): Remove this.
287-
if (responsible_context.is_null()) {
288-
return true;
289-
}
288+
return true;
290289
}
291290
if (*responsible_context == target->context()) return true;
292291
return isolate->MayAccess(responsible_context, target_global_proxy);

deps/v8/src/compiler/access-info.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
312312
isolate());
313313
dependencies()->AssumeFieldType(field_owner_map);
314314
}
315-
DCHECK(field_type->Is(Type::TaggedPointer()));
315+
if (access_mode == AccessMode::kLoad) {
316+
field_type = Type::Any();
317+
}
316318
}
317319
*access_info = PropertyAccessInfo::DataField(
318320
MapList{receiver_map}, field_index, field_type, holder);

deps/v8/src/compiler/arm/code-generator-arm.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,10 +1878,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
18781878
case Constant::kHeapObject: {
18791879
Handle<HeapObject> src_object = src.ToHeapObject();
18801880
Heap::RootListIndex index;
1881-
int slot;
1882-
if (IsMaterializableFromFrame(src_object, &slot)) {
1883-
__ ldr(dst, g.SlotToMemOperand(slot));
1884-
} else if (IsMaterializableFromRoot(src_object, &index)) {
1881+
if (IsMaterializableFromRoot(src_object, &index)) {
18851882
__ LoadRoot(dst, index);
18861883
} else {
18871884
__ Move(dst, src_object);

deps/v8/src/compiler/arm64/code-generator-arm64.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,10 +1939,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
19391939
if (src.type() == Constant::kHeapObject) {
19401940
Handle<HeapObject> src_object = src.ToHeapObject();
19411941
Heap::RootListIndex index;
1942-
int slot;
1943-
if (IsMaterializableFromFrame(src_object, &slot)) {
1944-
__ Ldr(dst, g.SlotToMemOperand(slot, masm()));
1945-
} else if (IsMaterializableFromRoot(src_object, &index)) {
1942+
if (IsMaterializableFromRoot(src_object, &index)) {
19461943
__ LoadRoot(dst, index);
19471944
} else {
19481945
__ LoadObject(dst, src_object);

deps/v8/src/compiler/ast-loop-assignment-analyzer.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,12 @@ void ALAA::VisitForStatement(ForStatement* loop) {
252252

253253

254254
void ALAA::VisitForInStatement(ForInStatement* loop) {
255+
Expression* l = loop->each();
255256
Enter(loop);
256-
Visit(loop->each());
257+
Visit(l);
257258
Visit(loop->subject());
258259
Visit(loop->body());
260+
if (l->IsVariableProxy()) AnalyzeAssignment(l->AsVariableProxy()->var());
259261
Exit(loop);
260262
}
261263

deps/v8/src/compiler/code-generator.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -278,21 +278,6 @@ void CodeGenerator::RecordSafepoint(ReferenceMap* references,
278278
}
279279
}
280280

281-
bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
282-
int* slot_return) {
283-
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
284-
if (object.is_identical_to(info()->context()) && !info()->is_osr()) {
285-
*slot_return = Frame::kContextSlot;
286-
return true;
287-
} else if (object.is_identical_to(info()->closure())) {
288-
*slot_return = Frame::kJSFunctionSlot;
289-
return true;
290-
}
291-
}
292-
return false;
293-
}
294-
295-
296281
bool CodeGenerator::IsMaterializableFromRoot(
297282
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
298283
const CallDescriptor* incoming_descriptor =

deps/v8/src/compiler/code-generator.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ class CodeGenerator final : public GapResolver::Assembler {
8484
void RecordSafepoint(ReferenceMap* references, Safepoint::Kind kind,
8585
int arguments, Safepoint::DeoptMode deopt_mode);
8686

87-
// Check if a heap object can be materialized by loading from the frame, which
88-
// is usually way cheaper than materializing the actual heap object constant.
89-
bool IsMaterializableFromFrame(Handle<HeapObject> object, int* slot_return);
9087
// Check if a heap object can be materialized by loading from a heap root,
9188
// which is cheaper on some platforms than materializing the actual heap
9289
// object constant.

deps/v8/src/compiler/ia32/code-generator-ia32.cc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,18 +2040,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
20402040
Constant src_constant = g.ToConstant(source);
20412041
if (src_constant.type() == Constant::kHeapObject) {
20422042
Handle<HeapObject> src = src_constant.ToHeapObject();
2043-
int slot;
2044-
if (IsMaterializableFromFrame(src, &slot)) {
2045-
if (destination->IsRegister()) {
2046-
Register dst = g.ToRegister(destination);
2047-
__ mov(dst, g.SlotToOperand(slot));
2048-
} else {
2049-
DCHECK(destination->IsStackSlot());
2050-
Operand dst = g.ToOperand(destination);
2051-
__ push(g.SlotToOperand(slot));
2052-
__ pop(dst);
2053-
}
2054-
} else if (destination->IsRegister()) {
2043+
if (destination->IsRegister()) {
20552044
Register dst = g.ToRegister(destination);
20562045
__ LoadHeapObject(dst, src);
20572046
} else {

deps/v8/src/compiler/mips/code-generator-mips.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,10 +2013,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
20132013
case Constant::kHeapObject: {
20142014
Handle<HeapObject> src_object = src.ToHeapObject();
20152015
Heap::RootListIndex index;
2016-
int slot;
2017-
if (IsMaterializableFromFrame(src_object, &slot)) {
2018-
__ lw(dst, g.SlotToMemOperand(slot));
2019-
} else if (IsMaterializableFromRoot(src_object, &index)) {
2016+
if (IsMaterializableFromRoot(src_object, &index)) {
20202017
__ LoadRoot(dst, index);
20212018
} else {
20222019
__ li(dst, src_object);

deps/v8/src/compiler/mips64/code-generator-mips64.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,10 +2335,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
23352335
case Constant::kHeapObject: {
23362336
Handle<HeapObject> src_object = src.ToHeapObject();
23372337
Heap::RootListIndex index;
2338-
int slot;
2339-
if (IsMaterializableFromFrame(src_object, &slot)) {
2340-
__ ld(dst, g.SlotToMemOperand(slot));
2341-
} else if (IsMaterializableFromRoot(src_object, &index)) {
2338+
if (IsMaterializableFromRoot(src_object, &index)) {
23422339
__ LoadRoot(dst, index);
23432340
} else {
23442341
__ li(dst, src_object);

deps/v8/src/compiler/ppc/code-generator-ppc.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,10 +2277,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
22772277
case Constant::kHeapObject: {
22782278
Handle<HeapObject> src_object = src.ToHeapObject();
22792279
Heap::RootListIndex index;
2280-
int slot;
2281-
if (IsMaterializableFromFrame(src_object, &slot)) {
2282-
__ LoadP(dst, g.SlotToMemOperand(slot));
2283-
} else if (IsMaterializableFromRoot(src_object, &index)) {
2280+
if (IsMaterializableFromRoot(src_object, &index)) {
22842281
__ LoadRoot(dst, index);
22852282
} else {
22862283
__ Move(dst, src_object);

deps/v8/src/compiler/s390/code-generator-s390.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,10 +2382,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
23822382
case Constant::kHeapObject: {
23832383
Handle<HeapObject> src_object = src.ToHeapObject();
23842384
Heap::RootListIndex index;
2385-
int slot;
2386-
if (IsMaterializableFromFrame(src_object, &slot)) {
2387-
__ LoadP(dst, g.SlotToMemOperand(slot));
2388-
} else if (IsMaterializableFromRoot(src_object, &index)) {
2385+
if (IsMaterializableFromRoot(src_object, &index)) {
23892386
__ LoadRoot(dst, index);
23902387
} else {
23912388
__ Move(dst, src_object);

deps/v8/src/compiler/x64/code-generator-x64.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,10 +2477,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
24772477
case Constant::kHeapObject: {
24782478
Handle<HeapObject> src_object = src.ToHeapObject();
24792479
Heap::RootListIndex index;
2480-
int slot;
2481-
if (IsMaterializableFromFrame(src_object, &slot)) {
2482-
__ movp(dst, g.SlotToOperand(slot));
2483-
} else if (IsMaterializableFromRoot(src_object, &index)) {
2480+
if (IsMaterializableFromRoot(src_object, &index)) {
24842481
__ LoadRoot(dst, index);
24852482
} else {
24862483
__ Move(dst, src_object);

deps/v8/src/compiler/x87/code-generator-x87.cc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,18 +2520,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
25202520
Constant src_constant = g.ToConstant(source);
25212521
if (src_constant.type() == Constant::kHeapObject) {
25222522
Handle<HeapObject> src = src_constant.ToHeapObject();
2523-
int slot;
2524-
if (IsMaterializableFromFrame(src, &slot)) {
2525-
if (destination->IsRegister()) {
2526-
Register dst = g.ToRegister(destination);
2527-
__ mov(dst, g.SlotToOperand(slot));
2528-
} else {
2529-
DCHECK(destination->IsStackSlot());
2530-
Operand dst = g.ToOperand(destination);
2531-
__ push(g.SlotToOperand(slot));
2532-
__ pop(dst);
2533-
}
2534-
} else if (destination->IsRegister()) {
2523+
if (destination->IsRegister()) {
25352524
Register dst = g.ToRegister(destination);
25362525
__ LoadHeapObject(dst, src);
25372526
} else {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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.x === a.y;
9+
}
10+
11+
function A() { }
12+
13+
var o = new A;
14+
15+
var a = {x: o}
16+
o.x = 0;
17+
a.y = o;
18+
19+
assertTrue(foo(a));
20+
assertTrue(foo(a));
21+
%OptimizeFunctionOnNextCall(foo);
22+
assertTrue(foo(a));
Lines changed: 14 additions & 0 deletions
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+
function f(obj) {
8+
var key;
9+
for (key in obj) { }
10+
return key === undefined;
11+
}
12+
13+
%OptimizeFunctionOnNextCall(f);
14+
assertFalse(f({ foo:0 }));
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 --harmony-tailcalls
6+
7+
function f() {
8+
"use strict";
9+
return undefined(0, 0);
10+
}
11+
function g() {
12+
return f();
13+
}
14+
assertThrows(g, TypeError);
15+
assertThrows(g, TypeError);
16+
%OptimizeFunctionOnNextCall(g);
17+
assertThrows(g, TypeError);

0 commit comments

Comments
 (0)