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

Unified Diff: src/objects-printer.cc

Issue 1302513004: [simd.js] Macro-ize more SIMD code (2). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 2 more #undefs Created 5 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/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 3a5bb806a21894b60e3c0d7a01ceff2505af2223..799561eb8b38b1d26756302fc2b95f560685cced 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -210,62 +210,34 @@ void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
}
-void Int32x4::Int32x4Print(std::ostream& os) { // NOLINT
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- os << std::string(IntToCString(get_lane(0), buffer)) << ", "
- << std::string(IntToCString(get_lane(1), buffer)) << ", "
- << std::string(IntToCString(get_lane(2), buffer)) << ", "
- << std::string(IntToCString(get_lane(3), buffer));
-}
-
-
-void Bool32x4::Bool32x4Print(std::ostream& os) { // NOLINT
- os << std::string(get_lane(0) ? "true" : "false") << ", "
- << std::string(get_lane(1) ? "true" : "false") << ", "
- << std::string(get_lane(2) ? "true" : "false") << ", "
- << std::string(get_lane(3) ? "true" : "false");
-}
-
-
-void Int16x8::Int16x8Print(std::ostream& os) { // NOLINT
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- os << std::string(IntToCString(get_lane(0), buffer));
- for (int i = 1; i < 8; i++) {
- os << ", " << std::string(IntToCString(get_lane(i), buffer));
- }
-}
-
-
-void Bool16x8::Bool16x8Print(std::ostream& os) { // NOLINT
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- os << std::string(get_lane(0) ? "true" : "false");
- for (int i = 1; i < 8; i++) {
- os << ", " << std::string(get_lane(i) ? "true" : "false");
- }
-}
-
-
-void Int8x16::Int8x16Print(std::ostream& os) { // NOLINT
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- os << std::string(IntToCString(get_lane(0), buffer));
- for (int i = 1; i < 16; i++) {
- os << ", " << std::string(IntToCString(get_lane(i), buffer));
+#define SIMD128_INT_PRINT_FUNCTION(type, lane_count) \
+ void type::type##Print(std::ostream& os) { \
+ char arr[100]; \
+ Vector<char> buffer(arr, arraysize(arr)); \
+ os << std::string(IntToCString(get_lane(0), buffer)); \
+ for (int i = 1; i < lane_count; i++) { \
+ os << ", " << std::string(IntToCString(get_lane(i), buffer)); \
+ } \
}
-}
-
-
-void Bool8x16::Bool8x16Print(std::ostream& os) { // NOLINT
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- os << std::string(get_lane(0) ? "true" : "false");
- for (int i = 1; i < 16; i++) {
- os << ", " << std::string(get_lane(i) ? "true" : "false");
+SIMD128_INT_PRINT_FUNCTION(Int32x4, 4)
+SIMD128_INT_PRINT_FUNCTION(Int16x8, 8)
+SIMD128_INT_PRINT_FUNCTION(Int8x16, 16)
+#undef SIMD128_INT_PRINT_FUNCTION
+
+
+#define SIMD128_BOOL_PRINT_FUNCTION(type, lane_count) \
+ void type::type##Print(std::ostream& os) { \
+ char arr[100]; \
+ Vector<char> buffer(arr, arraysize(arr)); \
+ os << std::string(get_lane(0) ? "true" : "false"); \
+ for (int i = 1; i < lane_count; i++) { \
+ os << ", " << std::string(get_lane(i) ? "true" : "false"); \
+ } \
}
-}
+SIMD128_BOOL_PRINT_FUNCTION(Bool32x4, 4)
+SIMD128_BOOL_PRINT_FUNCTION(Bool16x8, 8)
+SIMD128_BOOL_PRINT_FUNCTION(Bool8x16, 16)
+#undef SIMD128_BOOL_PRINT_FUNCTION
void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698