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