OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5592 // Tag information for Smi. | 5592 // Tag information for Smi. |
5593 const int kSmiTag = 0; | 5593 const int kSmiTag = 0; |
5594 const int kSmiTagSize = 1; | 5594 const int kSmiTagSize = 1; |
5595 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; | 5595 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; |
5596 | 5596 |
5597 template <size_t ptr_size> struct SmiTagging; | 5597 template <size_t ptr_size> struct SmiTagging; |
5598 | 5598 |
5599 template<int kSmiShiftSize> | 5599 template<int kSmiShiftSize> |
5600 V8_INLINE internal::Object* IntToSmi(int value) { | 5600 V8_INLINE internal::Object* IntToSmi(int value) { |
5601 int smi_shift_bits = kSmiTagSize + kSmiShiftSize; | 5601 int smi_shift_bits = kSmiTagSize + kSmiShiftSize; |
5602 intptr_t tagged_value = | 5602 uintptr_t tagged_value = |
5603 (static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag; | 5603 (static_cast<uintptr_t>(value) << smi_shift_bits) | kSmiTag; |
5604 return reinterpret_cast<internal::Object*>(tagged_value); | 5604 return reinterpret_cast<internal::Object*>(tagged_value); |
5605 } | 5605 } |
5606 | 5606 |
5607 // Smi constants for 32-bit systems. | 5607 // Smi constants for 32-bit systems. |
5608 template <> struct SmiTagging<4> { | 5608 template <> struct SmiTagging<4> { |
5609 enum { kSmiShiftSize = 0, kSmiValueSize = 31 }; | 5609 enum { kSmiShiftSize = 0, kSmiValueSize = 31 }; |
5610 static int SmiShiftSize() { return kSmiShiftSize; } | 5610 static int SmiShiftSize() { return kSmiShiftSize; } |
5611 static int SmiValueSize() { return kSmiValueSize; } | 5611 static int SmiValueSize() { return kSmiValueSize; } |
5612 V8_INLINE static int SmiToInt(const internal::Object* value) { | 5612 V8_INLINE static int SmiToInt(const internal::Object* value) { |
5613 int shift_bits = kSmiTagSize + kSmiShiftSize; | 5613 int shift_bits = kSmiTagSize + kSmiShiftSize; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5763 } | 5763 } |
5764 | 5764 |
5765 V8_INLINE static uint8_t GetNodeFlag(internal::Object** obj, int shift) { | 5765 V8_INLINE static uint8_t GetNodeFlag(internal::Object** obj, int shift) { |
5766 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5766 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5767 return *addr & static_cast<uint8_t>(1U << shift); | 5767 return *addr & static_cast<uint8_t>(1U << shift); |
5768 } | 5768 } |
5769 | 5769 |
5770 V8_INLINE static void UpdateNodeFlag(internal::Object** obj, | 5770 V8_INLINE static void UpdateNodeFlag(internal::Object** obj, |
5771 bool value, int shift) { | 5771 bool value, int shift) { |
5772 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5772 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5773 uint8_t mask = static_cast<uint8_t>(1 << shift); | 5773 uint8_t mask = static_cast<uint8_t>(1U << shift); |
5774 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); | 5774 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift)); |
5775 } | 5775 } |
5776 | 5776 |
5777 V8_INLINE static uint8_t GetNodeState(internal::Object** obj) { | 5777 V8_INLINE static uint8_t GetNodeState(internal::Object** obj) { |
5778 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 5778 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
5779 return *addr & kNodeStateMask; | 5779 return *addr & kNodeStateMask; |
5780 } | 5780 } |
5781 | 5781 |
5782 V8_INLINE static void UpdateNodeState(internal::Object** obj, | 5782 V8_INLINE static void UpdateNodeState(internal::Object** obj, |
5783 uint8_t value) { | 5783 uint8_t value) { |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6824 */ | 6824 */ |
6825 | 6825 |
6826 | 6826 |
6827 } // namespace v8 | 6827 } // namespace v8 |
6828 | 6828 |
6829 | 6829 |
6830 #undef TYPE_CHECK | 6830 #undef TYPE_CHECK |
6831 | 6831 |
6832 | 6832 |
6833 #endif // V8_H_ | 6833 #endif // V8_H_ |
OLD | NEW |