Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Unified Diff: src/objects.cc

Issue 2668003002: Trivial simplification in JSObject::AddDataElement. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 8c05ff8bdd3e07349b54771eed2d323b41614d74..a55e1ffda9d7c327407ad26d031cd8bea4a80e7d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -15499,12 +15499,10 @@ Maybe<bool> JSObject::AddDataElement(Handle<JSObject> object, uint32_t index,
ElementsAccessor* accessor = ElementsAccessor::ForKind(to);
accessor->Add(object, index, value, attributes, new_capacity);
- uint32_t new_length = old_length;
- Handle<Object> new_length_handle;
if (object->IsJSArray() && index >= old_length) {
- new_length = index + 1;
- new_length_handle = isolate->factory()->NewNumberFromUint(new_length);
- JSArray::cast(*object)->set_length(*new_length_handle);
+ Handle<Object> new_length =
+ isolate->factory()->NewNumberFromUint(index + 1);
+ JSArray::cast(*object)->set_length(*new_length);
}
return Just(true);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698