Revision: 14444
Author: [email protected]
Date: Fri Apr 26 00:28:08 2013
Log: Defer slow branch of GetAlignedPointerFromInternalField
BUG=
Review URL: https://codereview.chromium.org/14137026
http://code.google.com/p/v8/source/detail?r=14444
Modified:
/branches/bleeding_edge/include/v8.h
=======================================
--- /branches/bleeding_edge/include/v8.h Thu Apr 25 05:08:10 2013
+++ /branches/bleeding_edge/include/v8.h Fri Apr 26 00:28:08 2013
@@ -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.
*/
@@ -4979,7 +4987,7 @@
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);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.