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

Unified Diff: include/v8config.h

Issue 23641009: Refactor and cleanup VirtualMemory. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nits. Created 7 years, 3 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 | src/arm/codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8config.h
diff --git a/include/v8config.h b/include/v8config.h
index 0993a9f3e4fd9b7e13e8ca8eda8f83bb987a5bcd..2dfbcfad002f41d676de9431d5188c119a66a6fd 100644
--- a/include/v8config.h
+++ b/include/v8config.h
@@ -187,6 +187,7 @@
// supported
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
+// V8_HAS_ATTRIBUTE_PURE - __attribute__((pure)) supported
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
// V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
// supported
@@ -216,6 +217,7 @@
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
+# define V8_HAS_ATTRIBUTE_PURE (__has_attribute(pure))
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
(__has_attribute(warn_unused_result))
@@ -246,6 +248,7 @@
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
+# define V8_HAS_ATTRIBUTE_PURE (V8_GNUC_PREREQ(2, 96, 0))
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
@@ -325,6 +328,28 @@
#endif
+// Many functions have no effects except the return value and their return value
+// depends only on the parameters and/or global variables. Such a function can
+// be subject to common subexpression elimination and loop optimization just as
+// an arithmetic operator would be. These functions should be declared with the
+// attribute V8_PURE. For example,
+//
+// int square (int) V8_PURE;
+//
+// says that the hypothetical function square is safe to call fewer times than
+// the program says.
+//
+// Some of common examples of pure functions are strlen or memcmp. Interesting
+// non-V8_PURE functions are functions with infinite loops or those depending
+// on volatile memory or other system resource, that may change between two
+// consecutive calls (such as feof in a multithreaded environment).
+#if V8_HAS_ATTRIBUTE_PURE
+# define V8_PURE __attribute__((pure))
+#else
+# define V8_PURE /* NOT SUPPORTED */
+#endif
+
+
// Annotate a function indicating the caller must examine the return value.
// Use like:
// int foo() V8_WARN_UNUSED_RESULT;
« no previous file with comments | « no previous file | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698