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

Unified Diff: src/elements.cc

Issue 1188073003: Return void from array setters since the return value needs to be ignored (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 8cfb01b525c17a0de35438c0e2cae498d00fd78f..128ba95580b30aa5e15638c5aba40e2298bd8416 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -613,19 +613,19 @@ class ElementsAccessorBase : public ElementsAccessor {
}
}
- virtual Handle<Object> Set(Handle<JSObject> holder, uint32_t key,
- Handle<FixedArrayBase> backing_store,
- Handle<Object> value) final {
- return ElementsAccessorSubclass::SetImpl(holder, key, backing_store, value);
+ virtual void Set(Handle<JSObject> holder, uint32_t key,
+ Handle<FixedArrayBase> backing_store,
+ Handle<Object> value) final {
+ ElementsAccessorSubclass::SetImpl(holder, key, backing_store, value);
}
- static Handle<Object> SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> backing_store,
- Handle<Object> value) {
+ static void SetImpl(Handle<JSObject> obj, uint32_t key,
+ Handle<FixedArrayBase> backing_store,
+ Handle<Object> value) {
CHECK(key <
ElementsAccessorSubclass::GetCapacityImpl(*obj, *backing_store));
- return BackingStore::SetValue(
- obj, Handle<BackingStore>::cast(backing_store), key, value);
+ BackingStore::SetValue(obj, Handle<BackingStore>::cast(backing_store), key,
+ value);
}
virtual MaybeHandle<AccessorPair> GetAccessorPair(
@@ -1447,15 +1447,13 @@ class DictionaryElementsAccessor
return isolate->factory()->the_hole_value();
}
- static Handle<Object> SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> store,
- Handle<Object> value) {
+ static void SetImpl(Handle<JSObject> obj, uint32_t key,
+ Handle<FixedArrayBase> store, Handle<Object> value) {
Handle<SeededNumberDictionary> backing_store =
Handle<SeededNumberDictionary>::cast(store);
int entry = backing_store->FindEntry(key);
DCHECK_NE(SeededNumberDictionary::kNotFound, entry);
backing_store->ValueAtPut(entry, *value);
- return value;
}
static MaybeHandle<AccessorPair> GetAccessorPairImpl(
@@ -1546,9 +1544,8 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
}
}
- static Handle<Object> SetImpl(Handle<JSObject> obj, uint32_t key,
- Handle<FixedArrayBase> store,
- Handle<Object> value) {
+ static void SetImpl(Handle<JSObject> obj, uint32_t key,
+ Handle<FixedArrayBase> store, Handle<Object> value) {
Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(store);
Object* probe = GetParameterMapArg(*parameter_map, key);
if (!probe->IsTheHole()) {
@@ -1556,11 +1553,10 @@ class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
int context_index = Smi::cast(probe)->value();
DCHECK(!context->get(context_index)->IsTheHole());
context->set(context_index, *value);
- return value;
+ } else {
+ Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
+ ElementsAccessor::ForArray(arguments)->Set(obj, key, arguments, value);
}
- Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
- return ElementsAccessor::ForArray(arguments)
- ->Set(obj, key, arguments, value);
}
static MaybeHandle<AccessorPair> GetAccessorPairImpl(
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698