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

Unified Diff: src/utils.h

Issue 661105: Faster filling of arrays of holes. (Closed)
Patch Set: Addressing comments Created 10 years, 10 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/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.h
diff --git a/src/utils.h b/src/utils.h
index 2cad4c12e4a8f93ee46cd4d2214b8583d8f09dbb..deab09fb1193215b6d4dd06f910d2da3256a24ba 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -572,6 +572,30 @@ static inline int CompareChars(const lchar* lhs, const rchar* rhs, int chars) {
}
+template <typename T>
+static inline void MemsetPointer(T** dest, T* value, int counter) {
+#if defined(V8_HOST_ARCH_IA32)
+#define STOS "stosl"
+#elif defined(V8_HOST_ARCH_X64)
+#define STOS "stosq"
+#endif
+
+#if defined(__GNUC__) && defined(STOS)
+ asm("cld;"
+ "rep ; " STOS
+ : /* no output */
+ : "c" (counter), "a" (value), "D" (dest)
+ : /* no clobbered list as all inputs are considered clobbered */);
+#else
+ for (int i = 0; i < counter; i++) {
+ dest[i] = value;
+ }
+#endif
+
+#undef STOS
+}
+
+
// Calculate 10^exponent.
int TenToThe(int exponent);
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698