Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index 9a8e4e37d81729858228ba62d25eff84ad1635e6..0c3d7cb1d526bdf9e9645464e5b2a397d737bc13 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -1014,38 +1014,45 @@ function ObjectGetOwnPropertyNames(obj) { |
return ToStringArray(names, "getOwnPropertyNames"); |
} |
+ var nameArrays = new InternalArray(); |
+ |
// Find all the indexed properties. |
// Get the local element names. |
- var propertyNames = %GetLocalElementNames(obj); |
- for (var i = 0; i < propertyNames.length; ++i) { |
- propertyNames[i] = %_NumberToString(propertyNames[i]); |
+ var localElementNames = %GetLocalElementNames(obj); |
+ for (var i = 0; i < localElementNames.length; ++i) { |
+ localElementNames[i] = %_NumberToString(localElementNames[i]); |
} |
+ nameArrays.push(localElementNames); |
// Get names for indexed interceptor properties. |
var interceptorInfo = %GetInterceptorInfo(obj); |
if ((interceptorInfo & 1) != 0) { |
- var indexedInterceptorNames = |
- %GetIndexedInterceptorElementNames(obj); |
- if (indexedInterceptorNames) { |
- propertyNames = propertyNames.concat(indexedInterceptorNames); |
+ var indexedInterceptorNames = %GetIndexedInterceptorElementNames(obj); |
+ if (!IS_UNDEFINED(indexedInterceptorNames)) { |
+ nameArrays.push(indexedInterceptorNames); |
} |
} |
// Find all the named properties. |
// Get the local property names. |
- propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj)); |
+ nameArrays.push(%GetLocalPropertyNames(obj)); |
// Get names for named interceptor properties if any. |
if ((interceptorInfo & 2) != 0) { |
- var namedInterceptorNames = |
- %GetNamedInterceptorPropertyNames(obj); |
- if (namedInterceptorNames) { |
- propertyNames = propertyNames.concat(namedInterceptorNames); |
+ var namedInterceptorNames = %GetNamedInterceptorPropertyNames(obj); |
+ if (!IS_UNDEFINED(namedInterceptorNames)) { |
+ nameArrays.push(namedInterceptorNames); |
} |
} |
+ var propertyNames = %Apply(InternalArray.prototype.concat, |
+ new InternalArray(), |
+ nameArrays, |
+ 0, |
+ nameArrays.length); |
+ |
// Property names are expected to be unique strings, |
// but interceptors can interfere with that assumption. |
if (interceptorInfo != 0) { |
@@ -1065,7 +1072,9 @@ function ObjectGetOwnPropertyNames(obj) { |
propertyNames.length = j; |
} |
- return propertyNames; |
+ var result = new $Array(); |
+ %MoveArrayContents(propertyNames, result); |
Michael Starzinger
2013/03/12 12:09:06
This call to MoveArrayContents has become obsolete
adamk
2013/03/12 18:25:19
Done.
|
+ return result; |
} |