Skip to content

Commit b6000d8

Browse files
committed
deps: patch V8 to 6.4.388.44
PR-URL: #18687 Refs: v8/v8@6.4.388.42...6.4.388.44 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 6abce37 commit b6000d8

File tree

7 files changed

+77
-36
lines changed

7 files changed

+77
-36
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 6
1212
#define V8_MINOR_VERSION 4
1313
#define V8_BUILD_NUMBER 388
14-
#define V8_PATCH_LEVEL 42
14+
#define V8_PATCH_LEVEL 44
1515

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

deps/v8/src/objects-inl.h

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,16 +2231,18 @@ int Map::NumberOfOwnDescriptors() const {
22312231

22322232

22332233
void Map::SetNumberOfOwnDescriptors(int number) {
2234-
DCHECK(number <= instance_descriptors()->number_of_descriptors());
2234+
CHECK_LE(static_cast<unsigned>(number),
2235+
static_cast<unsigned>(kMaxNumberOfDescriptors));
22352236
set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
22362237
}
22372238

22382239
int Map::EnumLength() const { return EnumLengthBits::decode(bit_field3()); }
22392240

22402241
void Map::SetEnumLength(int length) {
22412242
if (length != kInvalidEnumCacheSentinel) {
2242-
DCHECK_GE(length, 0);
2243-
DCHECK(length <= NumberOfOwnDescriptors());
2243+
DCHECK_LE(length, NumberOfOwnDescriptors());
2244+
CHECK_LE(static_cast<unsigned>(length),
2245+
static_cast<unsigned>(kMaxNumberOfDescriptors));
22442246
}
22452247
set_bit_field3(EnumLengthBits::update(bit_field3(), length));
22462248
}
@@ -3002,9 +3004,9 @@ int Map::instance_size() const {
30023004
}
30033005

30043006
void Map::set_instance_size(int value) {
3005-
DCHECK_EQ(0, value & (kPointerSize - 1));
3007+
CHECK_EQ(0, value & (kPointerSize - 1));
30063008
value >>= kPointerSizeLog2;
3007-
DCHECK(0 <= value && value < 256);
3009+
CHECK_LT(static_cast<unsigned>(value), 256);
30083010
set_instance_size_in_words(value);
30093011
}
30103012

@@ -3015,8 +3017,7 @@ int Map::inobject_properties_start_or_constructor_function_index() const {
30153017

30163018
void Map::set_inobject_properties_start_or_constructor_function_index(
30173019
int value) {
3018-
DCHECK_LE(0, value);
3019-
DCHECK_LT(value, 256);
3020+
CHECK_LT(static_cast<unsigned>(value), 256);
30203021
RELAXED_WRITE_BYTE_FIELD(
30213022
this, kInObjectPropertiesStartOrConstructorFunctionIndexOffset,
30223023
static_cast<byte>(value));
@@ -3028,7 +3029,7 @@ int Map::GetInObjectPropertiesStartInWords() const {
30283029
}
30293030

30303031
void Map::SetInObjectPropertiesStartInWords(int value) {
3031-
DCHECK(IsJSObjectMap());
3032+
CHECK(IsJSObjectMap());
30323033
set_inobject_properties_start_or_constructor_function_index(value);
30333034
}
30343035

@@ -3044,7 +3045,7 @@ int Map::GetConstructorFunctionIndex() const {
30443045

30453046

30463047
void Map::SetConstructorFunctionIndex(int value) {
3047-
DCHECK(IsPrimitiveMap());
3048+
CHECK(IsPrimitiveMap());
30483049
set_inobject_properties_start_or_constructor_function_index(value);
30493050
}
30503051

@@ -3153,8 +3154,7 @@ int Map::used_or_unused_instance_size_in_words() const {
31533154
}
31543155

31553156
void Map::set_used_or_unused_instance_size_in_words(int value) {
3156-
DCHECK_LE(0, value);
3157-
DCHECK_LE(value, 255);
3157+
CHECK_LE(static_cast<unsigned>(value), 255);
31583158
WRITE_BYTE_FIELD(this, kUsedOrUnusedInstanceSizeInWordsOffset,
31593159
static_cast<byte>(value));
31603160
}
@@ -3172,12 +3172,12 @@ int Map::UsedInstanceSize() const {
31723172
void Map::SetInObjectUnusedPropertyFields(int value) {
31733173
STATIC_ASSERT(JSObject::kFieldsAdded == JSObject::kHeaderSize / kPointerSize);
31743174
if (!IsJSObjectMap()) {
3175-
DCHECK_EQ(0, value);
3175+
CHECK_EQ(0, value);
31763176
set_used_or_unused_instance_size_in_words(0);
31773177
DCHECK_EQ(0, UnusedPropertyFields());
31783178
return;
31793179
}
3180-
DCHECK_LE(0, value);
3180+
CHECK_LE(0, value);
31813181
DCHECK_LE(value, GetInObjectProperties());
31823182
int used_inobject_properties = GetInObjectProperties() - value;
31833183
set_used_or_unused_instance_size_in_words(
@@ -3187,8 +3187,7 @@ void Map::SetInObjectUnusedPropertyFields(int value) {
31873187

31883188
void Map::SetOutOfObjectUnusedPropertyFields(int value) {
31893189
STATIC_ASSERT(JSObject::kFieldsAdded == JSObject::kHeaderSize / kPointerSize);
3190-
DCHECK_LE(0, value);
3191-
DCHECK_LT(value, JSObject::kFieldsAdded);
3190+
CHECK_LT(static_cast<unsigned>(value), JSObject::kFieldsAdded);
31923191
// For out of object properties "used_instance_size_in_words" byte encodes
31933192
// the slack in the property array.
31943193
set_used_or_unused_instance_size_in_words(value);
@@ -3227,8 +3226,8 @@ void Map::AccountAddedOutOfObjectPropertyField(int unused_in_property_array) {
32273226
if (unused_in_property_array < 0) {
32283227
unused_in_property_array += JSObject::kFieldsAdded;
32293228
}
3230-
DCHECK_GE(unused_in_property_array, 0);
3231-
DCHECK_LT(unused_in_property_array, JSObject::kFieldsAdded);
3229+
CHECK_LT(static_cast<unsigned>(unused_in_property_array),
3230+
JSObject::kFieldsAdded);
32323231
set_used_or_unused_instance_size_in_words(unused_in_property_array);
32333232
DCHECK_EQ(unused_in_property_array, UnusedPropertyFields());
32343233
}
@@ -3358,7 +3357,7 @@ bool Map::should_be_fast_prototype_map() const {
33583357
}
33593358

33603359
void Map::set_elements_kind(ElementsKind elements_kind) {
3361-
DCHECK_LT(static_cast<int>(elements_kind), kElementsKindCount);
3360+
CHECK_LT(static_cast<int>(elements_kind), kElementsKindCount);
33623361
DCHECK_LE(kElementsKindCount, 1 << Map::ElementsKindBits::kSize);
33633362
set_bit_field2(Map::ElementsKindBits::update(bit_field2(), elements_kind));
33643363
DCHECK(this->elements_kind() == elements_kind);
@@ -3700,19 +3699,19 @@ Object* Map::prototype_info() const {
37003699

37013700

37023701
void Map::set_prototype_info(Object* value, WriteBarrierMode mode) {
3703-
DCHECK(is_prototype_map());
3702+
CHECK(is_prototype_map());
37043703
WRITE_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset, value);
37053704
CONDITIONAL_WRITE_BARRIER(
37063705
GetHeap(), this, Map::kTransitionsOrPrototypeInfoOffset, value, mode);
37073706
}
37083707

37093708

37103709
void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
3711-
DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE);
3712-
DCHECK(value->IsMap());
3713-
DCHECK(GetBackPointer()->IsUndefined(GetIsolate()));
3714-
DCHECK(!value->IsMap() ||
3715-
Map::cast(value)->GetConstructor() == constructor_or_backpointer());
3710+
CHECK_GE(instance_type(), FIRST_JS_RECEIVER_TYPE);
3711+
CHECK(value->IsMap());
3712+
CHECK(GetBackPointer()->IsUndefined(GetIsolate()));
3713+
CHECK_IMPLIES(value->IsMap(), Map::cast(value)->GetConstructor() ==
3714+
constructor_or_backpointer());
37163715
set_constructor_or_backpointer(value, mode);
37173716
}
37183717

@@ -3743,7 +3742,7 @@ FunctionTemplateInfo* Map::GetFunctionTemplateInfo() const {
37433742

37443743
void Map::SetConstructor(Object* constructor, WriteBarrierMode mode) {
37453744
// Never overwrite a back pointer with a constructor.
3746-
DCHECK(!constructor_or_backpointer()->IsMap());
3745+
CHECK(!constructor_or_backpointer()->IsMap());
37473746
set_constructor_or_backpointer(constructor, mode);
37483747
}
37493748

deps/v8/src/objects.cc

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13014,14 +13014,19 @@ MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate,
1301413014
constructor_initial_map->UnusedPropertyFields();
1301513015
int instance_size;
1301613016
int in_object_properties;
13017-
CalculateInstanceSizeForDerivedClass(function, instance_type,
13018-
embedder_fields, &instance_size,
13019-
&in_object_properties);
13017+
bool success = CalculateInstanceSizeForDerivedClass(
13018+
function, instance_type, embedder_fields, &instance_size,
13019+
&in_object_properties);
1302013020

1302113021
int unused_property_fields = in_object_properties - pre_allocated;
13022-
Handle<Map> map =
13023-
Map::CopyInitialMap(constructor_initial_map, instance_size,
13024-
in_object_properties, unused_property_fields);
13022+
13023+
Handle<Map> map;
13024+
if (success) {
13025+
map = Map::CopyInitialMap(constructor_initial_map, instance_size,
13026+
in_object_properties, unused_property_fields);
13027+
} else {
13028+
map = Map::CopyInitialMap(constructor_initial_map);
13029+
}
1302513030
map->set_new_target_is_base(false);
1302613031

1302713032
JSFunction::SetInitialMap(function, map, prototype);
@@ -13726,12 +13731,14 @@ void JSFunction::CalculateInstanceSizeHelper(InstanceType instance_type,
1372613731
requested_embedder_fields;
1372713732
}
1372813733

13729-
void JSFunction::CalculateInstanceSizeForDerivedClass(
13734+
// static
13735+
bool JSFunction::CalculateInstanceSizeForDerivedClass(
1373013736
Handle<JSFunction> function, InstanceType instance_type,
1373113737
int requested_embedder_fields, int* instance_size,
1373213738
int* in_object_properties) {
1373313739
Isolate* isolate = function->GetIsolate();
1373413740
int expected_nof_properties = 0;
13741+
bool result = true;
1373513742
for (PrototypeIterator iter(isolate, function, kStartAtReceiver);
1373613743
!iter.IsAtEnd(); iter.Advance()) {
1373713744
Handle<JSReceiver> current =
@@ -13745,6 +13752,11 @@ void JSFunction::CalculateInstanceSizeForDerivedClass(
1374513752
Compiler::Compile(func, Compiler::CLEAR_EXCEPTION)) {
1374613753
DCHECK(shared->is_compiled());
1374713754
expected_nof_properties += shared->expected_nof_properties();
13755+
} else if (!shared->is_compiled()) {
13756+
// In case there was a compilation error for the constructor we will
13757+
// throw an error during instantiation. Hence we directly return 0;
13758+
result = false;
13759+
break;
1374813760
}
1374913761
if (!IsDerivedConstructor(shared->kind())) {
1375013762
break;
@@ -13753,6 +13765,7 @@ void JSFunction::CalculateInstanceSizeForDerivedClass(
1375313765
CalculateInstanceSizeHelper(instance_type, true, requested_embedder_fields,
1375413766
expected_nof_properties, instance_size,
1375513767
in_object_properties);
13768+
return result;
1375613769
}
1375713770

1375813771

deps/v8/src/objects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4082,7 +4082,7 @@ class JSFunction: public JSObject {
40824082
DECL_CAST(JSFunction)
40834083

40844084
// Calculate the instance size and in-object properties count.
4085-
static void CalculateInstanceSizeForDerivedClass(
4085+
static bool CalculateInstanceSizeForDerivedClass(
40864086
Handle<JSFunction> function, InstanceType instance_type,
40874087
int requested_embedder_fields, int* instance_size,
40884088
int* in_object_properties);

deps/v8/src/profiler/heap-snapshot-generator.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,6 @@ void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) {
11131113
constructor_or_backpointer,
11141114
Map::kConstructorOrBackPointerOffset);
11151115
} else {
1116-
DCHECK(constructor_or_backpointer->IsJSFunction() ||
1117-
constructor_or_backpointer->IsNull(map->GetIsolate()));
11181116
SetInternalReference(map, entry, "constructor", constructor_or_backpointer,
11191117
Map::kConstructorOrBackPointerOffset);
11201118
}

deps/v8/test/cctest/test-heap-profiler.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,3 +3184,14 @@ TEST(SamplingHeapProfilerSampleDuringDeopt) {
31843184
CHECK(profile);
31853185
heap_profiler->StopSamplingHeapProfiler();
31863186
}
3187+
3188+
TEST(HeapSnapshotPrototypeNotJSReceiver) {
3189+
LocalContext env;
3190+
v8::HandleScope scope(env->GetIsolate());
3191+
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
3192+
CompileRun(
3193+
"function object() {}"
3194+
"object.prototype = 42;");
3195+
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
3196+
CHECK(ValidateSnapshot(snapshot));
3197+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: --allow-natives-syntax --enable-slow-asserts --expose-gc
6+
7+
class Derived extends Array {
8+
constructor(a) {
9+
// Syntax Error.
10+
const a = 1;
11+
}
12+
}
13+
14+
// Derived is not a subclass of RegExp
15+
let o = Reflect.construct(RegExp, [], Derived);
16+
o.lastIndex = 0x1234;
17+
%HeapObjectVerify(o);
18+
19+
gc();
20+
%HeapObjectVerify(o);

0 commit comments

Comments
 (0)