summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-10-06 17:12:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-10-06 17:31:36 +0200
commitee0fcd2acc8ad5a300ed4e25880ccb95e704d3a6 (patch)
tree7c88e4e10ce12db9cc4e33f43239135a956d52a6 /Source/JavaScriptCore/runtime
parent114d0b573e54612d62af3ed747a0fea146c3842a (diff)
downloadqtwebkit-ee0fcd2acc8ad5a300ed4e25880ccb95e704d3a6.tar.gz
Fix valgrind warning about uninitialized access
A default cache-entry has a null String and an uninitialized key. We should therefore only try to use the key if the String is not null. Change-Id: Icd6819b96b9b650305cf0611b6b2978c07dc9196 Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r--Source/JavaScriptCore/runtime/NumericStrings.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/JavaScriptCore/runtime/NumericStrings.h b/Source/JavaScriptCore/runtime/NumericStrings.h
index 4cd92fc1f..68bfbd06a 100644
--- a/Source/JavaScriptCore/runtime/NumericStrings.h
+++ b/Source/JavaScriptCore/runtime/NumericStrings.h
@@ -37,7 +37,7 @@ namespace JSC {
ALWAYS_INLINE String add(double d)
{
CacheEntry<double>& entry = lookup(d);
- if (d == entry.key && !entry.value.isNull())
+ if (!entry.value.isNull() && d == entry.key)
return entry.value;
entry.key = d;
entry.value = String::numberToStringECMAScript(d);
@@ -49,7 +49,7 @@ namespace JSC {
if (static_cast<unsigned>(i) < cacheSize)
return lookupSmallString(static_cast<unsigned>(i));
CacheEntry<int>& entry = lookup(i);
- if (i == entry.key && !entry.value.isNull())
+ if (!entry.value.isNull() && i == entry.key)
return entry.value;
entry.key = i;
entry.value = String::number(i);
@@ -61,7 +61,7 @@ namespace JSC {
if (i < cacheSize)
return lookupSmallString(static_cast<unsigned>(i));
CacheEntry<unsigned>& entry = lookup(i);
- if (i == entry.key && !entry.value.isNull())
+ if (!entry.value.isNull() && i == entry.key)
return entry.value;
entry.key = i;
entry.value = String::number(i);