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

Side by Side Diff: src/v8natives.js

Issue 391713002: Reland "Include symbol properties in Object.{create,defineProperties}" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/mjsunit/es6/symbols.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declarations have been made 5 // This file relies on the fact that the following declarations have been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $Object = global.Object; 7 // var $Object = global.Object;
8 // var $Boolean = global.Boolean; 8 // var $Boolean = global.Boolean;
9 // var $Number = global.Number; 9 // var $Number = global.Number;
10 // var $Function = global.Function; 10 // var $Function = global.Function;
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 desc = descObj; 1164 desc = descObj;
1165 */ 1165 */
1166 } else { 1166 } else {
1167 var desc = ToPropertyDescriptor(attributes); 1167 var desc = ToPropertyDescriptor(attributes);
1168 DefineOwnProperty(obj, name, desc, true); 1168 DefineOwnProperty(obj, name, desc, true);
1169 } 1169 }
1170 return obj; 1170 return obj;
1171 } 1171 }
1172 1172
1173 1173
1174 function GetOwnEnumerablePropertyNames(properties) { 1174 function GetOwnEnumerablePropertyNames(object) {
1175 var names = new InternalArray(); 1175 var names = new InternalArray();
1176 for (var key in properties) { 1176 for (var key in object) {
1177 if (%HasOwnProperty(properties, key)) { 1177 if (%HasOwnProperty(object, key)) {
1178 names.push(key); 1178 names.push(key);
1179 } 1179 }
1180 } 1180 }
1181
1182 // FLAG_harmony_symbols may be on, but symbols aren't included by for-in.
1183 var filter = PROPERTY_ATTRIBUTES_STRING | PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL;
arv (Not doing code reviews) 2014/07/14 13:29:17 Why don't you include string property keys here to
rossberg 2014/07/14 13:50:10 Unfortunately, that would miss out on indexed prop
1184 var symbols = %GetOwnPropertyNames(object, filter);
1185 for (var i = 0; i < symbols.length; ++i) {
1186 var symbol = symbols[i];
1187 if (IS_SYMBOL(symbol)) {
1188 var desc = ObjectGetOwnPropertyDescriptor(object, symbol);
1189 if (desc.enumerable) names.push(symbol);
1190 }
1191 }
1192
1181 return names; 1193 return names;
1182 } 1194 }
1183 1195
1184 1196
1185 // ES5 section 15.2.3.7. 1197 // ES5 section 15.2.3.7.
1186 function ObjectDefineProperties(obj, properties) { 1198 function ObjectDefineProperties(obj, properties) {
1187 if (!IS_SPEC_OBJECT(obj)) { 1199 if (!IS_SPEC_OBJECT(obj)) {
1188 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]); 1200 throw MakeTypeError("called_on_non_object", ["Object.defineProperties"]);
1189 } 1201 }
1190 var props = ToObject(properties); 1202 var props = ToObject(properties);
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 %SetCode($Function, FunctionConstructor); 1862 %SetCode($Function, FunctionConstructor);
1851 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM); 1863 %AddProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
1852 1864
1853 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1865 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1854 "bind", FunctionBind, 1866 "bind", FunctionBind,
1855 "toString", FunctionToString 1867 "toString", FunctionToString
1856 )); 1868 ));
1857 } 1869 }
1858 1870
1859 SetUpFunction(); 1871 SetUpFunction();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698