Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3425 static inline int SmiValue(internal::Object* value) { | 3425 static inline int SmiValue(internal::Object* value) { |
| 3426 return SmiConstants<kApiPointerSize>::SmiToInt(value); | 3426 return SmiConstants<kApiPointerSize>::SmiToInt(value); |
| 3427 } | 3427 } |
| 3428 | 3428 |
| 3429 static inline int GetInstanceType(internal::Object* obj) { | 3429 static inline int GetInstanceType(internal::Object* obj) { |
| 3430 typedef internal::Object O; | 3430 typedef internal::Object O; |
| 3431 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); | 3431 O* map = ReadField<O*>(obj, kHeapObjectMapOffset); |
| 3432 return ReadField<uint8_t>(map, kMapInstanceTypeOffset); | 3432 return ReadField<uint8_t>(map, kMapInstanceTypeOffset); |
| 3433 } | 3433 } |
| 3434 | 3434 |
| 3435 static inline void* GetExternalPointerFromSmi(internal::Object* smi) { | |
| 3436 return reinterpret_cast<void*>( | |
| 3437 reinterpret_cast<intptr_t>(smi) >> kSmiShiftSize); | |
|
Lasse Reichstein
2011/01/13 08:35:18
I don't think this will work in 64-bit mode (kShif
| |
| 3438 } | |
| 3439 | |
| 3435 static inline void* GetExternalPointer(internal::Object* obj) { | 3440 static inline void* GetExternalPointer(internal::Object* obj) { |
| 3436 if (HasSmiTag(obj)) { | 3441 if (HasSmiTag(obj)) { |
| 3437 return obj; | 3442 return GetExternalPointerFromSmi(obj); |
| 3438 } else if (GetInstanceType(obj) == kProxyType) { | 3443 } else if (GetInstanceType(obj) == kProxyType) { |
| 3439 return ReadField<void*>(obj, kProxyProxyOffset); | 3444 return ReadField<void*>(obj, kProxyProxyOffset); |
| 3440 } else { | 3445 } else { |
| 3441 return NULL; | 3446 return NULL; |
| 3442 } | 3447 } |
| 3443 } | 3448 } |
| 3444 | 3449 |
| 3445 static inline bool IsExternalTwoByteString(int instance_type) { | 3450 static inline bool IsExternalTwoByteString(int instance_type) { |
| 3446 int representation = (instance_type & kFullStringRepresentationMask); | 3451 int representation = (instance_type & kFullStringRepresentationMask); |
| 3447 return representation == kExternalTwoByteRepresentationTag; | 3452 return representation == kExternalTwoByteRepresentationTag; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3794 | 3799 |
| 3795 | 3800 |
| 3796 } // namespace v8 | 3801 } // namespace v8 |
| 3797 | 3802 |
| 3798 | 3803 |
| 3799 #undef V8EXPORT | 3804 #undef V8EXPORT |
| 3800 #undef TYPE_CHECK | 3805 #undef TYPE_CHECK |
| 3801 | 3806 |
| 3802 | 3807 |
| 3803 #endif // V8_H_ | 3808 #endif // V8_H_ |
| OLD | NEW |