OLD | NEW |
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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 enum ElementsKind { | 1431 enum ElementsKind { |
1432 // The "fast" kind for tagged values. Must be first to make it possible | 1432 // The "fast" kind for tagged values. Must be first to make it possible |
1433 // to efficiently check maps if they have fast elements. | 1433 // to efficiently check maps if they have fast elements. |
1434 FAST_ELEMENTS, | 1434 FAST_ELEMENTS, |
1435 | 1435 |
1436 // The "fast" kind for unwrapped, non-tagged double values. | 1436 // The "fast" kind for unwrapped, non-tagged double values. |
1437 FAST_DOUBLE_ELEMENTS, | 1437 FAST_DOUBLE_ELEMENTS, |
1438 | 1438 |
1439 // The "slow" kind. | 1439 // The "slow" kind. |
1440 DICTIONARY_ELEMENTS, | 1440 DICTIONARY_ELEMENTS, |
| 1441 NON_STRICT_ARGUMENTS_ELEMENTS, |
1441 // The "fast" kind for external arrays | 1442 // The "fast" kind for external arrays |
1442 EXTERNAL_BYTE_ELEMENTS, | 1443 EXTERNAL_BYTE_ELEMENTS, |
1443 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, | 1444 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
1444 EXTERNAL_SHORT_ELEMENTS, | 1445 EXTERNAL_SHORT_ELEMENTS, |
1445 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, | 1446 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
1446 EXTERNAL_INT_ELEMENTS, | 1447 EXTERNAL_INT_ELEMENTS, |
1447 EXTERNAL_UNSIGNED_INT_ELEMENTS, | 1448 EXTERNAL_UNSIGNED_INT_ELEMENTS, |
1448 EXTERNAL_FLOAT_ELEMENTS, | 1449 EXTERNAL_FLOAT_ELEMENTS, |
1449 EXTERNAL_DOUBLE_ELEMENTS, | 1450 EXTERNAL_DOUBLE_ELEMENTS, |
1450 EXTERNAL_PIXEL_ELEMENTS, | 1451 EXTERNAL_PIXEL_ELEMENTS, |
(...skipping 17 matching lines...) Expand all Loading... |
1468 inline StringDictionary* property_dictionary(); // Gets slow properties. | 1469 inline StringDictionary* property_dictionary(); // Gets slow properties. |
1469 | 1470 |
1470 // [elements]: The elements (properties with names that are integers). | 1471 // [elements]: The elements (properties with names that are integers). |
1471 // | 1472 // |
1472 // Elements can be in two general modes: fast and slow. Each mode | 1473 // Elements can be in two general modes: fast and slow. Each mode |
1473 // corrensponds to a set of object representations of elements that | 1474 // corrensponds to a set of object representations of elements that |
1474 // have something in common. | 1475 // have something in common. |
1475 // | 1476 // |
1476 // In the fast mode elements is a FixedArray and so each element can | 1477 // In the fast mode elements is a FixedArray and so each element can |
1477 // be quickly accessed. This fact is used in the generated code. The | 1478 // be quickly accessed. This fact is used in the generated code. The |
1478 // elements array can have one of the two maps in this mode: | 1479 // elements array can have one of three maps in this mode: |
1479 // fixed_array_map or fixed_cow_array_map (for copy-on-write | 1480 // fixed_array_map, non_strict_arguments_elements_map or |
1480 // arrays). In the latter case the elements array may be shared by a | 1481 // fixed_cow_array_map (for copy-on-write arrays). In the latter case |
1481 // few objects and so before writing to any element the array must | 1482 // the elements array may be shared by a few objects and so before |
1482 // be copied. Use EnsureWritableFastElements in this case. | 1483 // writing to any element the array must be copied. Use |
| 1484 // EnsureWritableFastElements in this case. |
1483 // | 1485 // |
1484 // In the slow mode elements is either a NumberDictionary or an ExternalArray. | 1486 // In the slow mode the elements is either a NumberDictionary, an |
| 1487 // ExternalArray, or a FixedArray parameter map for a (non-strict) |
| 1488 // arguments object. |
1485 DECL_ACCESSORS(elements, HeapObject) | 1489 DECL_ACCESSORS(elements, HeapObject) |
1486 inline void initialize_elements(); | 1490 inline void initialize_elements(); |
1487 MUST_USE_RESULT inline MaybeObject* ResetElements(); | 1491 MUST_USE_RESULT inline MaybeObject* ResetElements(); |
1488 inline ElementsKind GetElementsKind(); | 1492 inline ElementsKind GetElementsKind(); |
1489 inline bool HasFastElements(); | 1493 inline bool HasFastElements(); |
1490 inline bool HasFastDoubleElements(); | 1494 inline bool HasFastDoubleElements(); |
1491 inline bool HasDictionaryElements(); | 1495 inline bool HasDictionaryElements(); |
1492 inline bool HasExternalPixelElements(); | 1496 inline bool HasExternalPixelElements(); |
1493 inline bool HasExternalArrayElements(); | 1497 inline bool HasExternalArrayElements(); |
1494 inline bool HasExternalByteElements(); | 1498 inline bool HasExternalByteElements(); |
1495 inline bool HasExternalUnsignedByteElements(); | 1499 inline bool HasExternalUnsignedByteElements(); |
1496 inline bool HasExternalShortElements(); | 1500 inline bool HasExternalShortElements(); |
1497 inline bool HasExternalUnsignedShortElements(); | 1501 inline bool HasExternalUnsignedShortElements(); |
1498 inline bool HasExternalIntElements(); | 1502 inline bool HasExternalIntElements(); |
1499 inline bool HasExternalUnsignedIntElements(); | 1503 inline bool HasExternalUnsignedIntElements(); |
1500 inline bool HasExternalFloatElements(); | 1504 inline bool HasExternalFloatElements(); |
1501 inline bool HasExternalDoubleElements(); | 1505 inline bool HasExternalDoubleElements(); |
| 1506 bool HasFastArgumentsElements(); |
| 1507 bool HasDictionaryArgumentsElements(); |
1502 inline bool AllowsSetElementsLength(); | 1508 inline bool AllowsSetElementsLength(); |
1503 inline NumberDictionary* element_dictionary(); // Gets slow elements. | 1509 inline NumberDictionary* element_dictionary(); // Gets slow elements. |
1504 // Requires: this->HasFastElements(). | 1510 |
| 1511 // Requires: HasFastElements(). |
1505 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 1512 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); |
1506 | 1513 |
1507 // Collects elements starting at index 0. | 1514 // Collects elements starting at index 0. |
1508 // Undefined values are placed after non-undefined values. | 1515 // Undefined values are placed after non-undefined values. |
1509 // Returns the number of non-undefined values. | 1516 // Returns the number of non-undefined values. |
1510 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 1517 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
1511 // As PrepareElementsForSort, but only on objects where elements is | 1518 // As PrepareElementsForSort, but only on objects where elements is |
1512 // a dictionary, and it will stay a dictionary. | 1519 // a dictionary, and it will stay a dictionary. |
1513 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 1520 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
1514 | 1521 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 }; | 1687 }; |
1681 | 1688 |
1682 LocalElementType HasLocalElement(uint32_t index); | 1689 LocalElementType HasLocalElement(uint32_t index); |
1683 | 1690 |
1684 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); | 1691 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); |
1685 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); | 1692 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); |
1686 | 1693 |
1687 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, | 1694 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, |
1688 Object* value, | 1695 Object* value, |
1689 StrictModeFlag strict_mode, | 1696 StrictModeFlag strict_mode, |
1690 bool check_prototype = true); | 1697 bool check_prototype); |
| 1698 MUST_USE_RESULT MaybeObject* SetDictionaryElement(uint32_t index, |
| 1699 Object* value, |
| 1700 StrictModeFlag strict_mode, |
| 1701 bool check_prototype); |
1691 | 1702 |
1692 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( | 1703 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( |
1693 uint32_t index, | 1704 uint32_t index, |
1694 Object* value, | 1705 Object* value, |
1695 StrictModeFlag strict_mode, | 1706 StrictModeFlag strict_mode, |
1696 bool check_prototype = true); | 1707 bool check_prototype = true); |
1697 | 1708 |
1698 // Set the index'th array element. | 1709 // Set the index'th array element. |
1699 // A Failure object is returned if GC is needed. | 1710 // A Failure object is returned if GC is needed. |
1700 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1711 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
1701 Object* value, | 1712 Object* value, |
1702 StrictModeFlag strict_mode, | 1713 StrictModeFlag strict_mode, |
1703 bool check_prototype = true); | 1714 bool check_prototype); |
1704 | 1715 |
1705 // Returns the index'th element. | 1716 // Returns the index'th element. |
1706 // The undefined object if index is out of bounds. | 1717 // The undefined object if index is out of bounds. |
1707 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 1718 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); |
1708 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1719 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); |
1709 | 1720 |
1710 // Get external element value at index if there is one and undefined | 1721 // Get external element value at index if there is one and undefined |
1711 // otherwise. Can return a failure if allocation of a heap number | 1722 // otherwise. Can return a failure if allocation of a heap number |
1712 // failed. | 1723 // failed. |
1713 MaybeObject* GetExternalElement(uint32_t index); | 1724 MaybeObject* GetExternalElement(uint32_t index); |
1714 | 1725 |
| 1726 // Replace the elements' backing store with fast elements of the given |
| 1727 // capacity. Update the length for JSArrays. Returns the new backing |
| 1728 // store. |
1715 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, | 1729 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, |
1716 int length); | 1730 int length); |
1717 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( | 1731 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( |
1718 int capacity, | 1732 int capacity, |
1719 int length); | 1733 int length); |
1720 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); | 1734 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); |
1721 | 1735 |
1722 // Lookup interceptors are used for handling properties controlled by host | 1736 // Lookup interceptors are used for handling properties controlled by host |
1723 // objects. | 1737 // objects. |
1724 inline bool HasNamedInterceptor(); | 1738 inline bool HasNamedInterceptor(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 PropertyAttributes attributes, | 1848 PropertyAttributes attributes, |
1835 StrictModeFlag strict_mode); | 1849 StrictModeFlag strict_mode); |
1836 | 1850 |
1837 // Convert the object to use the canonical dictionary | 1851 // Convert the object to use the canonical dictionary |
1838 // representation. If the object is expected to have additional properties | 1852 // representation. If the object is expected to have additional properties |
1839 // added this number can be indicated to have the backing store allocated to | 1853 // added this number can be indicated to have the backing store allocated to |
1840 // an initial capacity for holding these properties. | 1854 // an initial capacity for holding these properties. |
1841 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 1855 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
1842 PropertyNormalizationMode mode, | 1856 PropertyNormalizationMode mode, |
1843 int expected_additional_properties); | 1857 int expected_additional_properties); |
| 1858 |
| 1859 // Convert and update the elements backing store to be a NumberDictionary |
| 1860 // dictionary. Returns the backing after conversion. |
1844 MUST_USE_RESULT MaybeObject* NormalizeElements(); | 1861 MUST_USE_RESULT MaybeObject* NormalizeElements(); |
1845 | 1862 |
1846 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); | 1863 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); |
1847 | 1864 |
1848 // Transform slow named properties to fast variants. | 1865 // Transform slow named properties to fast variants. |
1849 // Returns failure if allocation failed. | 1866 // Returns failure if allocation failed. |
1850 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | 1867 MUST_USE_RESULT MaybeObject* TransformToFastProperties( |
1851 int unused_property_fields); | 1868 int unused_property_fields); |
1852 | 1869 |
1853 // Access fast-case object properties at index. | 1870 // Access fast-case object properties at index. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index); | 1996 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index); |
1980 | 1997 |
1981 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, | 1998 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, |
1982 DeleteMode mode); | 1999 DeleteMode mode); |
1983 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); | 2000 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); |
1984 | 2001 |
1985 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, | 2002 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, |
1986 DeleteMode mode); | 2003 DeleteMode mode); |
1987 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); | 2004 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); |
1988 | 2005 |
| 2006 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); |
| 2007 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, |
| 2008 DeleteMode mode); |
| 2009 |
| 2010 bool ReferencesObjectFromElements(FixedArray* elements, |
| 2011 ElementsKind kind, |
| 2012 Object* object); |
| 2013 bool HasElementInElements(FixedArray* elements, |
| 2014 ElementsKind kind, |
| 2015 uint32_t index); |
| 2016 |
1989 // Returns true if most of the elements backing storage is used. | 2017 // Returns true if most of the elements backing storage is used. |
1990 bool HasDenseElements(); | 2018 bool HasDenseElements(); |
1991 | 2019 |
1992 bool CanSetCallback(String* name); | 2020 bool CanSetCallback(String* name); |
1993 MUST_USE_RESULT MaybeObject* SetElementCallback( | 2021 MUST_USE_RESULT MaybeObject* SetElementCallback( |
1994 uint32_t index, | 2022 uint32_t index, |
1995 Object* structure, | 2023 Object* structure, |
1996 PropertyAttributes attributes); | 2024 PropertyAttributes attributes); |
1997 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 2025 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
1998 String* name, | 2026 String* name, |
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3887 set_bit_field2((bit_field2() & ~kElementsKindMask) | | 3915 set_bit_field2((bit_field2() & ~kElementsKindMask) | |
3888 (elements_kind << kElementsKindShift)); | 3916 (elements_kind << kElementsKindShift)); |
3889 ASSERT(this->elements_kind() == elements_kind); | 3917 ASSERT(this->elements_kind() == elements_kind); |
3890 } | 3918 } |
3891 | 3919 |
3892 inline JSObject::ElementsKind elements_kind() { | 3920 inline JSObject::ElementsKind elements_kind() { |
3893 return static_cast<JSObject::ElementsKind>( | 3921 return static_cast<JSObject::ElementsKind>( |
3894 (bit_field2() & kElementsKindMask) >> kElementsKindShift); | 3922 (bit_field2() & kElementsKindMask) >> kElementsKindShift); |
3895 } | 3923 } |
3896 | 3924 |
| 3925 // Tells whether the instance has fast elements. |
| 3926 // Equivalent to instance->GetElementsKind() == FAST_ELEMENTS. |
3897 inline bool has_fast_elements() { | 3927 inline bool has_fast_elements() { |
3898 return elements_kind() == JSObject::FAST_ELEMENTS; | 3928 return elements_kind() == JSObject::FAST_ELEMENTS; |
3899 } | 3929 } |
3900 | 3930 |
3901 inline bool has_fast_double_elements() { | 3931 inline bool has_fast_double_elements() { |
3902 return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS; | 3932 return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS; |
3903 } | 3933 } |
3904 | 3934 |
3905 inline bool has_external_array_elements() { | 3935 inline bool has_external_array_elements() { |
3906 JSObject::ElementsKind kind(elements_kind()); | 3936 JSObject::ElementsKind kind(elements_kind()); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4468 // is weak. IsInobjectSlackTrackingInProgress is false after this call. | 4498 // is weak. IsInobjectSlackTrackingInProgress is false after this call. |
4469 void DetachInitialMap(); | 4499 void DetachInitialMap(); |
4470 | 4500 |
4471 // Restores the link to the initial map after the GC marking phase. | 4501 // Restores the link to the initial map after the GC marking phase. |
4472 // IsInobjectSlackTrackingInProgress is true after this call. | 4502 // IsInobjectSlackTrackingInProgress is true after this call. |
4473 void AttachInitialMap(Map* map); | 4503 void AttachInitialMap(Map* map); |
4474 | 4504 |
4475 // False if there are definitely no live objects created from this function. | 4505 // False if there are definitely no live objects created from this function. |
4476 // True if live objects _may_ exist (existence not guaranteed). | 4506 // True if live objects _may_ exist (existence not guaranteed). |
4477 // May go back from true to false after GC. | 4507 // May go back from true to false after GC. |
4478 inline bool live_objects_may_exist(); | 4508 DECL_BOOLEAN_ACCESSORS(live_objects_may_exist) |
4479 | |
4480 inline void set_live_objects_may_exist(bool value); | |
4481 | 4509 |
4482 // [instance class name]: class name for instances. | 4510 // [instance class name]: class name for instances. |
4483 DECL_ACCESSORS(instance_class_name, Object) | 4511 DECL_ACCESSORS(instance_class_name, Object) |
4484 | 4512 |
4485 // [function data]: This field holds some additional data for function. | 4513 // [function data]: This field holds some additional data for function. |
4486 // Currently it either has FunctionTemplateInfo to make benefit the API | 4514 // Currently it either has FunctionTemplateInfo to make benefit the API |
4487 // or Smi identifying a builtin function. | 4515 // or Smi identifying a builtin function. |
4488 // In the long run we don't want all functions to have this field but | 4516 // In the long run we don't want all functions to have this field but |
4489 // we can fix that when we have a better model for storing hidden data | 4517 // we can fix that when we have a better model for storing hidden data |
4490 // on objects. | 4518 // on objects. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4561 // Clear information on assignments of the form this.x = ...; | 4589 // Clear information on assignments of the form this.x = ...; |
4562 void ClearThisPropertyAssignmentsInfo(); | 4590 void ClearThisPropertyAssignmentsInfo(); |
4563 | 4591 |
4564 // Indicate that this function only consists of assignments of the form | 4592 // Indicate that this function only consists of assignments of the form |
4565 // this.x = y; where y is either a constant or refers to an argument. | 4593 // this.x = y; where y is either a constant or refers to an argument. |
4566 inline bool has_only_simple_this_property_assignments(); | 4594 inline bool has_only_simple_this_property_assignments(); |
4567 | 4595 |
4568 // Indicates if this function can be lazy compiled. | 4596 // Indicates if this function can be lazy compiled. |
4569 // This is used to determine if we can safely flush code from a function | 4597 // This is used to determine if we can safely flush code from a function |
4570 // when doing GC if we expect that the function will no longer be used. | 4598 // when doing GC if we expect that the function will no longer be used. |
4571 inline bool allows_lazy_compilation(); | 4599 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) |
4572 inline void set_allows_lazy_compilation(bool flag); | |
4573 | 4600 |
4574 // Indicates how many full GCs this function has survived with assigned | 4601 // Indicates how many full GCs this function has survived with assigned |
4575 // code object. Used to determine when it is relatively safe to flush | 4602 // code object. Used to determine when it is relatively safe to flush |
4576 // this code object and replace it with lazy compilation stub. | 4603 // this code object and replace it with lazy compilation stub. |
4577 // Age is reset when GC notices that the code object is referenced | 4604 // Age is reset when GC notices that the code object is referenced |
4578 // from the stack or compilation cache. | 4605 // from the stack or compilation cache. |
4579 inline int code_age(); | 4606 inline int code_age(); |
4580 inline void set_code_age(int age); | 4607 inline void set_code_age(int age); |
4581 | 4608 |
4582 // Indicates whether optimizations have been disabled for this | 4609 // Indicates whether optimizations have been disabled for this |
4583 // shared function info. If a function is repeatedly optimized or if | 4610 // shared function info. If a function is repeatedly optimized or if |
4584 // we cannot optimize the function we disable optimization to avoid | 4611 // we cannot optimize the function we disable optimization to avoid |
4585 // spending time attempting to optimize it again. | 4612 // spending time attempting to optimize it again. |
4586 inline bool optimization_disabled(); | 4613 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
4587 inline void set_optimization_disabled(bool value); | |
4588 | 4614 |
4589 // Indicates whether the function is a strict mode function. | 4615 // Indicates whether the function is a strict mode function. |
4590 inline bool strict_mode(); | 4616 DECL_BOOLEAN_ACCESSORS(strict_mode) |
4591 inline void set_strict_mode(bool value); | 4617 |
| 4618 // False if the function definitely does not allocate an arguments object. |
| 4619 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 4620 |
| 4621 // True if the function has any duplicated parameter names. |
| 4622 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
4592 | 4623 |
4593 // Indicates whether the function is a native function. | 4624 // Indicates whether the function is a native function. |
4594 // These needs special threatment in .call and .apply since | 4625 // These needs special threatment in .call and .apply since |
4595 // null passed as the receiver should not be translated to the | 4626 // null passed as the receiver should not be translated to the |
4596 // global object. | 4627 // global object. |
4597 inline bool native(); | 4628 inline bool native(); |
4598 inline void set_native(bool value); | 4629 inline void set_native(bool value); |
4599 | 4630 |
4600 // Indicates whether the function is a bound function created using | 4631 // Indicates whether the function is a bound function created using |
4601 // the bind function. | 4632 // the bind function. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4773 | 4804 |
4774 // Bit positions in start_position_and_type. | 4805 // Bit positions in start_position_and_type. |
4775 // The source code start position is in the 30 most significant bits of | 4806 // The source code start position is in the 30 most significant bits of |
4776 // the start_position_and_type field. | 4807 // the start_position_and_type field. |
4777 static const int kIsExpressionBit = 0; | 4808 static const int kIsExpressionBit = 0; |
4778 static const int kIsTopLevelBit = 1; | 4809 static const int kIsTopLevelBit = 1; |
4779 static const int kStartPositionShift = 2; | 4810 static const int kStartPositionShift = 2; |
4780 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4811 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
4781 | 4812 |
4782 // Bit positions in compiler_hints. | 4813 // Bit positions in compiler_hints. |
4783 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 4814 static const int kCodeAgeSize = 3; |
4784 static const int kAllowLazyCompilation = 1; | 4815 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
4785 static const int kLiveObjectsMayExist = 2; | 4816 |
4786 static const int kCodeAgeShift = 3; | 4817 enum CompilerHints { |
4787 static const int kCodeAgeMask = 0x7; | 4818 kHasOnlySimpleThisPropertyAssignments, |
4788 static const int kOptimizationDisabled = 6; | 4819 kAllowLazyCompilation, |
4789 static const int kStrictModeFunction = 7; | 4820 kLiveObjectsMayExist, |
4790 static const int kNative = 8; | 4821 kCodeAgeShift, |
4791 static const int kBoundFunction = 9; | 4822 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
| 4823 kStrictModeFunction, |
| 4824 kUsesArguments, |
| 4825 kHasDuplicateParameters, |
| 4826 kNative, |
| 4827 kBoundFunction |
| 4828 }; |
4792 | 4829 |
4793 private: | 4830 private: |
4794 #if V8_HOST_ARCH_32_BIT | 4831 #if V8_HOST_ARCH_32_BIT |
4795 // On 32 bit platforms, compiler hints is a smi. | 4832 // On 32 bit platforms, compiler hints is a smi. |
4796 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 4833 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
4797 static const int kCompilerHintsSize = kPointerSize; | 4834 static const int kCompilerHintsSize = kPointerSize; |
4798 #else | 4835 #else |
4799 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 4836 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
4800 static const int kCompilerHintsSmiTagSize = 0; | 4837 static const int kCompilerHintsSmiTagSize = 0; |
4801 static const int kCompilerHintsSize = kIntSize; | 4838 static const int kCompilerHintsSize = kIntSize; |
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7085 } else { | 7122 } else { |
7086 value &= ~(1 << bit_position); | 7123 value &= ~(1 << bit_position); |
7087 } | 7124 } |
7088 return value; | 7125 return value; |
7089 } | 7126 } |
7090 }; | 7127 }; |
7091 | 7128 |
7092 } } // namespace v8::internal | 7129 } } // namespace v8::internal |
7093 | 7130 |
7094 #endif // V8_OBJECTS_H_ | 7131 #endif // V8_OBJECTS_H_ |
OLD | NEW |