Chromium Code Reviews| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 \ | 366 \ |
| 367 V(SYMBOL_TYPE) \ | 367 V(SYMBOL_TYPE) \ |
| 368 \ | 368 \ |
| 369 V(MAP_TYPE) \ | 369 V(MAP_TYPE) \ |
| 370 V(CODE_TYPE) \ | 370 V(CODE_TYPE) \ |
| 371 V(ODDBALL_TYPE) \ | 371 V(ODDBALL_TYPE) \ |
| 372 V(CELL_TYPE) \ | 372 V(CELL_TYPE) \ |
| 373 V(PROPERTY_CELL_TYPE) \ | 373 V(PROPERTY_CELL_TYPE) \ |
| 374 \ | 374 \ |
| 375 V(HEAP_NUMBER_TYPE) \ | 375 V(HEAP_NUMBER_TYPE) \ |
| 376 V(MUTABLE_HEAP_NUMBER_TYPE) \ | |
| 376 V(FOREIGN_TYPE) \ | 377 V(FOREIGN_TYPE) \ |
| 377 V(BYTE_ARRAY_TYPE) \ | 378 V(BYTE_ARRAY_TYPE) \ |
| 378 V(FREE_SPACE_TYPE) \ | 379 V(FREE_SPACE_TYPE) \ |
| 379 /* Note: the order of these external array */ \ | 380 /* Note: the order of these external array */ \ |
| 380 /* types is relied upon in */ \ | 381 /* types is relied upon in */ \ |
| 381 /* Object::IsExternalArray(). */ \ | 382 /* Object::IsExternalArray(). */ \ |
| 382 V(EXTERNAL_INT8_ARRAY_TYPE) \ | 383 V(EXTERNAL_INT8_ARRAY_TYPE) \ |
| 383 V(EXTERNAL_UINT8_ARRAY_TYPE) \ | 384 V(EXTERNAL_UINT8_ARRAY_TYPE) \ |
| 384 V(EXTERNAL_INT16_ARRAY_TYPE) \ | 385 V(EXTERNAL_INT16_ARRAY_TYPE) \ |
| 385 V(EXTERNAL_UINT16_ARRAY_TYPE) \ | 386 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). | 715 // Objects allocated in their own spaces (never in new space). |
| 715 MAP_TYPE, | 716 MAP_TYPE, |
| 716 CODE_TYPE, | 717 CODE_TYPE, |
| 717 ODDBALL_TYPE, | 718 ODDBALL_TYPE, |
| 718 CELL_TYPE, | 719 CELL_TYPE, |
| 719 PROPERTY_CELL_TYPE, | 720 PROPERTY_CELL_TYPE, |
| 720 | 721 |
| 721 // "Data", objects that cannot contain non-map-word pointers to heap | 722 // "Data", objects that cannot contain non-map-word pointers to heap |
| 722 // objects. | 723 // objects. |
| 723 HEAP_NUMBER_TYPE, | 724 HEAP_NUMBER_TYPE, |
| 725 MUTABLE_HEAP_NUMBER_TYPE, | |
| 724 FOREIGN_TYPE, | 726 FOREIGN_TYPE, |
| 725 BYTE_ARRAY_TYPE, | 727 BYTE_ARRAY_TYPE, |
| 726 FREE_SPACE_TYPE, | 728 FREE_SPACE_TYPE, |
| 727 | 729 |
| 728 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 730 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 729 EXTERNAL_UINT8_ARRAY_TYPE, | 731 EXTERNAL_UINT8_ARRAY_TYPE, |
| 730 EXTERNAL_INT16_ARRAY_TYPE, | 732 EXTERNAL_INT16_ARRAY_TYPE, |
| 731 EXTERNAL_UINT16_ARRAY_TYPE, | 733 EXTERNAL_UINT16_ARRAY_TYPE, |
| 732 EXTERNAL_INT32_ARRAY_TYPE, | 734 EXTERNAL_INT32_ARRAY_TYPE, |
| 733 EXTERNAL_UINT32_ARRAY_TYPE, | 735 EXTERNAL_UINT32_ARRAY_TYPE, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 }; | 987 }; |
| 986 | 988 |
| 987 | 989 |
| 988 #define OBJECT_TYPE_LIST(V) \ | 990 #define OBJECT_TYPE_LIST(V) \ |
| 989 V(Smi) \ | 991 V(Smi) \ |
| 990 V(HeapObject) \ | 992 V(HeapObject) \ |
| 991 V(Number) \ | 993 V(Number) \ |
| 992 | 994 |
| 993 #define HEAP_OBJECT_TYPE_LIST(V) \ | 995 #define HEAP_OBJECT_TYPE_LIST(V) \ |
| 994 V(HeapNumber) \ | 996 V(HeapNumber) \ |
| 997 V(MutableHeapNumber) \ | |
| 995 V(Name) \ | 998 V(Name) \ |
| 996 V(UniqueName) \ | 999 V(UniqueName) \ |
| 997 V(String) \ | 1000 V(String) \ |
| 998 V(SeqString) \ | 1001 V(SeqString) \ |
| 999 V(ExternalString) \ | 1002 V(ExternalString) \ |
| 1000 V(ConsString) \ | 1003 V(ConsString) \ |
| 1001 V(SlicedString) \ | 1004 V(SlicedString) \ |
| 1002 V(ExternalTwoByteString) \ | 1005 V(ExternalTwoByteString) \ |
| 1003 V(ExternalAsciiString) \ | 1006 V(ExternalAsciiString) \ |
| 1004 V(SeqTwoByteString) \ | 1007 V(SeqTwoByteString) \ |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 OPTIMAL_REPRESENTATION, | 1488 OPTIMAL_REPRESENTATION, |
| 1486 FORCE_TAGGED | 1489 FORCE_TAGGED |
| 1487 }; | 1490 }; |
| 1488 | 1491 |
| 1489 inline Representation OptimalRepresentation( | 1492 inline Representation OptimalRepresentation( |
| 1490 ValueType type = OPTIMAL_REPRESENTATION) { | 1493 ValueType type = OPTIMAL_REPRESENTATION) { |
| 1491 if (!FLAG_track_fields) return Representation::Tagged(); | 1494 if (!FLAG_track_fields) return Representation::Tagged(); |
| 1492 if (type == FORCE_TAGGED) return Representation::Tagged(); | 1495 if (type == FORCE_TAGGED) return Representation::Tagged(); |
| 1493 if (IsSmi()) { | 1496 if (IsSmi()) { |
| 1494 return Representation::Smi(); | 1497 return Representation::Smi(); |
| 1495 } else if (FLAG_track_double_fields && IsHeapNumber()) { | 1498 } else if (FLAG_track_double_fields && IsHeapNumber()) { |
|
Igor Sheludko
2014/03/27 11:30:16
|| IsMutableHeapNumber() ?
| |
| 1496 return Representation::Double(); | 1499 return Representation::Double(); |
| 1497 } else if (FLAG_track_computed_fields && IsUninitialized()) { | 1500 } else if (FLAG_track_computed_fields && IsUninitialized()) { |
| 1498 return Representation::None(); | 1501 return Representation::None(); |
| 1499 } else if (FLAG_track_heap_object_fields) { | 1502 } else if (FLAG_track_heap_object_fields) { |
| 1500 ASSERT(IsHeapObject()); | 1503 ASSERT(IsHeapObject()); |
| 1501 return Representation::HeapObject(); | 1504 return Representation::HeapObject(); |
| 1502 } else { | 1505 } else { |
| 1503 return Representation::Tagged(); | 1506 return Representation::Tagged(); |
| 1504 } | 1507 } |
| 1505 } | 1508 } |
| 1506 | 1509 |
| 1507 inline bool FitsRepresentation(Representation representation) { | 1510 inline bool FitsRepresentation(Representation representation) { |
| 1508 if (FLAG_track_fields && representation.IsNone()) { | 1511 if (FLAG_track_fields && representation.IsNone()) { |
| 1509 return false; | 1512 return false; |
| 1510 } else if (FLAG_track_fields && representation.IsSmi()) { | 1513 } else if (FLAG_track_fields && representation.IsSmi()) { |
| 1511 return IsSmi(); | 1514 return IsSmi(); |
| 1512 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 1515 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
| 1513 return IsNumber(); | 1516 return IsMutableHeapNumber() || IsNumber(); |
| 1514 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 1517 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 1515 return IsHeapObject(); | 1518 return IsHeapObject(); |
| 1516 } | 1519 } |
| 1517 return true; | 1520 return true; |
| 1518 } | 1521 } |
| 1519 | 1522 |
| 1520 inline MaybeObject* AllocateNewStorageFor(Heap* heap, | 1523 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
| 1521 Representation representation); | 1524 Representation representation); |
| 1525 inline MaybeObject* WrapForRead(Heap* heap, Representation representation); | |
| 1522 | 1526 |
| 1523 // Returns true if the object is of the correct type to be used as a | 1527 // Returns true if the object is of the correct type to be used as a |
| 1524 // implementation of a JSObject's elements. | 1528 // implementation of a JSObject's elements. |
| 1525 inline bool HasValidElements(); | 1529 inline bool HasValidElements(); |
| 1526 | 1530 |
| 1527 inline bool HasSpecificClassOf(String* name); | 1531 inline bool HasSpecificClassOf(String* name); |
| 1528 | 1532 |
| 1529 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. | 1533 MUST_USE_RESULT MaybeObject* ToObject(Isolate* isolate); // ECMA-262 9.9. |
| 1530 bool BooleanValue(); // ECMA-262 9.2. | 1534 bool BooleanValue(); // ECMA-262 9.2. |
| 1531 | 1535 |
| (...skipping 9254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10786 } else { | 10790 } else { |
| 10787 value &= ~(1 << bit_position); | 10791 value &= ~(1 << bit_position); |
| 10788 } | 10792 } |
| 10789 return value; | 10793 return value; |
| 10790 } | 10794 } |
| 10791 }; | 10795 }; |
| 10792 | 10796 |
| 10793 } } // namespace v8::internal | 10797 } } // namespace v8::internal |
| 10794 | 10798 |
| 10795 #endif // V8_OBJECTS_H_ | 10799 #endif // V8_OBJECTS_H_ |
| OLD | NEW |