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 5499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5510 /** | 5510 /** |
5511 * This class exports constants and functionality from within v8 that | 5511 * This class exports constants and functionality from within v8 that |
5512 * is necessary to implement inline functions in the v8 api. Don't | 5512 * is necessary to implement inline functions in the v8 api. Don't |
5513 * depend on functions and constants defined here. | 5513 * depend on functions and constants defined here. |
5514 */ | 5514 */ |
5515 class Internals { | 5515 class Internals { |
5516 public: | 5516 public: |
5517 // These values match non-compiler-dependent values defined within | 5517 // These values match non-compiler-dependent values defined within |
5518 // the implementation of v8. | 5518 // the implementation of v8. |
5519 static const int kHeapObjectMapOffset = 0; | 5519 static const int kHeapObjectMapOffset = 0; |
5520 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; | 5520 static const int kMapInstanceTypeAndBitFieldOffset = |
| 5521 1 * kApiPointerSize + kApiIntSize; |
5521 static const int kStringResourceOffset = 3 * kApiPointerSize; | 5522 static const int kStringResourceOffset = 3 * kApiPointerSize; |
5522 | 5523 |
5523 static const int kOddballKindOffset = 3 * kApiPointerSize; | 5524 static const int kOddballKindOffset = 3 * kApiPointerSize; |
5524 static const int kForeignAddressOffset = kApiPointerSize; | 5525 static const int kForeignAddressOffset = kApiPointerSize; |
5525 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | 5526 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; |
5526 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; | 5527 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; |
5527 static const int kContextHeaderSize = 2 * kApiPointerSize; | 5528 static const int kContextHeaderSize = 2 * kApiPointerSize; |
5528 static const int kContextEmbedderDataIndex = 76; | 5529 static const int kContextEmbedderDataIndex = 76; |
5529 static const int kFullStringRepresentationMask = 0x07; | 5530 static const int kFullStringRepresentationMask = 0x07; |
5530 static const int kStringEncodingMask = 0x4; | 5531 static const int kStringEncodingMask = 0x4; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5588 return PlatformSmiTagging::IntToSmi(value); | 5589 return PlatformSmiTagging::IntToSmi(value); |
5589 } | 5590 } |
5590 | 5591 |
5591 V8_INLINE static bool IsValidSmi(intptr_t value) { | 5592 V8_INLINE static bool IsValidSmi(intptr_t value) { |
5592 return PlatformSmiTagging::IsValidSmi(value); | 5593 return PlatformSmiTagging::IsValidSmi(value); |
5593 } | 5594 } |
5594 | 5595 |
5595 V8_INLINE static int GetInstanceType(internal::Object* obj) { | 5596 V8_INLINE static int GetInstanceType(internal::Object* obj) { |
5596 typedef internal::Object O; | 5597 typedef internal::Object O; |
5597 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); | 5598 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); |
5598 return ReadField<uint8_t>(map, kMapInstanceTypeOffset); | 5599 // Map::InstanceType is defined so that it will always be loaded into |
| 5600 // the LS 8 bits of one 16-bit word, regardless of endianess. |
| 5601 return ReadField<uint16_t>(map, kMapInstanceTypeAndBitFieldOffset) & 0xff; |
5599 } | 5602 } |
5600 | 5603 |
5601 V8_INLINE static int GetOddballKind(internal::Object* obj) { | 5604 V8_INLINE static int GetOddballKind(internal::Object* obj) { |
5602 typedef internal::Object O; | 5605 typedef internal::Object O; |
5603 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); | 5606 return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); |
5604 } | 5607 } |
5605 | 5608 |
5606 V8_INLINE static bool IsExternalTwoByteString(int instance_type) { | 5609 V8_INLINE static bool IsExternalTwoByteString(int instance_type) { |
5607 int representation = (instance_type & kFullStringRepresentationMask); | 5610 int representation = (instance_type & kFullStringRepresentationMask); |
5608 return representation == kExternalTwoByteRepresentationTag; | 5611 return representation == kExternalTwoByteRepresentationTag; |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6654 */ | 6657 */ |
6655 | 6658 |
6656 | 6659 |
6657 } // namespace v8 | 6660 } // namespace v8 |
6658 | 6661 |
6659 | 6662 |
6660 #undef TYPE_CHECK | 6663 #undef TYPE_CHECK |
6661 | 6664 |
6662 | 6665 |
6663 #endif // V8_H_ | 6666 #endif // V8_H_ |
OLD | NEW |