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

Unified Diff: src/compiler/typer.cc

Issue 835883003: [turbofan] Don't crash when typing load from a Uint8ClampedArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | test/mjsunit/compiler/regress-446156.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index a170a71512b4be188be53908868e64c3911325ed..2caeb9b94ba02489b0bc034397f77b0ef4c7ab78 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -33,10 +33,11 @@ enum LazyCachedType {
kImulFunc,
kClz32Func,
kArrayBufferFunc,
-#define NATIVE_TYPE_CASE(Type) k##Type, k##Type##Array, k##Type##ArrayFunc,
- NATIVE_TYPES(NATIVE_TYPE_CASE)
-#undef NATIVE_TYPE_CASE
- kNumLazyCachedTypes
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ k##Type, k##Type##Array, k##Type##ArrayFunc,
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
+ kNumLazyCachedTypes
};
@@ -75,6 +76,8 @@ class LazyTypeCache FINAL : public ZoneObject {
return CreateNative(Type::Number(), Type::UntaggedFloat32());
case kFloat64:
return CreateNative(Type::Number(), Type::UntaggedFloat64());
+ case kUint8Clamped:
+ return Get(kUint8);
case kNumberFunc0:
return Type::Function(Type::Number(), zone());
case kNumberFunc1:
@@ -89,13 +92,13 @@ class LazyTypeCache FINAL : public ZoneObject {
return Type::Function(CreateRange(0, 32), Type::Number(), zone());
case kArrayBufferFunc:
return Type::Function(Type::Object(zone()), Type::Unsigned32(), zone());
-#define NATIVE_TYPE_CASE(Type) \
- case k##Type##Array: \
- return CreateArray(Get(k##Type)); \
- case k##Type##ArrayFunc: \
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case k##Type##Array: \
+ return CreateArray(Get(k##Type)); \
+ case k##Type##ArrayFunc: \
return CreateArrayFunction(Get(k##Type##Array));
- NATIVE_TYPES(NATIVE_TYPE_CASE)
-#undef NATIVE_TYPE_CASE
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
case kNumLazyCachedTypes:
break;
}
@@ -1615,13 +1618,11 @@ Bounds Typer::Visitor::TypeLoadBuffer(Node* node) {
// TODO(bmeurer): This typing is not yet correct. Since we can still access
// out of bounds, the type in the general case has to include Undefined.
switch (BufferAccessOf(node->op()).external_array_type()) {
-#define NATIVE_TYPE_CASE(Type) \
- case kExternal##Type##Array: \
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
return Bounds(typer_->cache_->Get(k##Type));
- NATIVE_TYPES(NATIVE_TYPE_CASE)
-#undef NATIVE_TYPE_CASE
- case kExternalUint8ClampedArray:
- break;
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
}
UNREACHABLE();
return Bounds();
@@ -2088,14 +2089,11 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
}
} else if (value->IsJSTypedArray()) {
switch (JSTypedArray::cast(*value)->type()) {
-#define NATIVE_TYPE_CASE(Type) \
- case kExternal##Type##Array: \
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
return typer_->cache_->Get(k##Type##Array);
- NATIVE_TYPES(NATIVE_TYPE_CASE)
-#undef NATIVE_TYPE_CASE
- case kExternalUint8ClampedArray:
- // TODO(rossberg): Do we want some ClampedArray type to express this?
- break;
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+#undef TYPED_ARRAY_CASE
}
}
return Type::Constant(value, zone());
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-446156.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698