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

Unified Diff: src/elements.cc

Issue 2332503002: [elements] Handlify SloppyArguments IndexOfValueImpl (Closed)
Patch Set: use bool instead of nullptr 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') | 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 390af2c0f27b6389e09551512bef18e27d848c2c..6c8529ed69331eb546da859a46efe6650db9967d 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 HasParameterMapArg(parameter_map, entry);
}
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 (HasParameterMapArg(parameter_map, index)) return index;
FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
uint32_t entry = ArgumentsAccessor::GetEntryForIndexImpl(holder, arguments,
@@ -2995,11 +2993,11 @@ class SloppyArgumentsElementsAccessor
return ArgumentsAccessor::GetDetailsImpl(arguments, entry - length);
}
- static Object* GetParameterMapArg(FixedArray* parameter_map, uint32_t index) {
+ static bool HasParameterMapArg(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());
+ if (index >= length) return false;
+ return !parameter_map->get(index + 2)->IsTheHole(
+ parameter_map->GetIsolate());
}
static void DeleteImpl(Handle<JSObject> obj, uint32_t entry) {
@@ -3102,16 +3100,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698