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

Unified Diff: src/elements.cc

Issue 2332503002: [elements] Handlify SloppyArguments IndexOfValueImpl (Closed)
Patch Set: adding elements.cc again Created 4 years, 3 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 | test/mjsunit/array-indexing-receiver.js » ('j') | test/mjsunit/array-indexing-receiver.js » ('J')
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 390af2c0f27b6389e09551512bef18e27d848c2c..a637ac77cd684fc1e8bdd318e28db10044444d16 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -2946,8 +2946,7 @@ class SloppyArgumentsElementsAccessor
FixedArray* parameter_map = FixedArray::cast(parameters);
uint32_t length = parameter_map->length() - 2;
if (entry < length) {
- return !GetParameterMapArg(parameter_map, entry)
- ->IsTheHole(parameter_map->GetIsolate());
+ return GetParameterMapArg(parameter_map, entry) != nullptr;
}
FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1));
@@ -2975,8 +2974,7 @@ class SloppyArgumentsElementsAccessor
FixedArrayBase* parameters,
uint32_t index, PropertyFilter filter) {
FixedArray* parameter_map = FixedArray::cast(parameters);
- Object* probe = GetParameterMapArg(parameter_map, index);
- if (!probe->IsTheHole(holder->GetIsolate())) return index;
+ if (GetParameterMapArg(parameter_map, index) != nullptr) return index;
FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl(holder, arguments,
@@ -2997,9 +2995,7 @@ class SloppyArgumentsElementsAccessor
static Object* GetParameterMapArg(FixedArray* parameter_map, uint32_t index) {
uint32_t length = parameter_map->length() - 2;
- return index < length
- ? parameter_map->get(index + 2)
- : Object::cast(parameter_map->GetHeap()->the_hole_value());
+ return index < length ? parameter_map->get(index + 2) : nullptr;
caitp 2016/09/10 02:48:37 Looks good I think, but I think there are more con
}
static void DeleteImpl(Handle<JSObject> obj, uint32_t entry) {
@@ -3102,16 +3098,17 @@ class SloppyArgumentsElementsAccessor
uint32_t start_from, uint32_t length) {
DCHECK(JSObject::PrototypeHasNoElements(isolate, *object));
Handle<Map> original_map = handle(object->map(), isolate);
- FixedArray* parameter_map = FixedArray::cast(object->elements());
+ Handle<FixedArray> parameter_map(FixedArray::cast(object->elements()),
+ isolate);
for (uint32_t k = start_from; k < length; ++k) {
uint32_t entry =
- GetEntryForIndexImpl(*object, parameter_map, k, ALL_PROPERTIES);
+ GetEntryForIndexImpl(*object, *parameter_map, k, ALL_PROPERTIES);
if (entry == kMaxUInt32) {
continue;
}
- Handle<Object> element_k = GetImpl(parameter_map, entry);
+ Handle<Object> element_k = GetImpl(*parameter_map, entry);
if (element_k->IsAccessorPair()) {
LookupIterator it(isolate, object, k, LookupIterator::OWN);
« no previous file with comments | « no previous file | test/mjsunit/array-indexing-receiver.js » ('j') | test/mjsunit/array-indexing-receiver.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698