Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 2218703003: [turbofan] Add support for copy-on-write element stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix off-by-one loop iteration count. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-graph.cc ('k') | src/compiler/load-elimination.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index cc3bb1c8856925ba31bdb231762ab5904b2feb87..0868f5d1cb091cad2164dec1713f426406eecf41 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -428,6 +428,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// TODO(bmeurer): Add support for non-standard stores.
if (store_mode != STANDARD_STORE &&
+ store_mode != STORE_NO_TRANSITION_HANDLE_COW &&
store_mode != STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
return NoChange();
}
@@ -960,10 +961,11 @@ JSNativeContextSpecialization::BuildElementAccess(
// Don't try to store to a copy-on-write backing store.
if (access_mode == AccessMode::kStore &&
- IsFastSmiOrObjectElementsKind(elements_kind)) {
- effect = graph()->NewNode(
- simplified()->CheckMaps(1), elements,
- jsgraph()->HeapConstant(factory()->fixed_array_map()), effect, control);
+ IsFastSmiOrObjectElementsKind(elements_kind) &&
+ store_mode != STORE_NO_TRANSITION_HANDLE_COW) {
+ effect =
+ graph()->NewNode(simplified()->CheckMaps(1), elements,
+ jsgraph()->FixedArrayMapConstant(), effect, control);
}
if (IsFixedTypedArrayElementsKind(elements_kind)) {
@@ -1067,7 +1069,8 @@ JSNativeContextSpecialization::BuildElementAccess(
}
} else {
// TODO(turbofan): Add support for additional store modes.
- DCHECK_EQ(STANDARD_STORE, store_mode);
+ DCHECK(store_mode == STANDARD_STORE ||
+ store_mode == STORE_NO_TRANSITION_HANDLE_COW);
// Load the length of the {receiver}.
Node* length = effect =
@@ -1147,6 +1150,16 @@ JSNativeContextSpecialization::BuildElementAccess(
// Make sure we do not store signalling NaNs into double arrays.
value = graph()->NewNode(simplified()->NumberSilenceNaN(), value);
}
+
+ // Ensure that copy-on-write backing store is writable.
+ if (IsFastSmiOrObjectElementsKind(elements_kind) &&
+ store_mode == STORE_NO_TRANSITION_HANDLE_COW) {
+ elements = effect =
+ graph()->NewNode(simplified()->EnsureWritableFastElements(),
+ receiver, elements, effect, control);
+ }
+
+ // Perform the actual element access.
effect = graph()->NewNode(simplified()->StoreElement(element_access),
elements, index, value, effect, control);
}
« no previous file with comments | « src/compiler/js-graph.cc ('k') | src/compiler/load-elimination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698