Reviewers: Sven Panne,
Description:
Defer slow branch of GetAlignedPointerFromInternalField
BUG=
Please review this at https://chromiumcodereview.appspot.com/14137026/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M include/v8.h
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__
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+ #define V8_UNLIKELY(x) __builtin_expect(!!(x), 0)
+ #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);
}
--
--
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.