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

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: addressed comments 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..ed039a5729fdd82fbc48651ce4d86d251154d6ed 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -92,6 +92,14 @@
#define V8_DEPRECATED(declarator) declarator
#endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+ #define V8_UNLIKELY(condition) __builtin_expect(condition, 0)
+ #define V8_LIKELY(condition) __builtin_expect(condition, 1)
+#else
+ #define V8_UNLIKELY(condition) (condition)
+ #define V8_LIKELY(condition) (condition)
+#endif
+
/**
* The v8 JavaScript engine.
*/
@@ -4879,7 +4887,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