Commit d0f9b738 authored by dcarney@chromium.org's avatar dcarney@chromium.org

Defer slow branch of GetAlignedPointerFromInternalField

BUG=

Review URL: https://codereview.chromium.org/14137026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14444 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 896468fe
...@@ -92,6 +92,14 @@ ...@@ -92,6 +92,14 @@
#define V8_DEPRECATED(declarator) declarator #define V8_DEPRECATED(declarator) declarator
#endif #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. * The v8 JavaScript engine.
*/ */
...@@ -4979,7 +4987,7 @@ void* Object::GetAlignedPointerFromInternalField(int index) { ...@@ -4979,7 +4987,7 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
O* obj = *reinterpret_cast<O**>(this); O* obj = *reinterpret_cast<O**>(this);
// Fast path: If the object is a plain JSObject, which is the common case, we // 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. // 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); int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
return I::ReadField<void*>(obj, offset); return I::ReadField<void*>(obj, offset);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment