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

Side by Side Diff: src/v8natives.js

Issue 8701006: Clean up JavaScript files to better follow coding standard. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove more empty statments and fix bug. Created 9 years 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 | « src/uri.js ('k') | test/mjsunit/bugs/bug-618.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 (-1e9 < string && string < -0.01))) { 120 (-1e9 < string && string < -0.01))) {
121 // Truncate number. 121 // Truncate number.
122 return string | 0; 122 return string | 0;
123 } 123 }
124 string = TO_STRING_INLINE(string); 124 string = TO_STRING_INLINE(string);
125 radix = radix | 0; 125 radix = radix | 0;
126 } else { 126 } else {
127 // The spec says ToString should be evaluated before ToInt32. 127 // The spec says ToString should be evaluated before ToInt32.
128 string = TO_STRING_INLINE(string); 128 string = TO_STRING_INLINE(string);
129 radix = TO_INT32(radix); 129 radix = TO_INT32(radix);
130 if (!(radix == 0 || (2 <= radix && radix <= 36))) 130 if (!(radix == 0 || (2 <= radix && radix <= 36))) {
131 return $NaN; 131 return $NaN;
132 }
132 } 133 }
133 134
134 if (%_HasCachedArrayIndex(string) && 135 if (%_HasCachedArrayIndex(string) &&
135 (radix == 0 || radix == 10)) { 136 (radix == 0 || radix == 10)) {
136 return %_GetCachedArrayIndex(string); 137 return %_GetCachedArrayIndex(string);
137 } 138 }
138 return %StringParseInt(string, radix); 139 return %StringParseInt(string, radix);
139 } 140 }
140 141
141 142
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 277 }
277 278
278 279
279 // Extensions for providing property getters and setters. 280 // Extensions for providing property getters and setters.
280 function ObjectDefineGetter(name, fun) { 281 function ObjectDefineGetter(name, fun) {
281 var receiver = this; 282 var receiver = this;
282 if (receiver == null && !IS_UNDETECTABLE(receiver)) { 283 if (receiver == null && !IS_UNDETECTABLE(receiver)) {
283 receiver = %GlobalReceiver(global); 284 receiver = %GlobalReceiver(global);
284 } 285 }
285 if (!IS_SPEC_FUNCTION(fun)) { 286 if (!IS_SPEC_FUNCTION(fun)) {
286 throw new $TypeError('Object.prototype.__defineGetter__: Expecting function' ); 287 throw new $TypeError(
288 'Object.prototype.__defineGetter__: Expecting function');
287 } 289 }
288 var desc = new PropertyDescriptor(); 290 var desc = new PropertyDescriptor();
289 desc.setGet(fun); 291 desc.setGet(fun);
290 desc.setEnumerable(true); 292 desc.setEnumerable(true);
291 desc.setConfigurable(true); 293 desc.setConfigurable(true);
292 DefineOwnProperty(ToObject(receiver), ToString(name), desc, false); 294 DefineOwnProperty(ToObject(receiver), ToString(name), desc, false);
293 } 295 }
294 296
295 297
296 function ObjectLookupGetter(name) { 298 function ObjectLookupGetter(name) {
(...skipping 25 matching lines...) Expand all
322 function ObjectLookupSetter(name) { 324 function ObjectLookupSetter(name) {
323 var receiver = this; 325 var receiver = this;
324 if (receiver == null && !IS_UNDETECTABLE(receiver)) { 326 if (receiver == null && !IS_UNDETECTABLE(receiver)) {
325 receiver = %GlobalReceiver(global); 327 receiver = %GlobalReceiver(global);
326 } 328 }
327 return %LookupAccessor(ToObject(receiver), ToString(name), SETTER); 329 return %LookupAccessor(ToObject(receiver), ToString(name), SETTER);
328 } 330 }
329 331
330 332
331 function ObjectKeys(obj) { 333 function ObjectKeys(obj) {
332 if (!IS_SPEC_OBJECT(obj)) 334 if (!IS_SPEC_OBJECT(obj)) {
333 throw MakeTypeError("obj_ctor_property_non_object", ["keys"]); 335 throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
336 }
334 if (%IsJSProxy(obj)) { 337 if (%IsJSProxy(obj)) {
335 var handler = %GetHandler(obj); 338 var handler = %GetHandler(obj);
336 var names = CallTrap0(handler, "keys", DerivedKeysTrap); 339 var names = CallTrap0(handler, "keys", DerivedKeysTrap);
337 return ToStringArray(names); 340 return ToStringArray(names);
338 } 341 }
339 return %LocalKeys(obj); 342 return %LocalKeys(obj);
340 } 343 }
341 344
342 345
343 // ES5 8.10.1. 346 // ES5 8.10.1.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 457
455 if (IsInconsistentDescriptor(desc)) { 458 if (IsInconsistentDescriptor(desc)) {
456 throw MakeTypeError("value_and_accessor", [obj]); 459 throw MakeTypeError("value_and_accessor", [obj]);
457 } 460 }
458 return desc; 461 return desc;
459 } 462 }
460 463
461 464
462 // For Harmony proxies. 465 // For Harmony proxies.
463 function ToCompletePropertyDescriptor(obj) { 466 function ToCompletePropertyDescriptor(obj) {
464 var desc = ToPropertyDescriptor(obj) 467 var desc = ToPropertyDescriptor(obj);
465 if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) { 468 if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) {
466 if (!desc.hasValue()) desc.setValue(void 0); 469 if (!desc.hasValue()) desc.setValue(void 0);
467 if (!desc.hasWritable()) desc.setWritable(false); 470 if (!desc.hasWritable()) desc.setWritable(false);
468 } else { 471 } else {
469 // Is accessor descriptor. 472 // Is accessor descriptor.
470 if (!desc.hasGetter()) desc.setGet(void 0); 473 if (!desc.hasGetter()) desc.setGet(void 0);
471 if (!desc.hasSetter()) desc.setSet(void 0); 474 if (!desc.hasSetter()) desc.setSet(void 0);
472 } 475 }
473 if (!desc.hasEnumerable()) desc.setEnumerable(false); 476 if (!desc.hasEnumerable()) desc.setEnumerable(false);
474 if (!desc.hasConfigurable()) desc.setConfigurable(false); 477 if (!desc.hasConfigurable()) desc.setConfigurable(false);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 if (desc.hasSetter()) { 841 if (desc.hasSetter()) {
839 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); 842 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag);
840 } 843 }
841 } 844 }
842 return true; 845 return true;
843 } 846 }
844 847
845 848
846 // ES5 section 15.2.3.2. 849 // ES5 section 15.2.3.2.
847 function ObjectGetPrototypeOf(obj) { 850 function ObjectGetPrototypeOf(obj) {
848 if (!IS_SPEC_OBJECT(obj)) 851 if (!IS_SPEC_OBJECT(obj)) {
849 throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]); 852 throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]);
853 }
850 return %GetPrototype(obj); 854 return %GetPrototype(obj);
851 } 855 }
852 856
853 857
854 // ES5 section 15.2.3.3 858 // ES5 section 15.2.3.3
855 function ObjectGetOwnPropertyDescriptor(obj, p) { 859 function ObjectGetOwnPropertyDescriptor(obj, p) {
856 if (!IS_SPEC_OBJECT(obj)) 860 if (!IS_SPEC_OBJECT(obj)) {
857 throw MakeTypeError("obj_ctor_property_non_object", 861 throw MakeTypeError("obj_ctor_property_non_object",
858 ["getOwnPropertyDescriptor"]); 862 ["getOwnPropertyDescriptor"]);
863 }
859 var desc = GetOwnProperty(obj, p); 864 var desc = GetOwnProperty(obj, p);
860 return FromPropertyDescriptor(desc); 865 return FromPropertyDescriptor(desc);
861 } 866 }
862 867
863 868
864 // For Harmony proxies 869 // For Harmony proxies
865 function ToStringArray(obj, trap) { 870 function ToStringArray(obj, trap) {
866 if (!IS_SPEC_OBJECT(obj)) { 871 if (!IS_SPEC_OBJECT(obj)) {
867 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); 872 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]);
868 } 873 }
869 var n = ToUint32(obj.length); 874 var n = ToUint32(obj.length);
870 var array = new $Array(n); 875 var array = new $Array(n);
871 var names = {} // TODO(rossberg): use sets once they are ready. 876 var names = {}; // TODO(rossberg): use sets once they are ready.
872 for (var index = 0; index < n; index++) { 877 for (var index = 0; index < n; index++) {
873 var s = ToString(obj[index]); 878 var s = ToString(obj[index]);
874 if (s in names) { 879 if (s in names) {
875 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) 880 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
876 } 881 }
877 array[index] = s; 882 array[index] = s;
878 names[s] = 0; 883 names[s] = 0;
879 } 884 }
880 return array; 885 return array;
881 } 886 }
882 887
883 888
884 // ES5 section 15.2.3.4. 889 // ES5 section 15.2.3.4.
885 function ObjectGetOwnPropertyNames(obj) { 890 function ObjectGetOwnPropertyNames(obj) {
886 if (!IS_SPEC_OBJECT(obj)) 891 if (!IS_SPEC_OBJECT(obj)) {
887 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]) ; 892 throw MakeTypeError("obj_ctor_property_non_object",
888 893 ["getOwnPropertyNames"]);
894 }
889 // Special handling for proxies. 895 // Special handling for proxies.
890 if (%IsJSProxy(obj)) { 896 if (%IsJSProxy(obj)) {
891 var handler = %GetHandler(obj); 897 var handler = %GetHandler(obj);
892 var names = CallTrap0(handler, "getOwnPropertyNames", void 0); 898 var names = CallTrap0(handler, "getOwnPropertyNames", void 0);
893 return ToStringArray(names, "getOwnPropertyNames"); 899 return ToStringArray(names, "getOwnPropertyNames");
894 } 900 }
895 901
896 // Find all the indexed properties. 902 // Find all the indexed properties.
897 903
898 // Get the local element names. 904 // Get the local element names.
899 var propertyNames = %GetLocalElementNames(obj); 905 var propertyNames = %GetLocalElementNames(obj);
900 906
901 // Get names for indexed interceptor properties. 907 // Get names for indexed interceptor properties.
902 if (%GetInterceptorInfo(obj) & 1) { 908 if (%GetInterceptorInfo(obj) & 1) {
903 var indexedInterceptorNames = 909 var indexedInterceptorNames =
904 %GetIndexedInterceptorElementNames(obj); 910 %GetIndexedInterceptorElementNames(obj);
905 if (indexedInterceptorNames) 911 if (indexedInterceptorNames) {
906 propertyNames = propertyNames.concat(indexedInterceptorNames); 912 propertyNames = propertyNames.concat(indexedInterceptorNames);
913 }
907 } 914 }
908 915
909 // Find all the named properties. 916 // Find all the named properties.
910 917
911 // Get the local property names. 918 // Get the local property names.
912 propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj)); 919 propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj));
913 920
914 // Get names for named interceptor properties if any. 921 // Get names for named interceptor properties if any.
915 922
916 if (%GetInterceptorInfo(obj) & 2) { 923 if (%GetInterceptorInfo(obj) & 2) {
917 var namedInterceptorNames = 924 var namedInterceptorNames =
918 %GetNamedInterceptorPropertyNames(obj); 925 %GetNamedInterceptorPropertyNames(obj);
919 if (namedInterceptorNames) { 926 if (namedInterceptorNames) {
920 propertyNames = propertyNames.concat(namedInterceptorNames); 927 propertyNames = propertyNames.concat(namedInterceptorNames);
921 } 928 }
922 } 929 }
923 930
924 // Property names are expected to be unique strings. 931 // Property names are expected to be unique strings.
925 var propertySet = {}; 932 var propertySet = {};
926 var j = 0; 933 var j = 0;
927 for (var i = 0; i < propertyNames.length; ++i) { 934 for (var i = 0; i < propertyNames.length; ++i) {
928 var name = ToString(propertyNames[i]); 935 var name = ToString(propertyNames[i]);
929 // We need to check for the exact property value since for intrinsic 936 // We need to check for the exact property value since for intrinsic
930 // properties like toString if(propertySet["toString"]) will always 937 // properties like toString if(propertySet["toString"]) will always
931 // succeed. 938 // succeed.
932 if (propertySet[name] === true) 939 if (propertySet[name] === true) {
933 continue; 940 continue;
941 }
934 propertySet[name] = true; 942 propertySet[name] = true;
935 propertyNames[j++] = name; 943 propertyNames[j++] = name;
936 } 944 }
937 propertyNames.length = j; 945 propertyNames.length = j;
938 946
939 return propertyNames; 947 return propertyNames;
940 } 948 }
941 949
942 950
943 // ES5 section 15.2.3.5. 951 // ES5 section 15.2.3.5.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 if (%HasLocalProperty(properties, key)) { 1007 if (%HasLocalProperty(properties, key)) {
1000 names.push(key); 1008 names.push(key);
1001 } 1009 }
1002 } 1010 }
1003 return names; 1011 return names;
1004 } 1012 }
1005 1013
1006 1014
1007 // ES5 section 15.2.3.7. 1015 // ES5 section 15.2.3.7.
1008 function ObjectDefineProperties(obj, properties) { 1016 function ObjectDefineProperties(obj, properties) {
1009 if (!IS_SPEC_OBJECT(obj)) 1017 if (!IS_SPEC_OBJECT(obj)) {
1010 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); 1018 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]);
1019 }
1011 var props = ToObject(properties); 1020 var props = ToObject(properties);
1012 var names = GetOwnEnumerablePropertyNames(props); 1021 var names = GetOwnEnumerablePropertyNames(props);
1013 var descriptors = new InternalArray(); 1022 var descriptors = new InternalArray();
1014 for (var i = 0; i < names.length; i++) { 1023 for (var i = 0; i < names.length; i++) {
1015 descriptors.push(ToPropertyDescriptor(props[names[i]])); 1024 descriptors.push(ToPropertyDescriptor(props[names[i]]));
1016 } 1025 }
1017 for (var i = 0; i < names.length; i++) { 1026 for (var i = 0; i < names.length; i++) {
1018 DefineOwnProperty(obj, names[i], descriptors[i], true); 1027 DefineOwnProperty(obj, names[i], descriptors[i], true);
1019 } 1028 }
1020 return obj; 1029 return obj;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 } 1234 }
1226 b = %_ValueOf(b); 1235 b = %_ValueOf(b);
1227 } 1236 }
1228 return b ? 'true' : 'false'; 1237 return b ? 'true' : 'false';
1229 } 1238 }
1230 1239
1231 1240
1232 function BooleanValueOf() { 1241 function BooleanValueOf() {
1233 // NOTE: Both Boolean objects and values can enter here as 1242 // NOTE: Both Boolean objects and values can enter here as
1234 // 'this'. This is not as dictated by ECMA-262. 1243 // 'this'. This is not as dictated by ECMA-262.
1235 if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) 1244 if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) {
1236 throw new $TypeError('Boolean.prototype.valueOf is not generic'); 1245 throw new $TypeError('Boolean.prototype.valueOf is not generic');
1246 }
1237 return %_ValueOf(this); 1247 return %_ValueOf(this);
1238 } 1248 }
1239 1249
1240 1250
1241 // ---------------------------------------------------------------------------- 1251 // ----------------------------------------------------------------------------
1242 1252
1243 1253
1244 function SetUpBoolean () { 1254 function SetUpBoolean () {
1245 %CheckIsBootstrapping(); 1255 %CheckIsBootstrapping();
1246 InstallFunctions($Boolean.prototype, DONT_ENUM, $Array( 1256 InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
(...skipping 19 matching lines...) Expand all
1266 }); 1276 });
1267 1277
1268 %FunctionSetPrototype($Number, new $Number(0)); 1278 %FunctionSetPrototype($Number, new $Number(0));
1269 1279
1270 // ECMA-262 section 15.7.4.2. 1280 // ECMA-262 section 15.7.4.2.
1271 function NumberToString(radix) { 1281 function NumberToString(radix) {
1272 // NOTE: Both Number objects and values can enter here as 1282 // NOTE: Both Number objects and values can enter here as
1273 // 'this'. This is not as dictated by ECMA-262. 1283 // 'this'. This is not as dictated by ECMA-262.
1274 var number = this; 1284 var number = this;
1275 if (!IS_NUMBER(this)) { 1285 if (!IS_NUMBER(this)) {
1276 if (!IS_NUMBER_WRAPPER(this)) 1286 if (!IS_NUMBER_WRAPPER(this)) {
1277 throw new $TypeError('Number.prototype.toString is not generic'); 1287 throw new $TypeError('Number.prototype.toString is not generic');
1288 }
1278 // Get the value of this number in case it's an object. 1289 // Get the value of this number in case it's an object.
1279 number = %_ValueOf(this); 1290 number = %_ValueOf(this);
1280 } 1291 }
1281 // Fast case: Convert number in radix 10. 1292 // Fast case: Convert number in radix 10.
1282 if (IS_UNDEFINED(radix) || radix === 10) { 1293 if (IS_UNDEFINED(radix) || radix === 10) {
1283 return %_NumberToString(number); 1294 return %_NumberToString(number);
1284 } 1295 }
1285 1296
1286 // Convert the radix to an integer and check the range. 1297 // Convert the radix to an integer and check the range.
1287 radix = TO_INTEGER(radix); 1298 radix = TO_INTEGER(radix);
(...skipping 12 matching lines...) Expand all
1300 ["Number.prototype.toLocaleString"]); 1311 ["Number.prototype.toLocaleString"]);
1301 } 1312 }
1302 return this.toString(); 1313 return this.toString();
1303 } 1314 }
1304 1315
1305 1316
1306 // ECMA-262 section 15.7.4.4 1317 // ECMA-262 section 15.7.4.4
1307 function NumberValueOf() { 1318 function NumberValueOf() {
1308 // NOTE: Both Number objects and values can enter here as 1319 // NOTE: Both Number objects and values can enter here as
1309 // 'this'. This is not as dictated by ECMA-262. 1320 // 'this'. This is not as dictated by ECMA-262.
1310 if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) 1321 if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) {
1311 throw new $TypeError('Number.prototype.valueOf is not generic'); 1322 throw new $TypeError('Number.prototype.valueOf is not generic');
1323 }
1312 return %_ValueOf(this); 1324 return %_ValueOf(this);
1313 } 1325 }
1314 1326
1315 1327
1316 // ECMA-262 section 15.7.4.5 1328 // ECMA-262 section 15.7.4.5
1317 function NumberToFixed(fractionDigits) { 1329 function NumberToFixed(fractionDigits) {
1318 var f = TO_INTEGER(fractionDigits); 1330 var f = TO_INTEGER(fractionDigits);
1319 if (f < 0 || f > 20) { 1331 if (f < 0 || f > 20) {
1320 throw new $RangeError("toFixed() digits argument must be between 0 and 20"); 1332 throw new $RangeError("toFixed() digits argument must be between 0 and 20");
1321 } 1333 }
1322 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { 1334 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1323 throw MakeTypeError("called_on_null_or_undefined", 1335 throw MakeTypeError("called_on_null_or_undefined",
1324 ["Number.prototype.toFixed"]); 1336 ["Number.prototype.toFixed"]);
1325 } 1337 }
1326 var x = ToNumber(this); 1338 var x = ToNumber(this);
1327 return %NumberToFixed(x, f); 1339 return %NumberToFixed(x, f);
1328 } 1340 }
1329 1341
1330 1342
1331 // ECMA-262 section 15.7.4.6 1343 // ECMA-262 section 15.7.4.6
1332 function NumberToExponential(fractionDigits) { 1344 function NumberToExponential(fractionDigits) {
1333 var f = -1; 1345 var f = -1;
1334 if (!IS_UNDEFINED(fractionDigits)) { 1346 if (!IS_UNDEFINED(fractionDigits)) {
1335 f = TO_INTEGER(fractionDigits); 1347 f = TO_INTEGER(fractionDigits);
1336 if (f < 0 || f > 20) { 1348 if (f < 0 || f > 20) {
1337 throw new $RangeError("toExponential() argument must be between 0 and 20") ; 1349 throw new $RangeError(
1350 "toExponential() argument must be between 0 and 20");
1338 } 1351 }
1339 } 1352 }
1340 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { 1353 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
1341 throw MakeTypeError("called_on_null_or_undefined", 1354 throw MakeTypeError("called_on_null_or_undefined",
1342 ["Number.prototype.toExponential"]); 1355 ["Number.prototype.toExponential"]);
1343 } 1356 }
1344 var x = ToNumber(this); 1357 var x = ToNumber(this);
1345 return %NumberToExponential(x, f); 1358 return %NumberToExponential(x, f);
1346 } 1359 }
1347 1360
(...skipping 23 matching lines...) Expand all
1371 %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM); 1384 %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
1372 1385
1373 %OptimizeObjectForAddingMultipleProperties($Number, 5); 1386 %OptimizeObjectForAddingMultipleProperties($Number, 5);
1374 // ECMA-262 section 15.7.3.1. 1387 // ECMA-262 section 15.7.3.1.
1375 %SetProperty($Number, 1388 %SetProperty($Number,
1376 "MAX_VALUE", 1389 "MAX_VALUE",
1377 1.7976931348623157e+308, 1390 1.7976931348623157e+308,
1378 DONT_ENUM | DONT_DELETE | READ_ONLY); 1391 DONT_ENUM | DONT_DELETE | READ_ONLY);
1379 1392
1380 // ECMA-262 section 15.7.3.2. 1393 // ECMA-262 section 15.7.3.2.
1381 %SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY ); 1394 %SetProperty($Number, "MIN_VALUE", 5e-324,
1395 DONT_ENUM | DONT_DELETE | READ_ONLY);
1382 1396
1383 // ECMA-262 section 15.7.3.3. 1397 // ECMA-262 section 15.7.3.3.
1384 %SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY); 1398 %SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
1385 1399
1386 // ECMA-262 section 15.7.3.4. 1400 // ECMA-262 section 15.7.3.4.
1387 %SetProperty($Number, 1401 %SetProperty($Number,
1388 "NEGATIVE_INFINITY", 1402 "NEGATIVE_INFINITY",
1389 -1/0, 1403 -1/0,
1390 DONT_ENUM | DONT_DELETE | READ_ONLY); 1404 DONT_ENUM | DONT_DELETE | READ_ONLY);
1391 1405
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 if ((typeof old_length === "number") && 1503 if ((typeof old_length === "number") &&
1490 ((old_length >>> 0) === old_length)) { 1504 ((old_length >>> 0) === old_length)) {
1491 var argc = %_ArgumentsLength(); 1505 var argc = %_ArgumentsLength();
1492 if (argc > 0) argc--; // Don't count the thisArg as parameter. 1506 if (argc > 0) argc--; // Don't count the thisArg as parameter.
1493 new_length = old_length - argc; 1507 new_length = old_length - argc;
1494 if (new_length < 0) new_length = 0; 1508 if (new_length < 0) new_length = 0;
1495 } 1509 }
1496 } 1510 }
1497 // This runtime function finds any remaining arguments on the stack, 1511 // This runtime function finds any remaining arguments on the stack,
1498 // so we don't pass the arguments object. 1512 // so we don't pass the arguments object.
1499 var result = %FunctionBindArguments(boundFunction, this, this_arg, new_length) ; 1513 var result = %FunctionBindArguments(boundFunction, this,
1514 this_arg, new_length);
1500 1515
1501 // We already have caller and arguments properties on functions, 1516 // We already have caller and arguments properties on functions,
1502 // which are non-configurable. It therefore makes no sence to 1517 // which are non-configurable. It therefore makes no sence to
1503 // try to redefine these as defined by the spec. The spec says 1518 // try to redefine these as defined by the spec. The spec says
1504 // that bind should make these throw a TypeError if get or set 1519 // that bind should make these throw a TypeError if get or set
1505 // is called and make them non-enumerable and non-configurable. 1520 // is called and make them non-enumerable and non-configurable.
1506 // To be consistent with our normal functions we leave this as it is. 1521 // To be consistent with our normal functions we leave this as it is.
1507 // TODO(lrn): Do set these to be thrower. 1522 // TODO(lrn): Do set these to be thrower.
1508 return result; 1523 return result;
1509 } 1524 }
(...skipping 27 matching lines...) Expand all
1537 1552
1538 function SetUpFunction() { 1553 function SetUpFunction() {
1539 %CheckIsBootstrapping(); 1554 %CheckIsBootstrapping();
1540 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1555 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1541 "bind", FunctionBind, 1556 "bind", FunctionBind,
1542 "toString", FunctionToString 1557 "toString", FunctionToString
1543 )); 1558 ));
1544 } 1559 }
1545 1560
1546 SetUpFunction(); 1561 SetUpFunction();
OLDNEW
« no previous file with comments | « src/uri.js ('k') | test/mjsunit/bugs/bug-618.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698