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

Unified Diff: src/runtime/runtime-forin.cc

Issue 1773593003: Revert of [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/runtime/runtime-array.cc ('k') | test/mjsunit/for-in.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-forin.cc
diff --git a/src/runtime/runtime-forin.cc b/src/runtime/runtime-forin.cc
index 6374cb97e5a8a92ad37b0b671059363274ac3c1e..c44945c94ce64141006ee7293b30b4ceb068606a 100644
--- a/src/runtime/runtime-forin.cc
+++ b/src/runtime/runtime-forin.cc
@@ -5,10 +5,8 @@
#include "src/runtime/runtime-utils.h"
#include "src/arguments.h"
-#include "src/elements.h"
#include "src/factory.h"
#include "src/isolate-inl.h"
-#include "src/keys.h"
#include "src/objects-inl.h"
namespace v8 {
@@ -22,15 +20,15 @@
// deletions during a for-in.
MaybeHandle<HeapObject> Enumerate(Handle<JSReceiver> receiver) {
Isolate* const isolate = receiver->GetIsolate();
- FastKeyAccumulator accumulator(isolate, receiver, INCLUDE_PROTOS,
- ENUMERABLE_STRINGS);
// Test if we have an enum cache for {receiver}.
- if (!accumulator.is_receiver_simple_enum()) {
+ if (!receiver->IsSimpleEnum()) {
Handle<FixedArray> keys;
- ASSIGN_RETURN_ON_EXCEPTION(isolate, keys, accumulator.GetKeys(KEEP_NUMBERS),
- HeapObject);
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, keys,
+ JSReceiver::GetKeys(receiver, INCLUDE_PROTOS, ENUMERABLE_STRINGS),
+ HeapObject);
// Test again, since cache may have been built by GetKeys() calls above.
- if (!accumulator.is_receiver_simple_enum()) return keys;
+ if (!receiver->IsSimpleEnum()) return keys;
}
return handle(receiver->map(), isolate);
}
@@ -38,19 +36,10 @@
MaybeHandle<Object> Filter(Handle<JSReceiver> receiver, Handle<Object> key) {
Isolate* const isolate = receiver->GetIsolate();
+ // TODO(turbofan): Fast case for array indices.
Handle<Name> name;
ASSIGN_RETURN_ON_EXCEPTION(isolate, name, Object::ToName(isolate, key),
Object);
- // Directly check for elements if the key is a smi and avoid a conversion
- // roundtrip (Number -> Name -> Number).
- if (key->IsNumber() && receiver->map()->OnlyHasSimpleProperties()) {
- Handle<JSObject> object = Handle<JSObject>::cast(receiver);
- ElementsAccessor* accessor = object->GetElementsAccessor();
- DCHECK_LT(key->Number(), kMaxUInt32);
- if (accessor->HasElement(object, key->Number(), ONLY_ENUMERABLE)) {
- return name;
- }
- }
Maybe<bool> result = JSReceiver::HasProperty(receiver, name);
MAYBE_RETURN_NULL(result);
if (result.FromJust()) return name;
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/for-in.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698