[turbofan] Make instanceof optimization constant-field-tracking compatible.
BUG=v8:5495 Change-Id: I49e478f5d6b12a3b65f69fa8120a768f2dbd98f3 Reviewed-on: https://chromium-review.googlesource.com/451323 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#43753}
This commit is contained in:
parent
9d3b8fce50
commit
dfca935138
@ -217,21 +217,37 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) {
|
|||||||
Reduction const reduction = ReduceJSOrdinaryHasInstance(node);
|
Reduction const reduction = ReduceJSOrdinaryHasInstance(node);
|
||||||
return reduction.Changed() ? reduction : Changed(node);
|
return reduction.Changed() ? reduction : Changed(node);
|
||||||
}
|
}
|
||||||
} else if (access_info.IsDataConstant()) {
|
} else if (access_info.IsDataConstant() ||
|
||||||
DCHECK(access_info.constant()->IsCallable());
|
access_info.IsDataConstantField()) {
|
||||||
|
|
||||||
// Determine actual holder and perform prototype chain checks.
|
// Determine actual holder and perform prototype chain checks.
|
||||||
Handle<JSObject> holder;
|
Handle<JSObject> holder;
|
||||||
if (access_info.holder().ToHandle(&holder)) {
|
if (access_info.holder().ToHandle(&holder)) {
|
||||||
AssumePrototypesStable(access_info.receiver_maps(), holder);
|
AssumePrototypesStable(access_info.receiver_maps(), holder);
|
||||||
|
} else {
|
||||||
|
holder = receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle<Object> constant;
|
||||||
|
if (access_info.IsDataConstant()) {
|
||||||
|
DCHECK(!FLAG_track_constant_fields);
|
||||||
|
constant = access_info.constant();
|
||||||
|
} else {
|
||||||
|
DCHECK(FLAG_track_constant_fields);
|
||||||
|
DCHECK(access_info.IsDataConstantField());
|
||||||
|
// The value must be callable therefore tagged.
|
||||||
|
DCHECK(CanBeTaggedPointer(access_info.field_representation()));
|
||||||
|
FieldIndex field_index = access_info.field_index();
|
||||||
|
constant = JSObject::FastPropertyAt(holder, Representation::Tagged(),
|
||||||
|
field_index);
|
||||||
|
}
|
||||||
|
DCHECK(constant->IsCallable());
|
||||||
|
|
||||||
// Monomorphic property access.
|
// Monomorphic property access.
|
||||||
effect = BuildCheckMaps(constructor, effect, control,
|
effect = BuildCheckMaps(constructor, effect, control,
|
||||||
access_info.receiver_maps());
|
access_info.receiver_maps());
|
||||||
|
|
||||||
// Call the @@hasInstance handler.
|
// Call the @@hasInstance handler.
|
||||||
Node* target = jsgraph()->Constant(access_info.constant());
|
Node* target = jsgraph()->Constant(constant);
|
||||||
node->InsertInput(graph()->zone(), 0, target);
|
node->InsertInput(graph()->zone(), 0, target);
|
||||||
node->ReplaceInput(1, constructor);
|
node->ReplaceInput(1, constructor);
|
||||||
node->ReplaceInput(2, object);
|
node->ReplaceInput(2, object);
|
||||||
@ -1333,6 +1349,7 @@ JSNativeContextSpecialization::BuildPropertyAccess(
|
|||||||
DCHECK_EQ(AccessMode::kLoad, access_mode);
|
DCHECK_EQ(AccessMode::kLoad, access_mode);
|
||||||
value = jsgraph()->UndefinedConstant();
|
value = jsgraph()->UndefinedConstant();
|
||||||
} else if (access_info.IsDataConstant()) {
|
} else if (access_info.IsDataConstant()) {
|
||||||
|
DCHECK(!FLAG_track_constant_fields);
|
||||||
Node* constant_value = jsgraph()->Constant(access_info.constant());
|
Node* constant_value = jsgraph()->Constant(access_info.constant());
|
||||||
if (access_mode == AccessMode::kStore) {
|
if (access_mode == AccessMode::kStore) {
|
||||||
Node* check = graph()->NewNode(simplified()->ReferenceEqual(), value,
|
Node* check = graph()->NewNode(simplified()->ReferenceEqual(), value,
|
||||||
|
Loading…
Reference in New Issue
Block a user