Commit dad1a8d1 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Remove two more illegal uses of Handle<T>::cast.

The affected passes are part of OptimizeGraph which runs on a background
thread, so they must not access the heap (cast has a SLOW_DCHECK that
looks at the object's type).

I'm also changing Handle<T>::cast to assert that it's called in a scope
allowing handle dereference.

R=mstarzinger@chromium.org

Bug: 
Change-Id: Ibae1e40ec8d57481387570c658eb7cb1ae5de3b9
Reviewed-on: https://chromium-review.googlesource.com/570403Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46667}
parent 8b5b444a
......@@ -1534,8 +1534,8 @@ void EscapeAnalysis::ProcessCheckMaps(Node* node) {
// CheckMapsValue operator that takes the load-eliminated map value as
// input.
if (value->opcode() == IrOpcode::kHeapConstant &&
params.maps().contains(ZoneHandleSet<Map>(
Handle<Map>::cast(OpParameter<Handle<HeapObject>>(value))))) {
params.maps().contains(ZoneHandleSet<Map>(bit_cast<Handle<Map>>(
OpParameter<Handle<HeapObject>>(value))))) {
TRACE("CheckMaps #%i seems to be redundant (until now).\n",
node->id());
return;
......
......@@ -871,7 +871,7 @@ Reduction LoadElimination::ReduceStoreField(Node* node) {
if (new_value_type->IsHeapConstant()) {
// Record the new {object} map information.
ZoneHandleSet<Map> object_maps(
Handle<Map>::cast(new_value_type->AsHeapConstant()->Value()));
bit_cast<Handle<Map>>(new_value_type->AsHeapConstant()->Value()));
state = state->AddMaps(object, object_maps, zone());
}
} else {
......
......@@ -125,7 +125,7 @@ class Handle final : public HandleBase {
template <typename S>
static const Handle<T> cast(Handle<S> that) {
T::cast(*reinterpret_cast<T**>(that.location_));
T::cast(*reinterpret_cast<T**>(that.location()));
return Handle<T>(reinterpret_cast<T**>(that.location_));
}
......
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