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

Unified Diff: src/v8natives.js

Issue 12342003: Use InternalArray in Object.getOwnPropertyNames() implementation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dealt with review comments Created 7 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/array.js ('k') | test/mjsunit/object-get-own-property-names.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index cc2e1c5e4dc7193f1dc3fe526a73786a0a97cfd1..24ad22d96d1d530121452d1d83cb7bf21dff8344 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -1014,39 +1014,44 @@ function ObjectGetOwnPropertyNames(obj) {
return ToNameArray(names, "getOwnPropertyNames", true);
}
+ 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);
}
}
- // Property names are expected to be unique names,
+ var propertyNames =
+ %Apply(InternalArray.prototype.concat,
+ nameArrays[0], nameArrays, 1, nameArrays.length - 1);
+
+ // Property names are expected to be unique strings,
// but interceptors can interfere with that assumption.
if (interceptorInfo != 0) {
var propertySet = { __proto__: null };
« no previous file with comments | « src/array.js ('k') | test/mjsunit/object-get-own-property-names.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698