Reviewers: Toon Verwaest,

Description:
Fix ArrayLengthGetter

Get the length from the holder instead of manually walking the prototype
chain.

BUG=None
LOG=N

Please review this at https://codereview.chromium.org/410923003/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+2, -9 lines):
  M src/accessors.cc


Index: src/accessors.cc
diff --git a/src/accessors.cc b/src/accessors.cc
index 182f0f63420e26e6c20cfbb3239a3e0f5200082d..99782e5e459cdd11a847538235fe065731d0d1b7 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -172,15 +172,8 @@ void Accessors::ArrayLengthGetter(
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   DisallowHeapAllocation no_allocation;
   HandleScope scope(isolate);
-  Object* object = *GetThisFrom(info);
-  // Traverse the prototype chain until we reach an array.
-  JSArray* holder = FindInstanceOf<JSArray>(isolate, object);
-  Object* result;
-  if (holder != NULL) {
-    result = holder->length();
-  } else {
-    result = Smi::FromInt(0);
-  }
+  JSArray* holder = JSArray::cast(*Utils::OpenHandle(*info.Holder()));
+  Object* result = holder->length();
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to