| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // ECMA 262 - 15.1.1.1. | 194 // ECMA 262 - 15.1.1.1. |
| 195 %AddNamedProperty(global, "NaN", NAN, attributes); | 195 %AddNamedProperty(global, "NaN", NAN, attributes); |
| 196 | 196 |
| 197 // ECMA-262 - 15.1.1.2. | 197 // ECMA-262 - 15.1.1.2. |
| 198 %AddNamedProperty(global, "Infinity", INFINITY, attributes); | 198 %AddNamedProperty(global, "Infinity", INFINITY, attributes); |
| 199 | 199 |
| 200 // ECMA-262 - 15.1.1.3. | 200 // ECMA-262 - 15.1.1.3. |
| 201 %AddNamedProperty(global, "undefined", UNDEFINED, attributes); | 201 %AddNamedProperty(global, "undefined", UNDEFINED, attributes); |
| 202 | 202 |
| 203 // Set up non-enumerable function on the global object. | 203 // Set up non-enumerable function on the global object. |
| 204 InstallFunctions(global, DONT_ENUM, $Array( | 204 InstallFunctions(global, DONT_ENUM, [ |
| 205 "isNaN", GlobalIsNaN, | 205 "isNaN", GlobalIsNaN, |
| 206 "isFinite", GlobalIsFinite, | 206 "isFinite", GlobalIsFinite, |
| 207 "parseInt", GlobalParseInt, | 207 "parseInt", GlobalParseInt, |
| 208 "parseFloat", GlobalParseFloat, | 208 "parseFloat", GlobalParseFloat, |
| 209 "eval", GlobalEval | 209 "eval", GlobalEval |
| 210 )); | 210 ]); |
| 211 } | 211 } |
| 212 | 212 |
| 213 SetUpGlobal(); | 213 SetUpGlobal(); |
| 214 | 214 |
| 215 | 215 |
| 216 // ---------------------------------------------------------------------------- | 216 // ---------------------------------------------------------------------------- |
| 217 // Object | 217 // Object |
| 218 | 218 |
| 219 var DefaultObjectToString = ObjectToString; | 219 var DefaultObjectToString = ObjectToString; |
| 220 // ECMA-262 - 15.2.4.2 | 220 // ECMA-262 - 15.2.4.2 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 this.enumerable_ = false; | 502 this.enumerable_ = false; |
| 503 this.hasEnumerable_ = false; | 503 this.hasEnumerable_ = false; |
| 504 this.configurable_ = false; | 504 this.configurable_ = false; |
| 505 this.hasConfigurable_ = false; | 505 this.hasConfigurable_ = false; |
| 506 this.get_ = UNDEFINED; | 506 this.get_ = UNDEFINED; |
| 507 this.hasGetter_ = false; | 507 this.hasGetter_ = false; |
| 508 this.set_ = UNDEFINED; | 508 this.set_ = UNDEFINED; |
| 509 this.hasSetter_ = false; | 509 this.hasSetter_ = false; |
| 510 } | 510 } |
| 511 | 511 |
| 512 SetUpLockedPrototype(PropertyDescriptor, $Array( | 512 SetUpLockedPrototype(PropertyDescriptor, [ |
| 513 "value_", | 513 "value_", |
| 514 "hasValue_", | 514 "hasValue_", |
| 515 "writable_", | 515 "writable_", |
| 516 "hasWritable_", | 516 "hasWritable_", |
| 517 "enumerable_", | 517 "enumerable_", |
| 518 "hasEnumerable_", | 518 "hasEnumerable_", |
| 519 "configurable_", | 519 "configurable_", |
| 520 "hasConfigurable_", | 520 "hasConfigurable_", |
| 521 "get_", | 521 "get_", |
| 522 "hasGetter_", | 522 "hasGetter_", |
| 523 "set_", | 523 "set_", |
| 524 "hasSetter_" | 524 "hasSetter_" |
| 525 ), $Array( | 525 ], [ |
| 526 "toString", function PropertyDescriptor_ToString() { | 526 "toString", function PropertyDescriptor_ToString() { |
| 527 return "[object PropertyDescriptor]"; | 527 return "[object PropertyDescriptor]"; |
| 528 }, | 528 }, |
| 529 "setValue", function PropertyDescriptor_SetValue(value) { | 529 "setValue", function PropertyDescriptor_SetValue(value) { |
| 530 this.value_ = value; | 530 this.value_ = value; |
| 531 this.hasValue_ = true; | 531 this.hasValue_ = true; |
| 532 }, | 532 }, |
| 533 "getValue", function PropertyDescriptor_GetValue() { | 533 "getValue", function PropertyDescriptor_GetValue() { |
| 534 return this.value_; | 534 return this.value_; |
| 535 }, | 535 }, |
| 536 "hasValue", function PropertyDescriptor_HasValue() { | 536 "hasValue", function PropertyDescriptor_HasValue() { |
| 537 return this.hasValue_; | 537 return this.hasValue_; |
| 538 }, | 538 }, |
| 539 "setEnumerable", function PropertyDescriptor_SetEnumerable(enumerable) { | 539 "setEnumerable", function PropertyDescriptor_SetEnumerable(enumerable) { |
| 540 this.enumerable_ = enumerable; | 540 this.enumerable_ = enumerable; |
| 541 this.hasEnumerable_ = true; | 541 this.hasEnumerable_ = true; |
| 542 }, | 542 }, |
| 543 "isEnumerable", function PropertyDescriptor_IsEnumerable() { | 543 "isEnumerable", function PropertyDescriptor_IsEnumerable() { |
| 544 return this.enumerable_; | 544 return this.enumerable_; |
| 545 }, | 545 }, |
| 546 "hasEnumerable", function PropertyDescriptor_HasEnumerable() { | 546 "hasEnumerable", function PropertyDescriptor_HasEnumerable() { |
| 547 return this.hasEnumerable_; | 547 return this.hasEnumerable_; |
| 548 }, | 548 }, |
| 549 "setWritable", function PropertyDescriptor_SetWritable(writable) { | 549 "setWritable", function PropertyDescriptor_SetWritable(writable) { |
| 550 this.writable_ = writable; | 550 this.writable_ = writable; |
| 551 this.hasWritable_ = true; | 551 this.hasWritable_ = true; |
| 552 }, | 552 }, |
| 553 "isWritable", function PropertyDescriptor_IsWritable() { | 553 "isWritable", function PropertyDescriptor_IsWritable() { |
| 554 return this.writable_; | 554 return this.writable_; |
| 555 }, | 555 }, |
| 556 "hasWritable", function PropertyDescriptor_HasWritable() { | 556 "hasWritable", function PropertyDescriptor_HasWritable() { |
| 557 return this.hasWritable_; | 557 return this.hasWritable_; |
| 558 }, | 558 }, |
| 559 "setConfigurable", | 559 "setConfigurable", |
| 560 function PropertyDescriptor_SetConfigurable(configurable) { | 560 function PropertyDescriptor_SetConfigurable(configurable) { |
| 561 this.configurable_ = configurable; | 561 this.configurable_ = configurable; |
| 562 this.hasConfigurable_ = true; | 562 this.hasConfigurable_ = true; |
| 563 }, | 563 }, |
| 564 "hasConfigurable", function PropertyDescriptor_HasConfigurable() { | 564 "hasConfigurable", function PropertyDescriptor_HasConfigurable() { |
| 565 return this.hasConfigurable_; | 565 return this.hasConfigurable_; |
| 566 }, | 566 }, |
| 567 "isConfigurable", function PropertyDescriptor_IsConfigurable() { | 567 "isConfigurable", function PropertyDescriptor_IsConfigurable() { |
| 568 return this.configurable_; | 568 return this.configurable_; |
| 569 }, | 569 }, |
| 570 "setGet", function PropertyDescriptor_SetGetter(get) { | 570 "setGet", function PropertyDescriptor_SetGetter(get) { |
| 571 this.get_ = get; | 571 this.get_ = get; |
| 572 this.hasGetter_ = true; | 572 this.hasGetter_ = true; |
| 573 }, | 573 }, |
| 574 "getGet", function PropertyDescriptor_GetGetter() { | 574 "getGet", function PropertyDescriptor_GetGetter() { |
| 575 return this.get_; | 575 return this.get_; |
| 576 }, | 576 }, |
| 577 "hasGetter", function PropertyDescriptor_HasGetter() { | 577 "hasGetter", function PropertyDescriptor_HasGetter() { |
| 578 return this.hasGetter_; | 578 return this.hasGetter_; |
| 579 }, | 579 }, |
| 580 "setSet", function PropertyDescriptor_SetSetter(set) { | 580 "setSet", function PropertyDescriptor_SetSetter(set) { |
| 581 this.set_ = set; | 581 this.set_ = set; |
| 582 this.hasSetter_ = true; | 582 this.hasSetter_ = true; |
| 583 }, | 583 }, |
| 584 "getSet", function PropertyDescriptor_GetSetter() { | 584 "getSet", function PropertyDescriptor_GetSetter() { |
| 585 return this.set_; | 585 return this.set_; |
| 586 }, | 586 }, |
| 587 "hasSetter", function PropertyDescriptor_HasSetter() { | 587 "hasSetter", function PropertyDescriptor_HasSetter() { |
| 588 return this.hasSetter_; | 588 return this.hasSetter_; |
| 589 })); | 589 } |
| 590 ]); |
| 590 | 591 |
| 591 | 592 |
| 592 // Converts an array returned from Runtime_GetOwnProperty to an actual | 593 // Converts an array returned from Runtime_GetOwnProperty to an actual |
| 593 // property descriptor. For a description of the array layout please | 594 // property descriptor. For a description of the array layout please |
| 594 // see the runtime.cc file. | 595 // see the runtime.cc file. |
| 595 function ConvertDescriptorArrayToDescriptor(desc_array) { | 596 function ConvertDescriptorArrayToDescriptor(desc_array) { |
| 596 if (IS_UNDEFINED(desc_array)) { | 597 if (IS_UNDEFINED(desc_array)) { |
| 597 return UNDEFINED; | 598 return UNDEFINED; |
| 598 } | 599 } |
| 599 | 600 |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 | 1424 |
| 1424 function SetUpObject() { | 1425 function SetUpObject() { |
| 1425 %CheckIsBootstrapping(); | 1426 %CheckIsBootstrapping(); |
| 1426 | 1427 |
| 1427 %SetNativeFlag($Object); | 1428 %SetNativeFlag($Object); |
| 1428 %SetCode($Object, ObjectConstructor); | 1429 %SetCode($Object, ObjectConstructor); |
| 1429 | 1430 |
| 1430 %AddNamedProperty($Object.prototype, "constructor", $Object, DONT_ENUM); | 1431 %AddNamedProperty($Object.prototype, "constructor", $Object, DONT_ENUM); |
| 1431 | 1432 |
| 1432 // Set up non-enumerable functions on the Object.prototype object. | 1433 // Set up non-enumerable functions on the Object.prototype object. |
| 1433 InstallFunctions($Object.prototype, DONT_ENUM, $Array( | 1434 InstallFunctions($Object.prototype, DONT_ENUM, [ |
| 1434 "toString", ObjectToString, | 1435 "toString", ObjectToString, |
| 1435 "toLocaleString", ObjectToLocaleString, | 1436 "toLocaleString", ObjectToLocaleString, |
| 1436 "valueOf", ObjectValueOf, | 1437 "valueOf", ObjectValueOf, |
| 1437 "hasOwnProperty", ObjectHasOwnProperty, | 1438 "hasOwnProperty", ObjectHasOwnProperty, |
| 1438 "isPrototypeOf", ObjectIsPrototypeOf, | 1439 "isPrototypeOf", ObjectIsPrototypeOf, |
| 1439 "propertyIsEnumerable", ObjectPropertyIsEnumerable, | 1440 "propertyIsEnumerable", ObjectPropertyIsEnumerable, |
| 1440 "__defineGetter__", ObjectDefineGetter, | 1441 "__defineGetter__", ObjectDefineGetter, |
| 1441 "__lookupGetter__", ObjectLookupGetter, | 1442 "__lookupGetter__", ObjectLookupGetter, |
| 1442 "__defineSetter__", ObjectDefineSetter, | 1443 "__defineSetter__", ObjectDefineSetter, |
| 1443 "__lookupSetter__", ObjectLookupSetter | 1444 "__lookupSetter__", ObjectLookupSetter |
| 1444 )); | 1445 ]); |
| 1445 InstallGetterSetter($Object.prototype, "__proto__", | 1446 InstallGetterSetter($Object.prototype, "__proto__", |
| 1446 ObjectGetProto, ObjectSetProto); | 1447 ObjectGetProto, ObjectSetProto); |
| 1447 | 1448 |
| 1448 // Set up non-enumerable functions in the Object object. | 1449 // Set up non-enumerable functions in the Object object. |
| 1449 InstallFunctions($Object, DONT_ENUM, $Array( | 1450 InstallFunctions($Object, DONT_ENUM, [ |
| 1450 "keys", ObjectKeys, | 1451 "keys", ObjectKeys, |
| 1451 "create", ObjectCreate, | 1452 "create", ObjectCreate, |
| 1452 "defineProperty", ObjectDefineProperty, | 1453 "defineProperty", ObjectDefineProperty, |
| 1453 "defineProperties", ObjectDefineProperties, | 1454 "defineProperties", ObjectDefineProperties, |
| 1454 "freeze", ObjectFreezeJS, | 1455 "freeze", ObjectFreezeJS, |
| 1455 "getPrototypeOf", ObjectGetPrototypeOf, | 1456 "getPrototypeOf", ObjectGetPrototypeOf, |
| 1456 "setPrototypeOf", ObjectSetPrototypeOf, | 1457 "setPrototypeOf", ObjectSetPrototypeOf, |
| 1457 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, | 1458 "getOwnPropertyDescriptor", ObjectGetOwnPropertyDescriptor, |
| 1458 "getOwnPropertyNames", ObjectGetOwnPropertyNames, | 1459 "getOwnPropertyNames", ObjectGetOwnPropertyNames, |
| 1459 // getOwnPropertySymbols is added in symbol.js. | 1460 // getOwnPropertySymbols is added in symbol.js. |
| 1460 "is", ObjectIs, | 1461 "is", ObjectIs, |
| 1461 "isExtensible", ObjectIsExtensible, | 1462 "isExtensible", ObjectIsExtensible, |
| 1462 "isFrozen", ObjectIsFrozen, | 1463 "isFrozen", ObjectIsFrozen, |
| 1463 "isSealed", ObjectIsSealed, | 1464 "isSealed", ObjectIsSealed, |
| 1464 "preventExtensions", ObjectPreventExtension, | 1465 "preventExtensions", ObjectPreventExtension, |
| 1465 "seal", ObjectSealJS | 1466 "seal", ObjectSealJS |
| 1466 // deliverChangeRecords, getNotifier, observe and unobserve are added | 1467 // deliverChangeRecords, getNotifier, observe and unobserve are added |
| 1467 // in object-observe.js. | 1468 // in object-observe.js. |
| 1468 )); | 1469 ]); |
| 1469 } | 1470 } |
| 1470 | 1471 |
| 1471 SetUpObject(); | 1472 SetUpObject(); |
| 1472 | 1473 |
| 1473 | 1474 |
| 1474 // ---------------------------------------------------------------------------- | 1475 // ---------------------------------------------------------------------------- |
| 1475 // Boolean | 1476 // Boolean |
| 1476 | 1477 |
| 1477 function BooleanConstructor(x) { | 1478 function BooleanConstructor(x) { |
| 1478 if (%_IsConstructCall()) { | 1479 if (%_IsConstructCall()) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1509 | 1510 |
| 1510 // ---------------------------------------------------------------------------- | 1511 // ---------------------------------------------------------------------------- |
| 1511 | 1512 |
| 1512 function SetUpBoolean () { | 1513 function SetUpBoolean () { |
| 1513 %CheckIsBootstrapping(); | 1514 %CheckIsBootstrapping(); |
| 1514 | 1515 |
| 1515 %SetCode($Boolean, BooleanConstructor); | 1516 %SetCode($Boolean, BooleanConstructor); |
| 1516 %FunctionSetPrototype($Boolean, new $Object()); | 1517 %FunctionSetPrototype($Boolean, new $Object()); |
| 1517 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); | 1518 %AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM); |
| 1518 | 1519 |
| 1519 InstallFunctions($Boolean.prototype, DONT_ENUM, $Array( | 1520 InstallFunctions($Boolean.prototype, DONT_ENUM, [ |
| 1520 "toString", BooleanToString, | 1521 "toString", BooleanToString, |
| 1521 "valueOf", BooleanValueOf | 1522 "valueOf", BooleanValueOf |
| 1522 )); | 1523 ]); |
| 1523 } | 1524 } |
| 1524 | 1525 |
| 1525 SetUpBoolean(); | 1526 SetUpBoolean(); |
| 1526 | 1527 |
| 1527 | 1528 |
| 1528 // ---------------------------------------------------------------------------- | 1529 // ---------------------------------------------------------------------------- |
| 1529 // Number | 1530 // Number |
| 1530 | 1531 |
| 1531 function NumberConstructor(x) { | 1532 function NumberConstructor(x) { |
| 1532 var value = %_ArgumentsLength() == 0 ? 0 : ToNumber(x); | 1533 var value = %_ArgumentsLength() == 0 ? 0 : ToNumber(x); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 function SetUpNumber() { | 1692 function SetUpNumber() { |
| 1692 %CheckIsBootstrapping(); | 1693 %CheckIsBootstrapping(); |
| 1693 | 1694 |
| 1694 %SetCode($Number, NumberConstructor); | 1695 %SetCode($Number, NumberConstructor); |
| 1695 %FunctionSetPrototype($Number, new $Object()); | 1696 %FunctionSetPrototype($Number, new $Object()); |
| 1696 | 1697 |
| 1697 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); | 1698 %OptimizeObjectForAddingMultipleProperties($Number.prototype, 8); |
| 1698 // Set up the constructor property on the Number prototype object. | 1699 // Set up the constructor property on the Number prototype object. |
| 1699 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM); | 1700 %AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM); |
| 1700 | 1701 |
| 1701 InstallConstants($Number, $Array( | 1702 InstallConstants($Number, [ |
| 1702 // ECMA-262 section 15.7.3.1. | 1703 // ECMA-262 section 15.7.3.1. |
| 1703 "MAX_VALUE", 1.7976931348623157e+308, | 1704 "MAX_VALUE", 1.7976931348623157e+308, |
| 1704 // ECMA-262 section 15.7.3.2. | 1705 // ECMA-262 section 15.7.3.2. |
| 1705 "MIN_VALUE", 5e-324, | 1706 "MIN_VALUE", 5e-324, |
| 1706 // ECMA-262 section 15.7.3.3. | 1707 // ECMA-262 section 15.7.3.3. |
| 1707 "NaN", NAN, | 1708 "NaN", NAN, |
| 1708 // ECMA-262 section 15.7.3.4. | 1709 // ECMA-262 section 15.7.3.4. |
| 1709 "NEGATIVE_INFINITY", -INFINITY, | 1710 "NEGATIVE_INFINITY", -INFINITY, |
| 1710 // ECMA-262 section 15.7.3.5. | 1711 // ECMA-262 section 15.7.3.5. |
| 1711 "POSITIVE_INFINITY", INFINITY, | 1712 "POSITIVE_INFINITY", INFINITY, |
| 1712 | 1713 |
| 1713 // --- Harmony constants (no spec refs until settled.) | 1714 // --- Harmony constants (no spec refs until settled.) |
| 1714 | 1715 |
| 1715 "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1, | 1716 "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1, |
| 1716 "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1, | 1717 "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1, |
| 1717 "EPSILON", %_MathPow(2, -52) | 1718 "EPSILON", %_MathPow(2, -52) |
| 1718 )); | 1719 ]); |
| 1719 | 1720 |
| 1720 // Set up non-enumerable functions on the Number prototype object. | 1721 // Set up non-enumerable functions on the Number prototype object. |
| 1721 InstallFunctions($Number.prototype, DONT_ENUM, $Array( | 1722 InstallFunctions($Number.prototype, DONT_ENUM, [ |
| 1722 "toString", NumberToStringJS, | 1723 "toString", NumberToStringJS, |
| 1723 "toLocaleString", NumberToLocaleString, | 1724 "toLocaleString", NumberToLocaleString, |
| 1724 "valueOf", NumberValueOf, | 1725 "valueOf", NumberValueOf, |
| 1725 "toFixed", NumberToFixedJS, | 1726 "toFixed", NumberToFixedJS, |
| 1726 "toExponential", NumberToExponentialJS, | 1727 "toExponential", NumberToExponentialJS, |
| 1727 "toPrecision", NumberToPrecisionJS | 1728 "toPrecision", NumberToPrecisionJS |
| 1728 )); | 1729 ]); |
| 1729 | 1730 |
| 1730 // Harmony Number constructor additions | 1731 // Harmony Number constructor additions |
| 1731 InstallFunctions($Number, DONT_ENUM, $Array( | 1732 InstallFunctions($Number, DONT_ENUM, [ |
| 1732 "isFinite", NumberIsFinite, | 1733 "isFinite", NumberIsFinite, |
| 1733 "isInteger", NumberIsInteger, | 1734 "isInteger", NumberIsInteger, |
| 1734 "isNaN", NumberIsNaN, | 1735 "isNaN", NumberIsNaN, |
| 1735 "isSafeInteger", NumberIsSafeInteger, | 1736 "isSafeInteger", NumberIsSafeInteger, |
| 1736 "parseInt", GlobalParseInt, | 1737 "parseInt", GlobalParseInt, |
| 1737 "parseFloat", GlobalParseFloat | 1738 "parseFloat", GlobalParseFloat |
| 1738 )); | 1739 ]); |
| 1739 | 1740 |
| 1740 %SetInlineBuiltinFlag(NumberIsNaN); | 1741 %SetInlineBuiltinFlag(NumberIsNaN); |
| 1741 } | 1742 } |
| 1742 | 1743 |
| 1743 SetUpNumber(); | 1744 SetUpNumber(); |
| 1744 | 1745 |
| 1745 | 1746 |
| 1746 // ---------------------------------------------------------------------------- | 1747 // ---------------------------------------------------------------------------- |
| 1747 // Function | 1748 // Function |
| 1748 | 1749 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1888 |
| 1888 | 1889 |
| 1889 // ---------------------------------------------------------------------------- | 1890 // ---------------------------------------------------------------------------- |
| 1890 | 1891 |
| 1891 function SetUpFunction() { | 1892 function SetUpFunction() { |
| 1892 %CheckIsBootstrapping(); | 1893 %CheckIsBootstrapping(); |
| 1893 | 1894 |
| 1894 %SetCode($Function, FunctionConstructor); | 1895 %SetCode($Function, FunctionConstructor); |
| 1895 %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM); | 1896 %AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
| 1896 | 1897 |
| 1897 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1898 InstallFunctions($Function.prototype, DONT_ENUM, [ |
| 1898 "bind", FunctionBind, | 1899 "bind", FunctionBind, |
| 1899 "toString", FunctionToString | 1900 "toString", FunctionToString |
| 1900 )); | 1901 ]); |
| 1901 } | 1902 } |
| 1902 | 1903 |
| 1903 SetUpFunction(); | 1904 SetUpFunction(); |
| 1904 | 1905 |
| 1905 | 1906 |
| 1906 // ---------------------------------------------------------------------------- | 1907 // ---------------------------------------------------------------------------- |
| 1907 // Iterator related spec functions. | 1908 // Iterator related spec functions. |
| 1908 | 1909 |
| 1909 // ES6 rev 33, 2015-02-12 | 1910 // ES6 rev 33, 2015-02-12 |
| 1910 // 7.4.1 GetIterator ( obj, method ) | 1911 // 7.4.1 GetIterator ( obj, method ) |
| 1911 function GetIterator(obj, method) { | 1912 function GetIterator(obj, method) { |
| 1912 if (IS_UNDEFINED(method)) { | 1913 if (IS_UNDEFINED(method)) { |
| 1913 method = obj[symbolIterator]; | 1914 method = obj[symbolIterator]; |
| 1914 } | 1915 } |
| 1915 if (!IS_SPEC_FUNCTION(method)) { | 1916 if (!IS_SPEC_FUNCTION(method)) { |
| 1916 throw MakeTypeError('not_iterable', [obj]); | 1917 throw MakeTypeError('not_iterable', [obj]); |
| 1917 } | 1918 } |
| 1918 var iterator = %_CallFunction(obj, method); | 1919 var iterator = %_CallFunction(obj, method); |
| 1919 if (!IS_SPEC_OBJECT(iterator)) { | 1920 if (!IS_SPEC_OBJECT(iterator)) { |
| 1920 throw MakeTypeError('not_an_iterator', [iterator]); | 1921 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1921 } | 1922 } |
| 1922 return iterator; | 1923 return iterator; |
| 1923 } | 1924 } |
| OLD | NEW |