Commit 6071c6d8 authored by Mike Stanton's avatar Mike Stanton Committed by V8 LUCI CQ

[runtime] Cleanup: we don't need field representation tracking flags

Also, copying hints can be removed from literals. Shallow
copying wasn't used for some time, because of the
way we treat mutable heap numbers.

Change-Id: Ieeba44a9f8e80c4183af8f4751f68dd3a542532e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3009230Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75717}
parent 66f5de1b
...@@ -496,9 +496,8 @@ DEFINE_BOOL(jitless, V8_LITE_BOOL, ...@@ -496,9 +496,8 @@ DEFINE_BOOL(jitless, V8_LITE_BOOL,
// Jitless V8 has a few implications: // Jitless V8 has a few implications:
DEFINE_NEG_IMPLICATION(jitless, opt) DEFINE_NEG_IMPLICATION(jitless, opt)
// Field representation tracking is only used by TurboFan. // Field type tracking is only used by TurboFan.
DEFINE_NEG_IMPLICATION(jitless, track_field_types) DEFINE_NEG_IMPLICATION(jitless, track_field_types)
DEFINE_NEG_IMPLICATION(jitless, track_heap_object_fields)
// Regexps are interpreted. // Regexps are interpreted.
DEFINE_IMPLICATION(jitless, regexp_interpret_all) DEFINE_IMPLICATION(jitless, regexp_interpret_all)
#if ENABLE_SPARKPLUG #if ENABLE_SPARKPLUG
...@@ -542,16 +541,7 @@ DEFINE_BOOL(trace_pretenuring, false, ...@@ -542,16 +541,7 @@ DEFINE_BOOL(trace_pretenuring, false,
"trace pretenuring decisions of HAllocate instructions") "trace pretenuring decisions of HAllocate instructions")
DEFINE_BOOL(trace_pretenuring_statistics, false, DEFINE_BOOL(trace_pretenuring_statistics, false,
"trace allocation site pretenuring statistics") "trace allocation site pretenuring statistics")
DEFINE_BOOL(track_fields, true, "track fields with only smi values")
DEFINE_BOOL(track_double_fields, true, "track fields with double values")
DEFINE_BOOL(track_heap_object_fields, true, "track fields with heap values")
DEFINE_BOOL(track_computed_fields, true, "track computed boilerplate fields")
DEFINE_IMPLICATION(track_double_fields, track_fields)
DEFINE_IMPLICATION(track_heap_object_fields, track_fields)
DEFINE_IMPLICATION(track_computed_fields, track_fields)
DEFINE_BOOL(track_field_types, true, "track field types") DEFINE_BOOL(track_field_types, true, "track field types")
DEFINE_IMPLICATION(track_field_types, track_fields)
DEFINE_IMPLICATION(track_field_types, track_heap_object_fields)
DEFINE_BOOL(trace_block_coverage, false, DEFINE_BOOL(trace_block_coverage, false,
"trace collected block coverage information") "trace collected block coverage information")
DEFINE_BOOL(trace_protector_invalidation, false, DEFINE_BOOL(trace_protector_invalidation, false,
......
...@@ -1445,9 +1445,6 @@ void AccessorAssembler::CheckFieldType(TNode<DescriptorArray> descriptors, ...@@ -1445,9 +1445,6 @@ void AccessorAssembler::CheckFieldType(TNode<DescriptorArray> descriptors,
TNode<Word32T> representation, TNode<Word32T> representation,
TNode<Object> value, Label* bailout) { TNode<Object> value, Label* bailout) {
Label r_smi(this), r_double(this), r_heapobject(this), all_fine(this); Label r_smi(this), r_double(this), r_heapobject(this), all_fine(this);
// Ignore FLAG_track_fields etc. and always emit code for all checks,
// because this builtin is part of the snapshot and therefore should
// be flag independent.
GotoIf(Word32Equal(representation, Int32Constant(Representation::kSmi)), GotoIf(Word32Equal(representation, Int32Constant(Representation::kSmi)),
&r_smi); &r_smi);
GotoIf(Word32Equal(representation, Int32Constant(Representation::kDouble)), GotoIf(Word32Equal(representation, Int32Constant(Representation::kDouble)),
......
...@@ -3706,15 +3706,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -3706,15 +3706,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
.ToHandleChecked(); .ToHandleChecked();
// done // done
// TODO(ishell): Consider using Representation::HeapObject() here and rely
// on the inplace update logic to take care of the case where someone ever
// stores a Smi into the done field. The logic works fine but in --jitless
// mode FLAG_track_heap_object_fields is off and the logic doesn't handle
// generalizations of HeapObject representation properly.
map = Map::CopyWithField(isolate(), map, factory->done_string(), map = Map::CopyWithField(isolate(), map, factory->done_string(),
FieldType::Any(isolate()), NONE, FieldType::Any(isolate()), NONE,
PropertyConstness::kConst, PropertyConstness::kConst,
Representation::Tagged(), INSERT_TRANSITION) Representation::HeapObject(), INSERT_TRANSITION)
.ToHandleChecked(); .ToHandleChecked();
native_context()->set_iterator_result_map(*map); native_context()->set_iterator_result_map(*map);
......
...@@ -473,22 +473,17 @@ bool Object::FilterKey(PropertyFilter filter) { ...@@ -473,22 +473,17 @@ bool Object::FilterKey(PropertyFilter filter) {
} }
Representation Object::OptimalRepresentation(PtrComprCageBase cage_base) const { Representation Object::OptimalRepresentation(PtrComprCageBase cage_base) const {
if (!FLAG_track_fields) return Representation::Tagged();
if (IsSmi()) { if (IsSmi()) {
return Representation::Smi(); return Representation::Smi();
} }
HeapObject heap_object = HeapObject::cast(*this); HeapObject heap_object = HeapObject::cast(*this);
if (FLAG_track_double_fields && heap_object.IsHeapNumber(cage_base)) { if (heap_object.IsHeapNumber(cage_base)) {
return Representation::Double(); return Representation::Double();
} else if (FLAG_track_computed_fields && } else if (heap_object.IsUninitialized(
heap_object.IsUninitialized(
heap_object.GetReadOnlyRoots(cage_base))) { heap_object.GetReadOnlyRoots(cage_base))) {
return Representation::None(); return Representation::None();
} else if (FLAG_track_heap_object_fields) {
return Representation::HeapObject();
} else {
return Representation::Tagged();
} }
return Representation::HeapObject();
} }
ElementsKind Object::OptimalElementsKind(PtrComprCageBase cage_base) const { ElementsKind Object::OptimalElementsKind(PtrComprCageBase cage_base) const {
...@@ -499,13 +494,13 @@ ElementsKind Object::OptimalElementsKind(PtrComprCageBase cage_base) const { ...@@ -499,13 +494,13 @@ ElementsKind Object::OptimalElementsKind(PtrComprCageBase cage_base) const {
bool Object::FitsRepresentation(Representation representation, bool Object::FitsRepresentation(Representation representation,
bool allow_coercion) const { bool allow_coercion) const {
if (FLAG_track_fields && representation.IsSmi()) { if (representation.IsSmi()) {
return IsSmi(); return IsSmi();
} else if (FLAG_track_double_fields && representation.IsDouble()) { } else if (representation.IsDouble()) {
return allow_coercion ? IsNumber() : IsHeapNumber(); return allow_coercion ? IsNumber() : IsHeapNumber();
} else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { } else if (representation.IsHeapObject()) {
return IsHeapObject(); return IsHeapObject();
} else if (FLAG_track_fields && representation.IsNone()) { } else if (representation.IsNone()) {
return false; return false;
} }
return true; return true;
......
...@@ -34,13 +34,11 @@ void PreInitializeLiteralSite(Handle<FeedbackVector> vector, ...@@ -34,13 +34,11 @@ void PreInitializeLiteralSite(Handle<FeedbackVector> vector,
vector->SynchronizedSet(slot, Smi::FromInt(1)); vector->SynchronizedSet(slot, Smi::FromInt(1));
} }
enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 };
template <class ContextObject> template <class ContextObject>
class JSObjectWalkVisitor { class JSObjectWalkVisitor {
public: public:
JSObjectWalkVisitor(ContextObject* site_context, DeepCopyHints hints) explicit JSObjectWalkVisitor(ContextObject* site_context)
: site_context_(site_context), hints_(hints) {} : site_context_(site_context) {}
V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> StructureWalk( V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> StructureWalk(
Handle<JSObject> object); Handle<JSObject> object);
...@@ -64,7 +62,6 @@ class JSObjectWalkVisitor { ...@@ -64,7 +62,6 @@ class JSObjectWalkVisitor {
private: private:
ContextObject* site_context_; ContextObject* site_context_;
const DeepCopyHints hints_;
}; };
template <class ContextObject> template <class ContextObject>
...@@ -72,9 +69,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( ...@@ -72,9 +69,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
Handle<JSObject> object) { Handle<JSObject> object) {
Isolate* isolate = this->isolate(); Isolate* isolate = this->isolate();
bool copying = ContextObject::kCopying; bool copying = ContextObject::kCopying;
bool shallow = hints_ == kObjectIsShallow;
if (!shallow) { {
StackLimitCheck check(isolate); StackLimitCheck check(isolate);
if (check.HasOverflowed()) { if (check.HasOverflowed()) {
...@@ -105,8 +101,6 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( ...@@ -105,8 +101,6 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
DCHECK(copying || copy.is_identical_to(object)); DCHECK(copying || copy.is_identical_to(object));
if (shallow) return copy;
HandleScope scope(isolate); HandleScope scope(isolate);
// Deep copy own properties. Arrays only have 1 property "length". // Deep copy own properties. Arrays only have 1 property "length".
...@@ -316,7 +310,7 @@ class AllocationSiteCreationContext : public AllocationSiteContext { ...@@ -316,7 +310,7 @@ class AllocationSiteCreationContext : public AllocationSiteContext {
MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object, MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object,
DeprecationUpdateContext* site_context) { DeprecationUpdateContext* site_context) {
JSObjectWalkVisitor<DeprecationUpdateContext> v(site_context, kNoHints); JSObjectWalkVisitor<DeprecationUpdateContext> v(site_context);
MaybeHandle<JSObject> result = v.StructureWalk(object); MaybeHandle<JSObject> result = v.StructureWalk(object);
Handle<JSObject> for_assert; Handle<JSObject> for_assert;
DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(object)); DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(object));
...@@ -325,7 +319,7 @@ MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object, ...@@ -325,7 +319,7 @@ MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object,
MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object, MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object,
AllocationSiteCreationContext* site_context) { AllocationSiteCreationContext* site_context) {
JSObjectWalkVisitor<AllocationSiteCreationContext> v(site_context, kNoHints); JSObjectWalkVisitor<AllocationSiteCreationContext> v(site_context);
MaybeHandle<JSObject> result = v.StructureWalk(object); MaybeHandle<JSObject> result = v.StructureWalk(object);
Handle<JSObject> for_assert; Handle<JSObject> for_assert;
DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(object)); DCHECK(!result.ToHandle(&for_assert) || for_assert.is_identical_to(object));
...@@ -333,9 +327,8 @@ MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object, ...@@ -333,9 +327,8 @@ MaybeHandle<JSObject> DeepWalk(Handle<JSObject> object,
} }
MaybeHandle<JSObject> DeepCopy(Handle<JSObject> object, MaybeHandle<JSObject> DeepCopy(Handle<JSObject> object,
AllocationSiteUsageContext* site_context, AllocationSiteUsageContext* site_context) {
DeepCopyHints hints) { JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context);
JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context, hints);
MaybeHandle<JSObject> copy = v.StructureWalk(object); MaybeHandle<JSObject> copy = v.StructureWalk(object);
Handle<JSObject> for_assert; Handle<JSObject> for_assert;
DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object)); DCHECK(!copy.ToHandle(&for_assert) || !for_assert.is_identical_to(object));
...@@ -520,26 +513,13 @@ Handle<JSObject> CreateArrayLiteral( ...@@ -520,26 +513,13 @@ Handle<JSObject> CreateArrayLiteral(
copied_elements_values->length(), allocation); copied_elements_values->length(), allocation);
} }
inline DeepCopyHints DecodeCopyHints(int flags) {
DeepCopyHints copy_hints =
(flags & AggregateLiteral::kIsShallow) ? kObjectIsShallow : kNoHints;
if (FLAG_track_double_fields) {
// Make sure we properly clone mutable heap numbers on 32-bit platforms.
copy_hints = kNoHints;
}
return copy_hints;
}
template <typename LiteralHelper> template <typename LiteralHelper>
MaybeHandle<JSObject> CreateLiteralWithoutAllocationSite( MaybeHandle<JSObject> CreateLiteralWithoutAllocationSite(
Isolate* isolate, Handle<HeapObject> description, int flags) { Isolate* isolate, Handle<HeapObject> description, int flags) {
Handle<JSObject> literal = LiteralHelper::Create(isolate, description, flags, Handle<JSObject> literal = LiteralHelper::Create(isolate, description, flags,
AllocationType::kYoung); AllocationType::kYoung);
DeepCopyHints copy_hints = DecodeCopyHints(flags); DeprecationUpdateContext update_context(isolate);
if (copy_hints == kNoHints) { RETURN_ON_EXCEPTION(isolate, DeepWalk(literal, &update_context), JSObject);
DeprecationUpdateContext update_context(isolate);
RETURN_ON_EXCEPTION(isolate, DeepWalk(literal, &update_context), JSObject);
}
return literal; return literal;
} }
...@@ -558,8 +538,6 @@ MaybeHandle<JSObject> CreateLiteral(Isolate* isolate, ...@@ -558,8 +538,6 @@ MaybeHandle<JSObject> CreateLiteral(Isolate* isolate,
CHECK(literals_slot.ToInt() < vector->length()); CHECK(literals_slot.ToInt() < vector->length());
Handle<Object> literal_site(vector->Get(literals_slot)->cast<Object>(), Handle<Object> literal_site(vector->Get(literals_slot)->cast<Object>(),
isolate); isolate);
DeepCopyHints copy_hints = DecodeCopyHints(flags);
Handle<AllocationSite> site; Handle<AllocationSite> site;
Handle<JSObject> boilerplate; Handle<JSObject> boilerplate;
...@@ -596,8 +574,7 @@ MaybeHandle<JSObject> CreateLiteral(Isolate* isolate, ...@@ -596,8 +574,7 @@ MaybeHandle<JSObject> CreateLiteral(Isolate* isolate,
// Copy the existing boilerplate. // Copy the existing boilerplate.
AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); AllocationSiteUsageContext usage_context(isolate, site, enable_mementos);
usage_context.EnterNewScope(); usage_context.EnterNewScope();
MaybeHandle<JSObject> copy = MaybeHandle<JSObject> copy = DeepCopy(boilerplate, &usage_context);
DeepCopy(boilerplate, &usage_context, copy_hints);
usage_context.ExitScope(site, boilerplate); usage_context.ExitScope(site, boilerplate);
return copy; return copy;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --track-fields --track-double-fields --allow-natives-syntax // Flags: --allow-natives-syntax
// Flags: --concurrent-recompilation --block-concurrent-recompilation // Flags: --concurrent-recompilation --block-concurrent-recompilation
// Flags: --no-always-opt --no-turbo-concurrent-get-property-access-info // Flags: --no-always-opt --no-turbo-concurrent-get-property-access-info
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-ayle license that can be // Use of this source code is governed by a BSD-ayle license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax --track-fields --expose-gc // Flags: --allow-natives-syntax --expose-gc
var global = Function('return this')(); var global = Function('return this')();
var verbose = 0; var verbose = 0;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --track-fields --track-double-fields --allow-natives-syntax // Flags: --allow-natives-syntax
function smi_field() { function smi_field() {
// Assign twice to make the field non-constant. // Assign twice to make the field non-constant.
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --track-fields --track-double-fields --allow-natives-syntax // Flags: --allow-natives-syntax
// Test transitions caused by changes to field representations. // Test transitions caused by changes to field representations.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment