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

Unified Diff: include/v8.h

Issue 14137026: Defer slow branch of GetAlignedPointerFromInternalField (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index c85e71a3a2ed756cae1f39718ce57ac37e49f0db..bbef15ef707a145aad3df5cd37cda50e8365c6d4 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -92,6 +92,19 @@
#define V8_DEPRECATED(declarator) declarator
#endif
+#ifdef __GNUC__
Sven Panne 2013/04/26 07:09:28 An undefined preprocessor symbol evaluates to 0 by
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+ #define V8_UNLIKELY(x) __builtin_expect(!!(x), 0)
Sven Panne 2013/04/26 07:09:28 According to http://gcc.gnu.org/onlinedocs/gcc/Oth
+ #define V8_LIKELY(x) __builtin_expect(!!(x), 1)
+ #else
+ #define V8_UNLIKELY(x) (x)
+ #define V8_LIKELY(x) (x)
+ #endif
+#else
+ #define V8_UNLIKELY(x) (x)
+ #define V8_LIKELY(x) (x)
+#endif
+
/**
* The v8 JavaScript engine.
*/
@@ -4879,7 +4892,7 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
O* obj = *reinterpret_cast<O**>(this);
// Fast path: If the object is a plain JSObject, which is the common case, we
// know where to find the internal fields and can return the value directly.
- if (I::GetInstanceType(obj) == I::kJSObjectType) {
+ if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
return I::ReadField<void*>(obj, offset);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698