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

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

Issue 2489563004: [turbofan] Add support for accessing Uint8ClampedArrays. (Closed)
Patch Set: Fix typing rule. Created 4 years, 1 month 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/effect-control-linearizer.cc ('k') | src/compiler/opcodes.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 d95b2101789f4781899e9441c32513d8712417a2..7ade44c6c18e011b27e18d160cf14e55a2190e0b 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -1200,6 +1200,14 @@ JSNativeContextSpecialization::BuildElementAccess(
value = effect = graph()->NewNode(simplified()->CheckNumber(), value,
effect, control);
+ // Introduce the appropriate truncation for {value}. Currently we
+ // only need to do this for ClamedUint8Array {receiver}s, as the
+ // other truncations are implicit in the StoreTypedElement, but we
+ // might want to change that at some point.
+ if (external_array_type == kExternalUint8ClampedArray) {
+ value = graph()->NewNode(simplified()->NumberToUint8Clamped(), value);
+ }
+
// Check if we can skip the out-of-bounds store.
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
Node* check =
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698