OLD | NEW |
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 | 451 |
452 function NumberToJSON(key) { | 452 function NumberToJSON(key) { |
453 return CheckJSONPrimitive(this.valueOf()); | 453 return CheckJSONPrimitive(this.valueOf()); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 // ---------------------------------------------------------------------------- | 457 // ---------------------------------------------------------------------------- |
458 | 458 |
459 function SetupNumber() { | 459 function SetupNumber() { |
| 460 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); |
460 // Setup the constructor property on the Number prototype object. | 461 // Setup the constructor property on the Number prototype object. |
461 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); | |
462 %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM); | 462 %SetProperty($Number.prototype, "constructor", $Number, DONT_ENUM); |
463 | 463 |
464 %OptimizeObjectForAddingMultipleProperties($Number, 5); | 464 %OptimizeObjectForAddingMultipleProperties($Number, 5); |
465 // ECMA-262 section 15.7.3.1. | 465 // ECMA-262 section 15.7.3.1. |
466 %SetProperty($Number, | 466 %SetProperty($Number, |
467 "MAX_VALUE", | 467 "MAX_VALUE", |
468 1.7976931348623157e+308, | 468 1.7976931348623157e+308, |
469 DONT_ENUM | DONT_DELETE | READ_ONLY); | 469 DONT_ENUM | DONT_DELETE | READ_ONLY); |
470 | 470 |
471 // ECMA-262 section 15.7.3.2. | 471 // ECMA-262 section 15.7.3.2. |
472 %SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY
); | 472 %SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY
); |
473 | 473 |
474 // ECMA-262 section 15.7.3.3. | 474 // ECMA-262 section 15.7.3.3. |
475 %SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY); | 475 %SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY); |
476 | 476 |
477 // ECMA-262 section 15.7.3.4. | 477 // ECMA-262 section 15.7.3.4. |
478 %SetProperty($Number, | 478 %SetProperty($Number, |
479 "NEGATIVE_INFINITY", | 479 "NEGATIVE_INFINITY", |
480 -1/0, | 480 -1/0, |
481 DONT_ENUM | DONT_DELETE | READ_ONLY); | 481 DONT_ENUM | DONT_DELETE | READ_ONLY); |
482 | 482 |
483 // ECMA-262 section 15.7.3.5. | 483 // ECMA-262 section 15.7.3.5. |
484 %SetProperty($Number, | 484 %SetProperty($Number, |
485 "POSITIVE_INFINITY", | 485 "POSITIVE_INFINITY", |
486 1/0, | 486 1/0, |
487 DONT_ENUM | DONT_DELETE | READ_ONLY); | 487 DONT_ENUM | DONT_DELETE | READ_ONLY); |
| 488 %TransformToFastProperties($Number); |
488 | 489 |
489 // Setup non-enumerable functions on the Number prototype object. | 490 // Setup non-enumerable functions on the Number prototype object. |
490 InstallFunctions($Number.prototype, DONT_ENUM, $Array( | 491 InstallFunctions($Number.prototype, DONT_ENUM, $Array( |
491 "toString", NumberToString, | 492 "toString", NumberToString, |
492 "toLocaleString", NumberToLocaleString, | 493 "toLocaleString", NumberToLocaleString, |
493 "valueOf", NumberValueOf, | 494 "valueOf", NumberValueOf, |
494 "toFixed", NumberToFixed, | 495 "toFixed", NumberToFixed, |
495 "toExponential", NumberToExponential, | 496 "toExponential", NumberToExponential, |
496 "toPrecision", NumberToPrecision, | 497 "toPrecision", NumberToPrecision, |
497 "toJSON", NumberToJSON | 498 "toJSON", NumberToJSON |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 569 |
569 // ---------------------------------------------------------------------------- | 570 // ---------------------------------------------------------------------------- |
570 | 571 |
571 function SetupFunction() { | 572 function SetupFunction() { |
572 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 573 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
573 "toString", FunctionToString | 574 "toString", FunctionToString |
574 )); | 575 )); |
575 } | 576 } |
576 | 577 |
577 SetupFunction(); | 578 SetupFunction(); |
OLD | NEW |