Reviewers: michael_dawson, Sven Panne,

Description:
Fix uninitialized variable compiler errors [GCC 4.8.4]

R=svenpa...@chromium.org, michael_daw...@ca.ibm.com
BUG=

Please review this at https://codereview.chromium.org/1163143005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -11 lines):
  M src/api.cc
  M src/objects-inl.h
  M src/runtime/runtime-classes.cc
  M src/runtime/runtime-object.cc
  M src/runtime/runtime-scopes.cc
  M src/runtime/runtime-strings.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 994429a013426463dd82c29a00664612a85ba010..09a0ae89ce39e2765cb94cfb30f4c00507172364 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3661,7 +3661,7 @@ i::MaybeHandle<i::Object> DeleteObjectProperty(
     i::Isolate* isolate, i::Handle<i::JSReceiver> receiver,
     i::Handle<i::Object> key, i::LanguageMode language_mode) {
   // Check if the given key is an array index.
-  uint32_t index;
+  uint32_t index = 0;
   if (key->ToArrayIndex(&index)) {
     // In Firefox/SpiderMonkey, Safari and Opera you can access the
     // characters of a string using [] notation.  In the case of a
@@ -3972,7 +3972,7 @@ Maybe<bool> v8::Object::Has(Local<Context> context, Local<Value> key) {
   auto key_obj = Utils::OpenHandle(*key);
   Maybe<bool> maybe = Nothing<bool>();
   // Check if the given key is an array index.
-  uint32_t index;
+  uint32_t index = 0;
   if (key_obj->ToArrayIndex(&index)) {
     maybe = i::JSReceiver::HasElement(self, index);
   } else {
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 3d46e8141c88e334dd5af7517ae7936329bef93d..10d10c3c0cec9e408a65f00f5a167f02b7643383 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1874,7 +1874,7 @@ void JSObject::EnsureCanContainElements(Handle<JSObject> object,


 bool JSObject::WouldConvertToSlowElements(Handle<Object> key) {
-  uint32_t index;
+  uint32_t index = 0;
   return key->ToArrayIndex(&index) && WouldConvertToSlowElements(index);
 }

Index: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index b4b1ba7773d1db862e48055dde679fdfc7619f00..51247b728cf60730d3089b4a5bce6472673172ab 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -306,7 +306,7 @@ RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
   CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
   CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);

-  uint32_t index;
+  uint32_t index = 0;
   if (key->ToArrayIndex(&index)) {
     return LoadElementFromSuper(isolate, receiver, home_object, index);
   }
@@ -394,7 +394,7 @@ static Object* StoreKeyedToSuper(Isolate* isolate, Handle<JSObject> home_object, Handle<Object> receiver, Handle<Object> key,
                                  Handle<Object> value,
                                  LanguageMode language_mode) {
-  uint32_t index;
+  uint32_t index = 0;

   if (key->ToArrayIndex(&index)) {
return StoreElementToSuper(isolate, home_object, receiver, index, value,
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 2a4f77716b885206f2eadbe7d771e91d603ef920..e0e3764837a4cfdfb1d84b49db528127604e5c19 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -61,7 +61,7 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate,
   }

   // Check if the given key is an array index.
-  uint32_t index;
+  uint32_t index = 0;
   if (key->ToArrayIndex(&index)) {
     return GetElementOrCharAt(isolate, object, index);
   }
@@ -106,7 +106,7 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
   }

   // Check if the given key is an array index.
-  uint32_t index;
+  uint32_t index = 0;
   if (key->ToArrayIndex(&index)) {
     // TODO(verwaest): Support non-JSObject receivers.
     if (!object->IsJSObject()) return value;
@@ -182,7 +182,7 @@ MaybeHandle<Object> Runtime::DefineObjectProperty(Handle<JSObject> js_object, PropertyAttributes attrs) {
   Isolate* isolate = js_object->GetIsolate();
   // Check if the given key is an array index.
-  uint32_t index;
+  uint32_t index = 0;
   if (key->ToArrayIndex(&index)) {
// In Firefox/SpiderMonkey, Safari and Opera you can access the characters
     // of a string using [] notation.  We need to support this too in
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 8dedcea6b0418866544c6beceab576e9f3ebe164..7bc24afbcb489ca4ccdae4cddd20d458ef786796 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -1063,7 +1063,7 @@ RUNTIME_FUNCTION(Runtime_GetArgumentsProperty) {

   // Try to convert the key to an index. If successful and within
   // index return the the argument from the frame.
-  uint32_t index;
+  uint32_t index = 0;
   if (raw_key->ToArrayIndex(&index) && index < n) {
     return frame->GetParameter(index);
   }
Index: src/runtime/runtime-strings.cc
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc
index 5704807b82b60a62e0887efce7423d7e4e124ec6..000ae4e0dd0f94726404e6ab0547b2503938123e 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -137,7 +137,7 @@ RUNTIME_FUNCTION(Runtime_StringIndexOf) {
   CONVERT_ARG_HANDLE_CHECKED(String, pat, 1);
   CONVERT_ARG_HANDLE_CHECKED(Object, index, 2);

-  uint32_t start_index;
+  uint32_t start_index = 0;
   if (!index->ToArrayIndex(&start_index)) return Smi::FromInt(-1);

   RUNTIME_ASSERT(start_index <= static_cast<uint32_t>(sub->length()));
@@ -188,7 +188,7 @@ RUNTIME_FUNCTION(Runtime_StringLastIndexOf) {
   CONVERT_ARG_HANDLE_CHECKED(String, pat, 1);
   CONVERT_ARG_HANDLE_CHECKED(Object, index, 2);

-  uint32_t start_index;
+  uint32_t start_index = 0;
   if (!index->ToArrayIndex(&start_index)) return Smi::FromInt(-1);

   uint32_t pat_length = pat->length();


--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to