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

Unified Diff: src/objects-inl.h

Issue 1148863002: Fix for-in for large indexes and indexes on proxies (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/objects.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/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index a2b0189d3d0ca559912a8846f1adad63d3a7b9ea..50d02f9f655e887b10cf5dc4e290d0a343cd7480 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -275,6 +275,24 @@ bool Object::HasValidElements() {
}
+bool Object::KeyEquals(Object* second) {
+ Object* first = this;
+ if (second->IsNumber()) {
+ if (first->IsNumber()) return first->Number() == second->Number();
+ Object* temp = first;
+ first = second;
+ second = temp;
+ }
+ if (first->IsNumber()) {
+ DCHECK_LE(0, first->Number());
+ uint32_t expected = static_cast<uint32_t>(first->Number());
+ uint32_t index;
+ return Name::cast(second)->AsArrayIndex(&index) && index == expected;
+ }
+ return Name::cast(first)->Equals(Name::cast(second));
+}
+
+
Handle<Object> Object::NewStorageFor(Isolate* isolate,
Handle<Object> object,
Representation representation) {
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/for-in.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698