Revision: 8184
Author:   [email protected]
Date:     Mon Jun  6 06:28:44 2011
Log:      Don't use SmartSlice just because the receiver is an array.

Only do so if the estimated number of elements is low compared to the
end position for the slice. This is similar to other heuristics used
for array operations that use the %GetElementKeys runtime function.

[email protected]

Review URL: http://codereview.chromium.org/7111032
http://code.google.com/p/v8/source/detail?r=8184

Modified:
 /branches/bleeding_edge/src/array.js

=======================================
--- /branches/bleeding_edge/src/array.js        Wed May  4 22:21:30 2011
+++ /branches/bleeding_edge/src/array.js        Mon Jun  6 06:28:44 2011
@@ -631,7 +631,9 @@

   if (end_i < start_i) return result;

-  if (IS_ARRAY(this)) {
+  if (IS_ARRAY(this) &&
+      (end_i > 1000) &&
+      (%EstimateNumberOfElements(this) < end_i)) {
     SmartSlice(this, start_i, end_i - start_i, len, result);
   } else {
     SimpleSlice(this, start_i, end_i - start_i, len, result);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to