Skip to content

Commit f9ce970

Browse files
committed
v8: Upgrade 3.26.33 with 14 patches
V8 3.26.31 has received 14 patches since the upgrade to 3.26.33. Since 3.26.33 is technically a tag on the 3.27 branch, reverting back to 3.26.31 would remove now default functionality like WeakMaps. Because of that the patches have simply been cherry-picked and squashed. Here is a summary of all patches: * Fix index register assignment in LoadFieldByIndex for arm, arm64, and mips. * Fix invalid attributes when generalizing because of incompatible map change. * Skip write barriers when updating the weak hash table. * MIPS: Avoid HeapObject check in HStoreNamedField. * Do GC if CodeRange fails to allocate a block. * Array.concat: properly go to dictionary mode when required. * Keep CodeRange::current_allocation_block_index_ in range. * Grow heap slower if GC freed many global handles. * Do not eliminate bounds checks for "<const> - x". * Add missing map check to optimized f.apply(...). * In GrowMode, force the value to the right representation to avoid deopts between storing the length and storing the value. * Reduce max executable size limit. * Fix invalid condition in check elimination effects. * Fix off-by-one error in Array.concat slow mode check. For more information see: https://github.com/v8/v8/commits/3.26 Reviewed-By: Fedor Indutny <fedor@indutny.com>
1 parent bf5e2f2 commit f9ce970

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+430
-356
lines changed

deps/v8/build/features.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
'Release': {
112112
'variables': {
113113
'v8_enable_extra_checks%': 0,
114-
'v8_enable_handle_zapping%': 0,
114+
'v8_enable_handle_zapping%': 1,
115115
},
116116
'conditions': [
117117
['v8_enable_extra_checks==1', {

deps/v8/include/v8.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,7 +2493,7 @@ class PropertyCallbackInfo {
24932493
public:
24942494
V8_INLINE Isolate* GetIsolate() const;
24952495
V8_INLINE Local<Value> Data() const;
2496-
V8_INLINE Local<Object> This() const;
2496+
V8_INLINE Local<Value> This() const;
24972497
V8_INLINE Local<Object> Holder() const;
24982498
V8_INLINE ReturnValue<T> GetReturnValue() const;
24992499
// This shouldn't be public, but the arm compiler needs it.
@@ -6488,8 +6488,8 @@ Local<Value> PropertyCallbackInfo<T>::Data() const {
64886488

64896489

64906490
template<typename T>
6491-
Local<Object> PropertyCallbackInfo<T>::This() const {
6492-
return Local<Object>(reinterpret_cast<Object*>(&args_[kThisIndex]));
6491+
Local<Value> PropertyCallbackInfo<T>::This() const {
6492+
return Local<Value>(reinterpret_cast<Value*>(&args_[kThisIndex]));
64936493
}
64946494

64956495

deps/v8/src/accessors.cc

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ namespace v8 {
2020
namespace internal {
2121

2222

23-
// We have a slight impedance mismatch between the external API and the way we
24-
// use callbacks internally: Externally, callbacks can only be used with
25-
// v8::Object, but internally we even have callbacks on entities which are
26-
// higher in the hierarchy, so we can only return i::Object here, not
27-
// i::JSObject.
28-
Handle<Object> GetThisFrom(const v8::PropertyCallbackInfo<v8::Value>& info) {
29-
return Utils::OpenHandle(*v8::Local<v8::Value>(info.This()));
30-
}
31-
32-
3323
Handle<AccessorInfo> Accessors::MakeAccessor(
3424
Isolate* isolate,
3525
Handle<String> name,
@@ -156,7 +146,7 @@ void Accessors::ArrayLengthGetter(
156146
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
157147
DisallowHeapAllocation no_allocation;
158148
HandleScope scope(isolate);
159-
Object* object = *GetThisFrom(info);
149+
Object* object = *Utils::OpenHandle(*info.This());
160150
// Traverse the prototype chain until we reach an array.
161151
JSArray* holder = FindInstanceOf<JSArray>(isolate, object);
162152
Object* result;
@@ -239,7 +229,7 @@ void Accessors::StringLengthGetter(
239229
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
240230
DisallowHeapAllocation no_allocation;
241231
HandleScope scope(isolate);
242-
Object* value = *GetThisFrom(info);
232+
Object* value = *Utils::OpenHandle(*info.This());
243233
Object* result;
244234
if (value->IsJSValue()) value = JSValue::cast(value)->value();
245235
if (value->IsString()) {
@@ -834,7 +824,7 @@ void Accessors::FunctionPrototypeGetter(
834824
const v8::PropertyCallbackInfo<v8::Value>& info) {
835825
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
836826
HandleScope scope(isolate);
837-
Handle<Object> object = GetThisFrom(info);
827+
Handle<Object> object = Utils::OpenHandle(*info.This());
838828
Handle<Object> result = GetFunctionPrototype(isolate, object);
839829
info.GetReturnValue().Set(Utils::ToLocal(result));
840830
}
@@ -874,7 +864,7 @@ void Accessors::FunctionLengthGetter(
874864
const v8::PropertyCallbackInfo<v8::Value>& info) {
875865
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
876866
HandleScope scope(isolate);
877-
Handle<Object> object = GetThisFrom(info);
867+
Handle<Object> object = Utils::OpenHandle(*info.This());
878868
MaybeHandle<JSFunction> maybe_function;
879869

880870
{
@@ -932,7 +922,7 @@ void Accessors::FunctionNameGetter(
932922
const v8::PropertyCallbackInfo<v8::Value>& info) {
933923
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
934924
HandleScope scope(isolate);
935-
Handle<Object> object = GetThisFrom(info);
925+
Handle<Object> object = Utils::OpenHandle(*info.This());
936926
MaybeHandle<JSFunction> maybe_function;
937927

938928
{
@@ -1081,7 +1071,7 @@ void Accessors::FunctionArgumentsGetter(
10811071
const v8::PropertyCallbackInfo<v8::Value>& info) {
10821072
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
10831073
HandleScope scope(isolate);
1084-
Handle<Object> object = GetThisFrom(info);
1074+
Handle<Object> object = Utils::OpenHandle(*info.This());
10851075
MaybeHandle<JSFunction> maybe_function;
10861076

10871077
{
@@ -1220,7 +1210,7 @@ void Accessors::FunctionCallerGetter(
12201210
const v8::PropertyCallbackInfo<v8::Value>& info) {
12211211
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
12221212
HandleScope scope(isolate);
1223-
Handle<Object> object = GetThisFrom(info);
1213+
Handle<Object> object = Utils::OpenHandle(*info.This());
12241214
MaybeHandle<JSFunction> maybe_function;
12251215
{
12261216
DisallowHeapAllocation no_allocation;

deps/v8/src/arm/lithium-arm.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,13 +2297,7 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
22972297
// We need a temporary register for write barrier of the map field.
22982298
LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL;
22992299

2300-
LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp);
2301-
if (!instr->access().IsExternalMemory() &&
2302-
instr->field_representation().IsHeapObject() &&
2303-
!instr->value()->type().IsHeapObject()) {
2304-
result = AssignEnvironment(result);
2305-
}
2306-
return result;
2300+
return new(zone()) LStoreNamedField(obj, val, temp);
23072301
}
23082302

23092303

@@ -2556,7 +2550,7 @@ LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
25562550

25572551
LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
25582552
LOperand* object = UseRegister(instr->object());
2559-
LOperand* index = UseRegister(instr->index());
2553+
LOperand* index = UseTempRegister(instr->index());
25602554
LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
25612555
LInstruction* result = DefineSameAsFirst(load);
25622556
return AssignPointerMap(result);

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4076,23 +4076,12 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
40764076
return;
40774077
}
40784078

4079-
SmiCheck check_needed =
4080-
instr->hydrogen()->value()->IsHeapObject()
4081-
? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4079+
__ AssertNotSmi(object);
40824080

4083-
ASSERT(!(representation.IsSmi() &&
4084-
instr->value()->IsConstantOperand() &&
4085-
!IsSmi(LConstantOperand::cast(instr->value()))));
4086-
if (representation.IsHeapObject()) {
4087-
Register value = ToRegister(instr->value());
4088-
if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4089-
__ SmiTst(value);
4090-
DeoptimizeIf(eq, instr->environment());
4091-
4092-
// We know now that value is not a smi, so we can omit the check below.
4093-
check_needed = OMIT_SMI_CHECK;
4094-
}
4095-
} else if (representation.IsDouble()) {
4081+
ASSERT(!representation.IsSmi() ||
4082+
!instr->value()->IsConstantOperand() ||
4083+
IsSmi(LConstantOperand::cast(instr->value())));
4084+
if (representation.IsDouble()) {
40964085
ASSERT(access.IsInobject());
40974086
ASSERT(!instr->hydrogen()->has_transition());
40984087
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
@@ -4134,7 +4123,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
41344123
GetLinkRegisterState(),
41354124
kSaveFPRegs,
41364125
EMIT_REMEMBERED_SET,
4137-
check_needed);
4126+
instr->hydrogen()->SmiCheckForWriteBarrier());
41384127
}
41394128
} else {
41404129
__ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
@@ -4150,7 +4139,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
41504139
GetLinkRegisterState(),
41514140
kSaveFPRegs,
41524141
EMIT_REMEMBERED_SET,
4153-
check_needed);
4142+
instr->hydrogen()->SmiCheckForWriteBarrier());
41544143
}
41554144
}
41564145
}

deps/v8/src/arm/macro-assembler-arm.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,11 @@ void MacroAssembler::Store(Register src,
405405
} else if (r.IsInteger16() || r.IsUInteger16()) {
406406
strh(src, dst);
407407
} else {
408+
if (r.IsHeapObject()) {
409+
AssertNotSmi(src);
410+
} else if (r.IsSmi()) {
411+
AssertSmi(src);
412+
}
408413
str(src, dst);
409414
}
410415
}

deps/v8/src/arm64/lithium-arm64.cc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,13 +2381,7 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
23812381
temp0 = TempRegister();
23822382
}
23832383

2384-
LStoreNamedField* result =
2385-
new(zone()) LStoreNamedField(object, value, temp0, temp1);
2386-
if (instr->field_representation().IsHeapObject() &&
2387-
!instr->value()->type().IsHeapObject()) {
2388-
return AssignEnvironment(result);
2389-
}
2390-
return result;
2384+
return new(zone()) LStoreNamedField(object, value, temp0, temp1);
23912385
}
23922386

23932387

@@ -2686,7 +2680,7 @@ LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
26862680

26872681
LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
26882682
LOperand* object = UseRegisterAtStart(instr->object());
2689-
LOperand* index = UseRegister(instr->index());
2683+
LOperand* index = UseRegisterAndClobber(instr->index());
26902684
LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
26912685
LInstruction* result = DefineSameAsFirst(load);
26922686
return AssignPointerMap(result);

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5304,7 +5304,11 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
53045304
Register value = ToRegister(instr->value());
53055305
__ Store(value, MemOperand(object, offset), representation);
53065306
return;
5307-
} else if (representation.IsDouble()) {
5307+
}
5308+
5309+
__ AssertNotSmi(object);
5310+
5311+
if (representation.IsDouble()) {
53085312
ASSERT(access.IsInobject());
53095313
ASSERT(!instr->hydrogen()->has_transition());
53105314
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
@@ -5315,19 +5319,9 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
53155319

53165320
Register value = ToRegister(instr->value());
53175321

5318-
SmiCheck check_needed = instr->hydrogen()->value()->IsHeapObject()
5319-
? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
5320-
5321-
ASSERT(!(representation.IsSmi() &&
5322-
instr->value()->IsConstantOperand() &&
5323-
!IsInteger32Constant(LConstantOperand::cast(instr->value()))));
5324-
if (representation.IsHeapObject() &&
5325-
!instr->hydrogen()->value()->type().IsHeapObject()) {
5326-
DeoptimizeIfSmi(value, instr->environment());
5327-
5328-
// We know now that value is not a smi, so we can omit the check below.
5329-
check_needed = OMIT_SMI_CHECK;
5330-
}
5322+
ASSERT(!representation.IsSmi() ||
5323+
!instr->value()->IsConstantOperand() ||
5324+
IsInteger32Constant(LConstantOperand::cast(instr->value())));
53315325

53325326
if (instr->hydrogen()->has_transition()) {
53335327
Handle<Map> transition = instr->hydrogen()->transition_map();
@@ -5387,7 +5381,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
53875381
GetLinkRegisterState(),
53885382
kSaveFPRegs,
53895383
EMIT_REMEMBERED_SET,
5390-
check_needed);
5384+
instr->hydrogen()->SmiCheckForWriteBarrier());
53915385
}
53925386
}
53935387

deps/v8/src/arm64/macro-assembler-arm64.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ void MacroAssembler::Store(const Register& rt,
557557
Str(rt.W(), addr);
558558
} else {
559559
ASSERT(rt.Is64Bits());
560+
if (r.IsHeapObject()) {
561+
AssertNotSmi(rt);
562+
} else if (r.IsSmi()) {
563+
AssertSmi(rt);
564+
}
560565
Str(rt, addr);
561566
}
562567
}

deps/v8/src/global-handles.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -610,21 +610,21 @@ bool GlobalHandles::IterateObjectGroups(ObjectVisitor* v,
610610
}
611611

612612

613-
bool GlobalHandles::PostGarbageCollectionProcessing(
613+
int GlobalHandles::PostGarbageCollectionProcessing(
614614
GarbageCollector collector, GCTracer* tracer) {
615615
// Process weak global handle callbacks. This must be done after the
616616
// GC is completely done, because the callbacks may invoke arbitrary
617617
// API functions.
618618
ASSERT(isolate_->heap()->gc_state() == Heap::NOT_IN_GC);
619619
const int initial_post_gc_processing_count = ++post_gc_processing_count_;
620-
bool next_gc_likely_to_collect_more = false;
620+
int freed_nodes = 0;
621621
if (collector == SCAVENGER) {
622622
for (int i = 0; i < new_space_nodes_.length(); ++i) {
623623
Node* node = new_space_nodes_[i];
624624
ASSERT(node->is_in_new_space_list());
625625
if (!node->IsRetainer()) {
626626
// Free nodes do not have weak callbacks. Do not use them to compute
627-
// the next_gc_likely_to_collect_more.
627+
// the freed_nodes.
628628
continue;
629629
}
630630
// Skip dependent handles. Their weak callbacks might expect to be
@@ -640,29 +640,29 @@ bool GlobalHandles::PostGarbageCollectionProcessing(
640640
// PostGarbageCollection processing. The current node might
641641
// have been deleted in that round, so we need to bail out (or
642642
// restart the processing).
643-
return next_gc_likely_to_collect_more;
643+
return freed_nodes;
644644
}
645645
}
646646
if (!node->IsRetainer()) {
647-
next_gc_likely_to_collect_more = true;
647+
freed_nodes++;
648648
}
649649
}
650650
} else {
651651
for (NodeIterator it(this); !it.done(); it.Advance()) {
652652
if (!it.node()->IsRetainer()) {
653653
// Free nodes do not have weak callbacks. Do not use them to compute
654-
// the next_gc_likely_to_collect_more.
654+
// the freed_nodes.
655655
continue;
656656
}
657657
it.node()->clear_partially_dependent();
658658
if (it.node()->PostGarbageCollectionProcessing(isolate_)) {
659659
if (initial_post_gc_processing_count != post_gc_processing_count_) {
660660
// See the comment above.
661-
return next_gc_likely_to_collect_more;
661+
return freed_nodes;
662662
}
663663
}
664664
if (!it.node()->IsRetainer()) {
665-
next_gc_likely_to_collect_more = true;
665+
freed_nodes++;
666666
}
667667
}
668668
}
@@ -685,7 +685,7 @@ bool GlobalHandles::PostGarbageCollectionProcessing(
685685
}
686686
}
687687
new_space_nodes_.Rewind(last);
688-
return next_gc_likely_to_collect_more;
688+
return freed_nodes;
689689
}
690690

691691

0 commit comments

Comments
 (0)