[constant-tracking] Fix compilation dependencies to account for constness.

Bug: v8:5495, v8:8361
Change-Id: I7a03c7a4897b15112b978d232754076ad8753c4e
Reviewed-on: https://chromium-review.googlesource.com/c/1297311
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56950}
This commit is contained in:
Jaroslav Sevcik 2018-10-24 10:10:36 +02:00 committed by Commit Bot
parent 961125b7d0
commit ccb48e95d5

View File

@ -149,17 +149,24 @@ class FieldTypeDependency final : public CompilationDependencies::Dependency {
// TODO(neis): Once the concurrent compiler frontend is always-on, we no // TODO(neis): Once the concurrent compiler frontend is always-on, we no
// longer need to explicitly store the type. // longer need to explicitly store the type.
FieldTypeDependency(const MapRef& owner, int descriptor, FieldTypeDependency(const MapRef& owner, int descriptor,
const ObjectRef& type) const ObjectRef& type, PropertyConstness constness)
: owner_(owner), descriptor_(descriptor), type_(type) { : owner_(owner),
descriptor_(descriptor),
type_(type),
constness_(constness) {
DCHECK(owner_.equals(owner_.FindFieldOwner(descriptor_))); DCHECK(owner_.equals(owner_.FindFieldOwner(descriptor_)));
DCHECK(type_.equals(owner_.GetFieldType(descriptor_))); DCHECK(type_.equals(owner_.GetFieldType(descriptor_)));
DCHECK_EQ(constness_, owner_.GetPropertyDetails(descriptor_).constness());
} }
bool IsValid() const override { bool IsValid() const override {
DisallowHeapAllocation no_heap_allocation; DisallowHeapAllocation no_heap_allocation;
Handle<Map> owner = owner_.object(); Handle<Map> owner = owner_.object();
Handle<Object> type = type_.object(); Handle<Object> type = type_.object();
return *type == owner->instance_descriptors()->GetFieldType(descriptor_); return *type == owner->instance_descriptors()->GetFieldType(descriptor_) &&
constness_ == owner->instance_descriptors()
->GetDetails(descriptor_)
.constness();
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
@ -172,6 +179,7 @@ class FieldTypeDependency final : public CompilationDependencies::Dependency {
MapRef owner_; MapRef owner_;
int descriptor_; int descriptor_;
ObjectRef type_; ObjectRef type_;
PropertyConstness constness_;
}; };
class GlobalPropertyDependency final class GlobalPropertyDependency final
@ -327,9 +335,11 @@ void CompilationDependencies::DependOnFieldType(const MapRef& map,
int descriptor) { int descriptor) {
MapRef owner = map.FindFieldOwner(descriptor); MapRef owner = map.FindFieldOwner(descriptor);
ObjectRef type = owner.GetFieldType(descriptor); ObjectRef type = owner.GetFieldType(descriptor);
PropertyConstness constness =
owner.GetPropertyDetails(descriptor).constness();
DCHECK(type.equals(map.GetFieldType(descriptor))); DCHECK(type.equals(map.GetFieldType(descriptor)));
dependencies_.push_front(new (zone_) dependencies_.push_front(
FieldTypeDependency(owner, descriptor, type)); new (zone_) FieldTypeDependency(owner, descriptor, type, constness));
} }
void CompilationDependencies::DependOnGlobalProperty( void CompilationDependencies::DependOnGlobalProperty(