Skip to content

Commit 0a7bf81

Browse files
committed
deps: update V8 to 4.2.77.21
Picks up the latest patch-release on the V8 4.2 branch. https://codereview.chromium.org/1156323004 PR-URL: #2238 Fixes: #2235 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent bf2cd22 commit 0a7bf81

15 files changed

+121
-198
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 4
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 77
14-
#define V8_PATCH_LEVEL 20
14+
#define V8_PATCH_LEVEL 21
1515

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

deps/v8/src/arm/full-codegen-arm.cc

+10-23
Original file line numberDiff line numberDiff line change
@@ -1691,21 +1691,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
16911691
__ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
16921692
__ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
16931693
__ mov(r1, Operand(constant_properties));
1694-
int flags = expr->fast_elements()
1695-
? ObjectLiteral::kFastElements
1696-
: ObjectLiteral::kNoFlags;
1697-
flags |= expr->has_function()
1698-
? ObjectLiteral::kHasFunction
1699-
: ObjectLiteral::kNoFlags;
1694+
int flags = expr->ComputeFlags();
17001695
__ mov(r0, Operand(Smi::FromInt(flags)));
1701-
int properties_count = constant_properties->length() / 2;
1702-
if (expr->may_store_doubles() || expr->depth() > 1 ||
1703-
masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1704-
properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1696+
if (MustCreateObjectLiteralWithRuntime(expr)) {
17051697
__ Push(r3, r2, r1, r0);
17061698
__ CallRuntime(Runtime::kCreateObjectLiteral, 4);
17071699
} else {
1708-
FastCloneShallowObjectStub stub(isolate(), properties_count);
1700+
FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
17091701
__ CallStub(&stub);
17101702
}
17111703
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
@@ -1897,17 +1889,10 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
18971889
Comment cmnt(masm_, "[ ArrayLiteral");
18981890

18991891
expr->BuildConstantElements(isolate());
1900-
int flags = expr->depth() == 1
1901-
? ArrayLiteral::kShallowElements
1902-
: ArrayLiteral::kNoFlags;
19031892

1904-
ZoneList<Expression*>* subexprs = expr->values();
1905-
int length = subexprs->length();
19061893
Handle<FixedArray> constant_elements = expr->constant_elements();
1907-
DCHECK_EQ(2, constant_elements->length());
1908-
ElementsKind constant_elements_kind =
1909-
static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1910-
bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
1894+
bool has_fast_elements =
1895+
IsFastObjectElementsKind(expr->constant_elements_kind());
19111896
Handle<FixedArrayBase> constant_elements_values(
19121897
FixedArrayBase::cast(constant_elements->get(1)));
19131898

@@ -1922,8 +1907,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19221907
__ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
19231908
__ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
19241909
__ mov(r1, Operand(constant_elements));
1925-
if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
1926-
__ mov(r0, Operand(Smi::FromInt(flags)));
1910+
if (MustCreateArrayLiteralWithRuntime(expr)) {
1911+
__ mov(r0, Operand(Smi::FromInt(expr->ComputeFlags())));
19271912
__ Push(r3, r2, r1, r0);
19281913
__ CallRuntime(Runtime::kCreateArrayLiteral, 4);
19291914
} else {
@@ -1933,6 +1918,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19331918
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
19341919

19351920
bool result_saved = false; // Is the result saved to the stack?
1921+
ZoneList<Expression*>* subexprs = expr->values();
1922+
int length = subexprs->length();
19361923

19371924
// Emit code to evaluate all the non-constant subexpressions and to store
19381925
// them into the newly cloned array.
@@ -1949,7 +1936,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19491936
}
19501937
VisitForAccumulatorValue(subexpr);
19511938

1952-
if (IsFastObjectElementsKind(constant_elements_kind)) {
1939+
if (has_fast_elements) {
19531940
int offset = FixedArray::kHeaderSize + (i * kPointerSize);
19541941
__ ldr(r6, MemOperand(sp, kPointerSize)); // Copy of array literal.
19551942
__ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset));

deps/v8/src/arm64/full-codegen-arm64.cc

+10-27
Original file line numberDiff line numberDiff line change
@@ -1670,23 +1670,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
16701670
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset));
16711671
__ Mov(x2, Smi::FromInt(expr->literal_index()));
16721672
__ Mov(x1, Operand(constant_properties));
1673-
int flags = expr->fast_elements()
1674-
? ObjectLiteral::kFastElements
1675-
: ObjectLiteral::kNoFlags;
1676-
flags |= expr->has_function()
1677-
? ObjectLiteral::kHasFunction
1678-
: ObjectLiteral::kNoFlags;
1673+
int flags = expr->ComputeFlags();
16791674
__ Mov(x0, Smi::FromInt(flags));
1680-
int properties_count = constant_properties->length() / 2;
1681-
const int max_cloned_properties =
1682-
FastCloneShallowObjectStub::kMaximumClonedProperties;
1683-
if (expr->may_store_doubles() || expr->depth() > 1 ||
1684-
masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
1685-
properties_count > max_cloned_properties) {
1675+
if (MustCreateObjectLiteralWithRuntime(expr)) {
16861676
__ Push(x3, x2, x1, x0);
16871677
__ CallRuntime(Runtime::kCreateObjectLiteral, 4);
16881678
} else {
1689-
FastCloneShallowObjectStub stub(isolate(), properties_count);
1679+
FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
16901680
__ CallStub(&stub);
16911681
}
16921682
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
@@ -1878,18 +1868,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
18781868
Comment cmnt(masm_, "[ ArrayLiteral");
18791869

18801870
expr->BuildConstantElements(isolate());
1881-
int flags = (expr->depth() == 1) ? ArrayLiteral::kShallowElements
1882-
: ArrayLiteral::kNoFlags;
1883-
1884-
ZoneList<Expression*>* subexprs = expr->values();
1885-
int length = subexprs->length();
18861871
Handle<FixedArray> constant_elements = expr->constant_elements();
1887-
DCHECK_EQ(2, constant_elements->length());
1888-
ElementsKind constant_elements_kind =
1889-
static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
1890-
bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
1891-
Handle<FixedArrayBase> constant_elements_values(
1892-
FixedArrayBase::cast(constant_elements->get(1)));
1872+
bool has_fast_elements =
1873+
IsFastObjectElementsKind(expr->constant_elements_kind());
18931874

18941875
AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
18951876
if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
@@ -1902,8 +1883,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19021883
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset));
19031884
__ Mov(x2, Smi::FromInt(expr->literal_index()));
19041885
__ Mov(x1, Operand(constant_elements));
1905-
if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
1906-
__ Mov(x0, Smi::FromInt(flags));
1886+
if (MustCreateArrayLiteralWithRuntime(expr)) {
1887+
__ Mov(x0, Smi::FromInt(expr->ComputeFlags()));
19071888
__ Push(x3, x2, x1, x0);
19081889
__ CallRuntime(Runtime::kCreateArrayLiteral, 4);
19091890
} else {
@@ -1913,6 +1894,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19131894
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
19141895

19151896
bool result_saved = false; // Is the result saved to the stack?
1897+
ZoneList<Expression*>* subexprs = expr->values();
1898+
int length = subexprs->length();
19161899

19171900
// Emit code to evaluate all the non-constant subexpressions and to store
19181901
// them into the newly cloned array.
@@ -1929,7 +1912,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
19291912
}
19301913
VisitForAccumulatorValue(subexpr);
19311914

1932-
if (IsFastObjectElementsKind(constant_elements_kind)) {
1915+
if (has_fast_elements) {
19331916
int offset = FixedArray::kHeaderSize + (i * kPointerSize);
19341917
__ Peek(x6, kPointerSize); // Copy of array literal.
19351918
__ Ldr(x1, FieldMemOperand(x6, JSObject::kElementsOffset));

deps/v8/src/ast.cc

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
334334
constant_properties_ = constant_properties;
335335
fast_elements_ =
336336
(max_element_index <= 32) || ((2 * elements) >= max_element_index);
337+
has_elements_ = elements > 0;
337338
set_is_simple(is_simple);
338339
set_depth(depth_acc);
339340
}

deps/v8/src/ast.h

+20-4
Original file line numberDiff line numberDiff line change
@@ -1457,10 +1457,12 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
14571457
Handle<FixedArray> constant_properties() const {
14581458
return constant_properties_;
14591459
}
1460+
int properties_count() const { return constant_properties_->length() / 2; }
14601461
ZoneList<Property*>* properties() const { return properties_; }
14611462
bool fast_elements() const { return fast_elements_; }
14621463
bool may_store_doubles() const { return may_store_doubles_; }
14631464
bool has_function() const { return has_function_; }
1465+
bool has_elements() const { return has_elements_; }
14641466

14651467
// Decide if a property should be in the object boilerplate.
14661468
static bool IsBoilerplateProperty(Property* property);
@@ -1474,16 +1476,20 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
14741476
void CalculateEmitStore(Zone* zone);
14751477

14761478
// Assemble bitfield of flags for the CreateObjectLiteral helper.
1477-
int ComputeFlags() const {
1479+
int ComputeFlags(bool disable_mementos = false) const {
14781480
int flags = fast_elements() ? kFastElements : kNoFlags;
14791481
flags |= has_function() ? kHasFunction : kNoFlags;
1482+
if (disable_mementos) {
1483+
flags |= kDisableMementos;
1484+
}
14801485
return flags;
14811486
}
14821487

14831488
enum Flags {
14841489
kNoFlags = 0,
14851490
kFastElements = 1,
1486-
kHasFunction = 1 << 1
1491+
kHasFunction = 1 << 1,
1492+
kDisableMementos = 1 << 2
14871493
};
14881494

14891495
struct Accessors: public ZoneObject {
@@ -1508,6 +1514,7 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
15081514
properties_(properties),
15091515
boilerplate_properties_(boilerplate_properties),
15101516
fast_elements_(false),
1517+
has_elements_(false),
15111518
may_store_doubles_(false),
15121519
has_function_(has_function) {}
15131520
static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
@@ -1518,6 +1525,7 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
15181525
ZoneList<Property*>* properties_;
15191526
int boilerplate_properties_;
15201527
bool fast_elements_;
1528+
bool has_elements_;
15211529
bool may_store_doubles_;
15221530
bool has_function_;
15231531
};
@@ -1553,6 +1561,12 @@ class ArrayLiteral FINAL : public MaterializedLiteral {
15531561
DECLARE_NODE_TYPE(ArrayLiteral)
15541562

15551563
Handle<FixedArray> constant_elements() const { return constant_elements_; }
1564+
ElementsKind constant_elements_kind() const {
1565+
DCHECK_EQ(2, constant_elements_->length());
1566+
return static_cast<ElementsKind>(
1567+
Smi::cast(constant_elements_->get(0))->value());
1568+
}
1569+
15561570
ZoneList<Expression*>* values() const { return values_; }
15571571

15581572
BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
@@ -1568,9 +1582,11 @@ class ArrayLiteral FINAL : public MaterializedLiteral {
15681582
void BuildConstantElements(Isolate* isolate);
15691583

15701584
// Assemble bitfield of flags for the CreateArrayLiteral helper.
1571-
int ComputeFlags() const {
1585+
int ComputeFlags(bool disable_mementos = false) const {
15721586
int flags = depth() == 1 ? kShallowElements : kNoFlags;
1573-
flags |= ArrayLiteral::kDisableMementos;
1587+
if (disable_mementos) {
1588+
flags |= kDisableMementos;
1589+
}
15741590
return flags;
15751591
}
15761592

deps/v8/src/compiler/ast-graph-builder.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
14641464
BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
14651465
Node* literal_index = jsgraph()->Constant(expr->literal_index());
14661466
Node* constants = jsgraph()->Constant(expr->constant_properties());
1467-
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
1467+
Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
14681468
const Operator* op =
14691469
javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4);
14701470
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
@@ -1656,7 +1656,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
16561656
BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
16571657
Node* literal_index = jsgraph()->Constant(expr->literal_index());
16581658
Node* constants = jsgraph()->Constant(expr->constant_elements());
1659-
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
1659+
Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
16601660
const Operator* op =
16611661
javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4);
16621662
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);

deps/v8/src/full-codegen.cc

+21
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,27 @@ void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
415415
}
416416

417417

418+
bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime(
419+
ObjectLiteral* expr) const {
420+
// FastCloneShallowObjectStub doesn't copy elements, and object literals don't
421+
// support copy-on-write (COW) elements for now.
422+
// TODO(mvstanton): make object literals support COW elements.
423+
return expr->may_store_doubles() || expr->depth() > 1 ||
424+
masm()->serializer_enabled() ||
425+
expr->ComputeFlags() != ObjectLiteral::kFastElements ||
426+
expr->has_elements() ||
427+
expr->properties_count() >
428+
FastCloneShallowObjectStub::kMaximumClonedProperties;
429+
}
430+
431+
432+
bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime(
433+
ArrayLiteral* expr) const {
434+
return expr->depth() > 1 ||
435+
expr->values()->length() > JSObject::kInitialMaxFastElementArray;
436+
}
437+
438+
418439
void FullCodeGenerator::Initialize() {
419440
InitializeAstVisitor(info_->isolate(), info_->zone());
420441
// The generation of debug code must match between the snapshot code and the

deps/v8/src/full-codegen.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class FullCodeGenerator: public AstVisitor {
667667
loop_depth_--;
668668
}
669669

670-
MacroAssembler* masm() { return masm_; }
670+
MacroAssembler* masm() const { return masm_; }
671671

672672
class ExpressionContext;
673673
const ExpressionContext* context() { return context_; }
@@ -711,6 +711,9 @@ class FullCodeGenerator: public AstVisitor {
711711
void PopulateDeoptimizationData(Handle<Code> code);
712712
void PopulateTypeFeedbackInfo(Handle<Code> code);
713713

714+
bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const;
715+
bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const;
716+
714717
Handle<FixedArray> handler_table() { return handler_table_; }
715718

716719
struct BailoutEntry {

deps/v8/src/hydrogen.cc

+2-11
Original file line numberDiff line numberDiff line change
@@ -5551,19 +5551,13 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
55515551
Handle<FixedArray> closure_literals(closure->literals(), isolate());
55525552
Handle<FixedArray> constant_properties = expr->constant_properties();
55535553
int literal_index = expr->literal_index();
5554-
int flags = expr->fast_elements()
5555-
? ObjectLiteral::kFastElements : ObjectLiteral::kNoFlags;
5556-
flags |= expr->has_function()
5557-
? ObjectLiteral::kHasFunction : ObjectLiteral::kNoFlags;
5554+
int flags = expr->ComputeFlags(true);
55585555

55595556
Add<HPushArguments>(Add<HConstant>(closure_literals),
55605557
Add<HConstant>(literal_index),
55615558
Add<HConstant>(constant_properties),
55625559
Add<HConstant>(flags));
55635560

5564-
// TODO(mvstanton): Add a flag to turn off creation of any
5565-
// AllocationMementos for this call: we are in crankshaft and should have
5566-
// learned enough about transition behavior to stop emitting mementos.
55675561
Runtime::FunctionId function_id = Runtime::kCreateObjectLiteral;
55685562
literal = Add<HCallRuntime>(isolate()->factory()->empty_string(),
55695563
Runtime::FunctionForId(function_id),
@@ -5722,10 +5716,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
57225716
// pass an empty fixed array to the runtime function instead.
57235717
Handle<FixedArray> constants = isolate()->factory()->empty_fixed_array();
57245718
int literal_index = expr->literal_index();
5725-
int flags = expr->depth() == 1
5726-
? ArrayLiteral::kShallowElements
5727-
: ArrayLiteral::kNoFlags;
5728-
flags |= ArrayLiteral::kDisableMementos;
5719+
int flags = expr->ComputeFlags(true);
57295720

57305721
Add<HPushArguments>(Add<HConstant>(literals),
57315722
Add<HConstant>(literal_index),

0 commit comments

Comments
 (0)