OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 V(Callable) \ | 995 V(Callable) \ |
996 V(CallHandlerInfo) \ | 996 V(CallHandlerInfo) \ |
997 V(Cell) \ | 997 V(Cell) \ |
998 V(Code) \ | 998 V(Code) \ |
999 V(CodeCacheHashTable) \ | 999 V(CodeCacheHashTable) \ |
1000 V(CompilationCacheTable) \ | 1000 V(CompilationCacheTable) \ |
1001 V(ConsString) \ | 1001 V(ConsString) \ |
1002 V(ConstantElementsPair) \ | 1002 V(ConstantElementsPair) \ |
1003 V(Constructor) \ | 1003 V(Constructor) \ |
1004 V(Context) \ | 1004 V(Context) \ |
| 1005 V(CoverageInfo) \ |
1005 V(DeoptimizationInputData) \ | 1006 V(DeoptimizationInputData) \ |
1006 V(DeoptimizationOutputData) \ | 1007 V(DeoptimizationOutputData) \ |
1007 V(DependentCode) \ | 1008 V(DependentCode) \ |
1008 V(DescriptorArray) \ | 1009 V(DescriptorArray) \ |
1009 V(Dictionary) \ | 1010 V(Dictionary) \ |
1010 V(External) \ | 1011 V(External) \ |
1011 V(ExternalOneByteString) \ | 1012 V(ExternalOneByteString) \ |
1012 V(ExternalString) \ | 1013 V(ExternalString) \ |
1013 V(ExternalTwoByteString) \ | 1014 V(ExternalTwoByteString) \ |
1014 V(FeedbackMetadata) \ | 1015 V(FeedbackMetadata) \ |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 // Smi represents integer Numbers that can be stored in 31 bits. | 1573 // Smi represents integer Numbers that can be stored in 31 bits. |
1573 // Smis are immediate which means they are NOT allocated in the heap. | 1574 // Smis are immediate which means they are NOT allocated in the heap. |
1574 // The this pointer has the following format: [31 bit signed int] 0 | 1575 // The this pointer has the following format: [31 bit signed int] 0 |
1575 // For long smis it has the following format: | 1576 // For long smis it has the following format: |
1576 // [32 bit signed int] [31 bits zero padding] 0 | 1577 // [32 bit signed int] [31 bits zero padding] 0 |
1577 // Smi stands for small integer. | 1578 // Smi stands for small integer. |
1578 class Smi: public Object { | 1579 class Smi: public Object { |
1579 public: | 1580 public: |
1580 // Returns the integer value. | 1581 // Returns the integer value. |
1581 inline int value() const { return Internals::SmiValue(this); } | 1582 inline int value() const { return Internals::SmiValue(this); } |
| 1583 |
| 1584 // Casts o to a Smi and returns its value. |
| 1585 static inline int ToInt(Object* o); |
| 1586 |
1582 inline Smi* ToUint32Smi() { | 1587 inline Smi* ToUint32Smi() { |
1583 if (value() <= 0) return Smi::kZero; | 1588 if (value() <= 0) return Smi::kZero; |
1584 return Smi::FromInt(static_cast<uint32_t>(value())); | 1589 return Smi::FromInt(static_cast<uint32_t>(value())); |
1585 } | 1590 } |
1586 | 1591 |
1587 // Convert a value to a Smi object. | 1592 // Convert a value to a Smi object. |
1588 static inline Smi* FromInt(int value) { | 1593 static inline Smi* FromInt(int value) { |
1589 DCHECK(Smi::IsValid(value)); | 1594 DCHECK(Smi::IsValid(value)); |
1590 return reinterpret_cast<Smi*>(Internals::IntToSmi(value)); | 1595 return reinterpret_cast<Smi*>(Internals::IntToSmi(value)); |
1591 } | 1596 } |
(...skipping 6848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8440 } | 8445 } |
8441 }; | 8446 }; |
8442 | 8447 |
8443 | 8448 |
8444 } // NOLINT, false-positive due to second-order macros. | 8449 } // NOLINT, false-positive due to second-order macros. |
8445 } // NOLINT, false-positive due to second-order macros. | 8450 } // NOLINT, false-positive due to second-order macros. |
8446 | 8451 |
8447 #include "src/objects/object-macros-undef.h" | 8452 #include "src/objects/object-macros-undef.h" |
8448 | 8453 |
8449 #endif // V8_OBJECTS_H_ | 8454 #endif // V8_OBJECTS_H_ |
OLD | NEW |