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

Side by Side Diff: src/v8natives.js

Issue 2825026: Object.getOwnPropertyNames should be free of duplicates (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // Get names for named interceptor properties if any. 670 // Get names for named interceptor properties if any.
671 671
672 if (%GetInterceptorInfo(obj) & 2) { 672 if (%GetInterceptorInfo(obj) & 2) {
673 var namedInterceptorNames = 673 var namedInterceptorNames =
674 %GetNamedInterceptorPropertyNames(obj); 674 %GetNamedInterceptorPropertyNames(obj);
675 if (namedInterceptorNames) { 675 if (namedInterceptorNames) {
676 propertyNames = propertyNames.concat(namedInterceptorNames); 676 propertyNames = propertyNames.concat(namedInterceptorNames);
677 } 677 }
678 } 678 }
679 679
680 // Property names are expected to be strings. 680 // Property names are expected to be unique strings.
681 for (var i = 0; i < propertyNames.length; ++i) 681 var propertySet = {};
682 propertyNames[i] = ToString(propertyNames[i]); 682 var j = 0;
683 for (var i = 0; i < propertyNames.length; ++i) {
684 var name = ToString(propertyNames[i]);
685 if (name in propertySet)
686 continue;
687 propertySet[name] = true;
688 propertyNames[j++] = name;
689 }
690 propertyNames.length = j;
683 691
684 return propertyNames; 692 return propertyNames;
685 } 693 }
686 694
687 695
688 // ES5 section 15.2.3.5. 696 // ES5 section 15.2.3.5.
689 function ObjectCreate(proto, properties) { 697 function ObjectCreate(proto, properties) {
690 if (!IS_SPEC_OBJECT_OR_NULL(proto)) { 698 if (!IS_SPEC_OBJECT_OR_NULL(proto)) {
691 throw MakeTypeError("proto_object_or_null", [proto]); 699 throw MakeTypeError("proto_object_or_null", [proto]);
692 } 700 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1038
1031 // ---------------------------------------------------------------------------- 1039 // ----------------------------------------------------------------------------
1032 1040
1033 function SetupFunction() { 1041 function SetupFunction() {
1034 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1042 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1035 "toString", FunctionToString 1043 "toString", FunctionToString
1036 )); 1044 ));
1037 } 1045 }
1038 1046
1039 SetupFunction(); 1047 SetupFunction();
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698