From 8371e37e47967848ec470a4b34f46b1c8591c3c1 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 4 Jul 2011 11:57:47 +1000 Subject: [PATCH] Don't exceed SMI bounds If we use an integer that is greater than the maximum SMI value on 32-bit systems (like ARM), v8 allocates the integer as a HeapNumber which is unbelievably slower. Change-Id: I518b5947627631a2621344b656afa0dde002fe82 Reviewed-on: http://codereview.qt.nokia.com/1025 Reviewed-by: Aaron Kennedy --- src/declarative/qml/v8/qv8qobjectwrapper.cpp | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/v8/qv8qobjectwrapper.cpp b/src/declarative/qml/v8/qv8qobjectwrapper.cpp index bf9229b..7e5bd4e 100644 --- a/src/declarative/qml/v8/qv8qobjectwrapper.cpp +++ b/src/declarative/qml/v8/qv8qobjectwrapper.cpp @@ -174,8 +174,8 @@ static v8::Handle name ## ValueGetter(v8::Local, const v8 \ uint32_t data = info.Data()->Uint32Value(); \ int index = data & 0x7FFF; \ - int notify = (data & 0x7FFF0000) >> 16; \ - if (notify == 0x7FFF) notify = -1; \ + int notify = (data & 0x0FFF0000) >> 16; \ + if (notify == 0x0FFF) notify = -1; \ \ QDeclarativeEnginePrivate *ep = resource->engine->engine()?QDeclarativeEnginePrivate::get(resource->engine->engine()):0; \ if (ep && notify /* 0 means constant */ && ep->captureProperties) { \ @@ -200,8 +200,8 @@ static v8::Handle name ## ValueGetterDirect(v8::Local, co \ uint32_t data = info.Data()->Uint32Value(); \ int index = data & 0x7FFF; \ - int notify = (data & 0x7FFF0000) >> 16; \ - if (notify == 0x7FFF) notify = -1; \ + int notify = (data & 0x0FFF0000) >> 16; \ + if (notify == 0x0FFF) notify = -1; \ \ QDeclarativeEnginePrivate *ep = resource->engine->engine()?QDeclarativeEnginePrivate::get(resource->engine->engine()):0; \ if (ep && notify /* 0 means constant */ && ep->captureProperties) { \ @@ -801,7 +801,7 @@ v8::Local QDeclarativePropertyCache::newQObject(QObject *object, QV8 for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter) { Data *property = *iter; if (property->isFunction() || - property->coreIndex >= 0x7FFF || property->notifyIndex >= 0x7FFF || + property->coreIndex >= 0x7FFF || property->notifyIndex >= 0x0FFF || property->coreIndex == 0) continue; @@ -828,8 +828,8 @@ v8::Local QDeclarativePropertyCache::newQObject(QObject *object, QV8 if (fastgetter) { int notifyIndex = property->notifyIndex; if (property->isConstant()) notifyIndex = 0; - else if (notifyIndex == -1) notifyIndex = 0x7FFF; - uint32_t data = (notifyIndex & 0x7FFF) << 16 | property->coreIndex; + else if (notifyIndex == -1) notifyIndex = 0x0FFF; + uint32_t data = (notifyIndex & 0x0FFF) << 16 | property->coreIndex; QString name = iter.key(); if (name == toString || name == destroy) -- 1.7.2.5