OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 STORE_NO_TRANSITION_HANDLE_COW | 180 STORE_NO_TRANSITION_HANDLE_COW |
181 }; | 181 }; |
182 | 182 |
183 | 183 |
184 enum ContextualMode { | 184 enum ContextualMode { |
185 NOT_CONTEXTUAL, | 185 NOT_CONTEXTUAL, |
186 CONTEXTUAL | 186 CONTEXTUAL |
187 }; | 187 }; |
188 | 188 |
189 | 189 |
| 190 enum MutableMode { |
| 191 MUTABLE, |
| 192 IMMUTABLE |
| 193 }; |
| 194 |
| 195 |
190 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - | 196 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - |
191 STANDARD_STORE; | 197 STANDARD_STORE; |
192 STATIC_ASSERT(STANDARD_STORE == 0); | 198 STATIC_ASSERT(STANDARD_STORE == 0); |
193 STATIC_ASSERT(kGrowICDelta == | 199 STATIC_ASSERT(kGrowICDelta == |
194 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - | 200 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - |
195 STORE_TRANSITION_SMI_TO_OBJECT); | 201 STORE_TRANSITION_SMI_TO_OBJECT); |
196 STATIC_ASSERT(kGrowICDelta == | 202 STATIC_ASSERT(kGrowICDelta == |
197 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - | 203 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - |
198 STORE_TRANSITION_SMI_TO_DOUBLE); | 204 STORE_TRANSITION_SMI_TO_DOUBLE); |
199 STATIC_ASSERT(kGrowICDelta == | 205 STATIC_ASSERT(kGrowICDelta == |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 \ | 372 \ |
367 V(SYMBOL_TYPE) \ | 373 V(SYMBOL_TYPE) \ |
368 \ | 374 \ |
369 V(MAP_TYPE) \ | 375 V(MAP_TYPE) \ |
370 V(CODE_TYPE) \ | 376 V(CODE_TYPE) \ |
371 V(ODDBALL_TYPE) \ | 377 V(ODDBALL_TYPE) \ |
372 V(CELL_TYPE) \ | 378 V(CELL_TYPE) \ |
373 V(PROPERTY_CELL_TYPE) \ | 379 V(PROPERTY_CELL_TYPE) \ |
374 \ | 380 \ |
375 V(HEAP_NUMBER_TYPE) \ | 381 V(HEAP_NUMBER_TYPE) \ |
| 382 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
376 V(FOREIGN_TYPE) \ | 383 V(FOREIGN_TYPE) \ |
377 V(BYTE_ARRAY_TYPE) \ | 384 V(BYTE_ARRAY_TYPE) \ |
378 V(FREE_SPACE_TYPE) \ | 385 V(FREE_SPACE_TYPE) \ |
379 /* Note: the order of these external array */ \ | 386 /* Note: the order of these external array */ \ |
380 /* types is relied upon in */ \ | 387 /* types is relied upon in */ \ |
381 /* Object::IsExternalArray(). */ \ | 388 /* Object::IsExternalArray(). */ \ |
382 V(EXTERNAL_INT8_ARRAY_TYPE) \ | 389 V(EXTERNAL_INT8_ARRAY_TYPE) \ |
383 V(EXTERNAL_UINT8_ARRAY_TYPE) \ | 390 V(EXTERNAL_UINT8_ARRAY_TYPE) \ |
384 V(EXTERNAL_INT16_ARRAY_TYPE) \ | 391 V(EXTERNAL_INT16_ARRAY_TYPE) \ |
385 V(EXTERNAL_UINT16_ARRAY_TYPE) \ | 392 V(EXTERNAL_UINT16_ARRAY_TYPE) \ |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 // Objects allocated in their own spaces (never in new space). | 721 // Objects allocated in their own spaces (never in new space). |
715 MAP_TYPE, | 722 MAP_TYPE, |
716 CODE_TYPE, | 723 CODE_TYPE, |
717 ODDBALL_TYPE, | 724 ODDBALL_TYPE, |
718 CELL_TYPE, | 725 CELL_TYPE, |
719 PROPERTY_CELL_TYPE, | 726 PROPERTY_CELL_TYPE, |
720 | 727 |
721 // "Data", objects that cannot contain non-map-word pointers to heap | 728 // "Data", objects that cannot contain non-map-word pointers to heap |
722 // objects. | 729 // objects. |
723 HEAP_NUMBER_TYPE, | 730 HEAP_NUMBER_TYPE, |
| 731 MUTABLE_HEAP_NUMBER_TYPE, |
724 FOREIGN_TYPE, | 732 FOREIGN_TYPE, |
725 BYTE_ARRAY_TYPE, | 733 BYTE_ARRAY_TYPE, |
726 FREE_SPACE_TYPE, | 734 FREE_SPACE_TYPE, |
727 | 735 |
728 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 736 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
729 EXTERNAL_UINT8_ARRAY_TYPE, | 737 EXTERNAL_UINT8_ARRAY_TYPE, |
730 EXTERNAL_INT16_ARRAY_TYPE, | 738 EXTERNAL_INT16_ARRAY_TYPE, |
731 EXTERNAL_UINT16_ARRAY_TYPE, | 739 EXTERNAL_UINT16_ARRAY_TYPE, |
732 EXTERNAL_INT32_ARRAY_TYPE, | 740 EXTERNAL_INT32_ARRAY_TYPE, |
733 EXTERNAL_UINT32_ARRAY_TYPE, | 741 EXTERNAL_UINT32_ARRAY_TYPE, |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 }; | 993 }; |
986 | 994 |
987 | 995 |
988 #define OBJECT_TYPE_LIST(V) \ | 996 #define OBJECT_TYPE_LIST(V) \ |
989 V(Smi) \ | 997 V(Smi) \ |
990 V(HeapObject) \ | 998 V(HeapObject) \ |
991 V(Number) \ | 999 V(Number) \ |
992 | 1000 |
993 #define HEAP_OBJECT_TYPE_LIST(V) \ | 1001 #define HEAP_OBJECT_TYPE_LIST(V) \ |
994 V(HeapNumber) \ | 1002 V(HeapNumber) \ |
| 1003 V(MutableHeapNumber) \ |
995 V(Name) \ | 1004 V(Name) \ |
996 V(UniqueName) \ | 1005 V(UniqueName) \ |
997 V(String) \ | 1006 V(String) \ |
998 V(SeqString) \ | 1007 V(SeqString) \ |
999 V(ExternalString) \ | 1008 V(ExternalString) \ |
1000 V(ConsString) \ | 1009 V(ConsString) \ |
1001 V(SlicedString) \ | 1010 V(SlicedString) \ |
1002 V(ExternalTwoByteString) \ | 1011 V(ExternalTwoByteString) \ |
1003 V(ExternalAsciiString) \ | 1012 V(ExternalAsciiString) \ |
1004 V(SeqTwoByteString) \ | 1013 V(SeqTwoByteString) \ |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 return Representation::Tagged(); | 1512 return Representation::Tagged(); |
1504 } | 1513 } |
1505 } | 1514 } |
1506 | 1515 |
1507 inline bool FitsRepresentation(Representation representation) { | 1516 inline bool FitsRepresentation(Representation representation) { |
1508 if (FLAG_track_fields && representation.IsNone()) { | 1517 if (FLAG_track_fields && representation.IsNone()) { |
1509 return false; | 1518 return false; |
1510 } else if (FLAG_track_fields && representation.IsSmi()) { | 1519 } else if (FLAG_track_fields && representation.IsSmi()) { |
1511 return IsSmi(); | 1520 return IsSmi(); |
1512 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 1521 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
1513 return IsNumber(); | 1522 return IsMutableHeapNumber() || IsNumber(); |
1514 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 1523 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
1515 return IsHeapObject(); | 1524 return IsHeapObject(); |
1516 } | 1525 } |
1517 return true; | 1526 return true; |
1518 } | 1527 } |
1519 | 1528 |
1520 inline MaybeObject* AllocateNewStorageFor(Heap* heap, | 1529 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
1521 Representation representation); | 1530 Representation representation); |
| 1531 inline MaybeObject* WrapForRead(Heap* heap, Representation representation); |
1522 | 1532 |
1523 // Returns true if the object is of the correct type to be used as a | 1533 // Returns true if the object is of the correct type to be used as a |
1524 // implementation of a JSObject's elements. | 1534 // implementation of a JSObject's elements. |
1525 inline bool HasValidElements(); | 1535 inline bool HasValidElements(); |
1526 | 1536 |
1527 inline bool HasSpecificClassOf(String* name); | 1537 inline bool HasSpecificClassOf(String* name); |
1528 | 1538 |
1529 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. | 1539 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. |
1530 bool BooleanValue(); // ECMA-262 9.2. | 1540 bool BooleanValue(); // ECMA-262 9.2. |
1531 | 1541 |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 Handle<JSObject> object); | 2619 Handle<JSObject> object); |
2610 | 2620 |
2611 // Transform slow named properties to fast variants. | 2621 // Transform slow named properties to fast variants. |
2612 static void TransformToFastProperties(Handle<JSObject> object, | 2622 static void TransformToFastProperties(Handle<JSObject> object, |
2613 int unused_property_fields); | 2623 int unused_property_fields); |
2614 | 2624 |
2615 // Access fast-case object properties at index. | 2625 // Access fast-case object properties at index. |
2616 MUST_USE_RESULT inline MaybeObject* FastPropertyAt( | 2626 MUST_USE_RESULT inline MaybeObject* FastPropertyAt( |
2617 Representation representation, | 2627 Representation representation, |
2618 int index); | 2628 int index); |
| 2629 static Handle<Object> FastPropertyAt(Handle<JSObject> object, |
| 2630 Representation representation, |
| 2631 int index); |
2619 inline Object* RawFastPropertyAt(int index); | 2632 inline Object* RawFastPropertyAt(int index); |
2620 inline void FastPropertyAtPut(int index, Object* value); | 2633 inline void FastPropertyAtPut(int index, Object* value); |
2621 | 2634 |
2622 // Access to in object properties. | 2635 // Access to in object properties. |
2623 inline int GetInObjectPropertyOffset(int index); | 2636 inline int GetInObjectPropertyOffset(int index); |
2624 inline Object* InObjectPropertyAt(int index); | 2637 inline Object* InObjectPropertyAt(int index); |
2625 inline Object* InObjectPropertyAtPut(int index, | 2638 inline Object* InObjectPropertyAtPut(int index, |
2626 Object* value, | 2639 Object* value, |
2627 WriteBarrierMode mode | 2640 WriteBarrierMode mode |
2628 = UPDATE_WRITE_BARRIER); | 2641 = UPDATE_WRITE_BARRIER); |
(...skipping 8191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10820 } else { | 10833 } else { |
10821 value &= ~(1 << bit_position); | 10834 value &= ~(1 << bit_position); |
10822 } | 10835 } |
10823 return value; | 10836 return value; |
10824 } | 10837 } |
10825 }; | 10838 }; |
10826 | 10839 |
10827 } } // namespace v8::internal | 10840 } } // namespace v8::internal |
10828 | 10841 |
10829 #endif // V8_OBJECTS_H_ | 10842 #endif // V8_OBJECTS_H_ |
OLD | NEW |