Commit 125b8a45 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Remove unnecessary conditions around Map::AsElementsKind calls.

Map::AsElementsKind returns the given map if it already has the desired
elements kind.

Change-Id: Ia9c92eabdb28c82da376eb87f0117dc76414240d
Reviewed-on: https://chromium-review.googlesource.com/1164368Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54941}
parent 5f105141
......@@ -489,10 +489,8 @@ Reduction JSCreateLowering::ReduceNewArray(Node* node, Node* length,
// Constructing an Array via new Array(N) where N is an unsigned
// integer, always creates a holey backing store.
if (!IsHoleyElementsKind(initial_map.elements_kind())) {
initial_map = initial_map.AsElementsKind(
GetHoleyElementsKind(initial_map.elements_kind()));
}
initial_map = initial_map.AsElementsKind(
GetHoleyElementsKind(initial_map.elements_kind()));
// Check that the {limit} is an unsigned integer in the valid range.
// This has to be kept in sync with src/runtime/runtime-array.cc,
......@@ -733,9 +731,7 @@ Reduction JSCreateLowering::ReduceJSCreateArray(Node* node) {
// Check if we have a feedback {site} on the {node}.
if (site_ref) {
ElementsKind elements_kind = site_ref->GetElementsKind();
if (initial_map.elements_kind() != elements_kind) {
initial_map = initial_map.AsElementsKind(elements_kind);
}
initial_map = initial_map.AsElementsKind(elements_kind);
can_inline_call = site_ref->CanInlineCall();
pretenure = dependencies()->DependOnPretenureMode(*site_ref);
dependencies()->DependOnElementsKind(*site_ref);
......
......@@ -245,9 +245,7 @@ MapUpdater::State MapUpdater::FindRootMap() {
state_ = kEnd;
result_map_ = handle(
JSFunction::cast(root_map_->GetConstructor())->initial_map(), isolate_);
if (from_kind != to_kind) {
result_map_ = Map::AsElementsKind(isolate_, result_map_, to_kind);
}
result_map_ = Map::AsElementsKind(isolate_, result_map_, to_kind);
DCHECK(result_map_->is_dictionary_map());
return state_;
}
......@@ -307,9 +305,7 @@ MapUpdater::State MapUpdater::FindRootMap() {
}
// From here on, use the map with correct elements kind as root map.
if (from_kind != to_kind) {
root_map_ = Map::AsElementsKind(isolate_, root_map_, to_kind);
}
root_map_ = Map::AsElementsKind(isolate_, root_map_, to_kind);
state_ = kAtRootMap;
return state_; // Not done yet.
}
......
......@@ -599,9 +599,7 @@ RUNTIME_FUNCTION(Runtime_NewArray) {
// We should allocate with an initial map that reflects the allocation site
// advice. Therefore we use AllocateJSObjectFromMap instead of passing
// the constructor.
if (to_kind != initial_map->elements_kind()) {
initial_map = Map::AsElementsKind(isolate, initial_map, to_kind);
}
initial_map = Map::AsElementsKind(isolate, initial_map, to_kind);
// If we don't care to track arrays of to_kind ElementsKind, then
// don't emit a memento for them.
......
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