From ee0fcd2acc8ad5a300ed4e25880ccb95e704d3a6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 6 Oct 2014 17:12:05 +0200 Subject: 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 --- Source/JavaScriptCore/runtime/NumericStrings.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/JavaScriptCore/runtime/NumericStrings.h') 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& 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(i) < cacheSize) return lookupSmallString(static_cast(i)); CacheEntry& 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(i)); CacheEntry& 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); -- cgit v1.2.1