| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 938  private: | 938  private: | 
| 939   // HeapObject calls the private constructor and directly reads the value. | 939   // HeapObject calls the private constructor and directly reads the value. | 
| 940   friend class HeapObject; | 940   friend class HeapObject; | 
| 941 | 941 | 
| 942   explicit MapWord(uintptr_t value) : value_(value) {} | 942   explicit MapWord(uintptr_t value) : value_(value) {} | 
| 943 | 943 | 
| 944   uintptr_t value_; | 944   uintptr_t value_; | 
| 945 | 945 | 
| 946   // Bits used by the marking phase of the garbage collector. | 946   // Bits used by the marking phase of the garbage collector. | 
| 947   // | 947   // | 
| 948   // The first word of a heap object is normall a map pointer. The last two | 948   // The first word of a heap object is normally a map pointer. The last two | 
| 949   // bits are tagged as '01' (kHeapObjectTag). We reuse the last two bits to | 949   // bits are tagged as '01' (kHeapObjectTag). We reuse the last two bits to | 
| 950   // mark an object as live and/or overflowed: | 950   // mark an object as live and/or overflowed: | 
| 951   //   last bit = 0, marked as alive | 951   //   last bit = 0, marked as alive | 
| 952   //   second bit = 1, overflowed | 952   //   second bit = 1, overflowed | 
| 953   // An object is only marked as overflowed when it is marked as live while | 953   // An object is only marked as overflowed when it is marked as live while | 
| 954   // the marking stack is overflowed. | 954   // the marking stack is overflowed. | 
| 955   static const int kMarkingBit = 0;  // marking bit | 955   static const int kMarkingBit = 0;  // marking bit | 
| 956   static const int kMarkingMask = (1 << kMarkingBit);  // marking mask | 956   static const int kMarkingMask = (1 << kMarkingBit);  // marking mask | 
| 957   static const int kOverflowBit = 1;  // overflow bit | 957   static const int kOverflowBit = 1;  // overflow bit | 
| 958   static const int kOverflowMask = (1 << kOverflowBit);  // overflow mask | 958   static const int kOverflowMask = (1 << kOverflowBit);  // overflow mask | 
| (...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3198   // Returns a hash value used for the property table | 3198   // Returns a hash value used for the property table | 
| 3199   inline uint32_t Hash(); | 3199   inline uint32_t Hash(); | 
| 3200 | 3200 | 
| 3201   static uint32_t ComputeLengthAndHashField(unibrow::CharacterStream* buffer, | 3201   static uint32_t ComputeLengthAndHashField(unibrow::CharacterStream* buffer, | 
| 3202                                             int length); | 3202                                             int length); | 
| 3203 | 3203 | 
| 3204   static bool ComputeArrayIndex(unibrow::CharacterStream* buffer, | 3204   static bool ComputeArrayIndex(unibrow::CharacterStream* buffer, | 
| 3205                                 uint32_t* index, | 3205                                 uint32_t* index, | 
| 3206                                 int length); | 3206                                 int length); | 
| 3207 | 3207 | 
|  | 3208   // Externalization. | 
|  | 3209   bool MakeExternal(v8::String::ExternalStringResource* resource); | 
|  | 3210   bool MakeExternal(v8::String::ExternalAsciiStringResource* resource); | 
|  | 3211 | 
| 3208   // Conversion. | 3212   // Conversion. | 
| 3209   inline bool AsArrayIndex(uint32_t* index); | 3213   inline bool AsArrayIndex(uint32_t* index); | 
| 3210 | 3214 | 
| 3211   // Casting. | 3215   // Casting. | 
| 3212   static inline String* cast(Object* obj); | 3216   static inline String* cast(Object* obj); | 
| 3213 | 3217 | 
| 3214   void PrintOn(FILE* out); | 3218   void PrintOn(FILE* out); | 
| 3215 | 3219 | 
| 3216   // For use during stack traces.  Performs rudimentary sanity check. | 3220   // For use during stack traces.  Performs rudimentary sanity check. | 
| 3217   bool LooksValid(); | 3221   bool LooksValid(); | 
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3577   static inline ExternalAsciiString* cast(Object* obj); | 3581   static inline ExternalAsciiString* cast(Object* obj); | 
| 3578 | 3582 | 
| 3579   // Support for StringInputBuffer. | 3583   // Support for StringInputBuffer. | 
| 3580   const unibrow::byte* ExternalAsciiStringReadBlock(unsigned* remaining, | 3584   const unibrow::byte* ExternalAsciiStringReadBlock(unsigned* remaining, | 
| 3581                                                     unsigned* offset, | 3585                                                     unsigned* offset, | 
| 3582                                                     unsigned chars); | 3586                                                     unsigned chars); | 
| 3583   inline void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 3587   inline void ExternalAsciiStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 
| 3584                                                      unsigned* offset, | 3588                                                      unsigned* offset, | 
| 3585                                                      unsigned chars); | 3589                                                      unsigned chars); | 
| 3586 | 3590 | 
|  | 3591   // Identify the map for the external string/symbol with a particular length. | 
|  | 3592   static inline Map* StringMap(int length); | 
|  | 3593   static inline Map* SymbolMap(int length); | 
| 3587  private: | 3594  private: | 
| 3588   DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); | 3595   DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); | 
| 3589 }; | 3596 }; | 
| 3590 | 3597 | 
| 3591 | 3598 | 
| 3592 // The ExternalTwoByteString class is an external string backed by a UTF-16 | 3599 // The ExternalTwoByteString class is an external string backed by a UTF-16 | 
| 3593 // encoded string. | 3600 // encoded string. | 
| 3594 class ExternalTwoByteString: public ExternalString { | 3601 class ExternalTwoByteString: public ExternalString { | 
| 3595  public: | 3602  public: | 
| 3596   typedef v8::String::ExternalStringResource Resource; | 3603   typedef v8::String::ExternalStringResource Resource; | 
| 3597 | 3604 | 
| 3598   // The underlying string resource. | 3605   // The underlying string resource. | 
| 3599   inline Resource* resource(); | 3606   inline Resource* resource(); | 
| 3600   inline void set_resource(Resource* buffer); | 3607   inline void set_resource(Resource* buffer); | 
| 3601 | 3608 | 
| 3602   // Dispatched behavior. | 3609   // Dispatched behavior. | 
| 3603   uint16_t ExternalTwoByteStringGet(int index); | 3610   uint16_t ExternalTwoByteStringGet(int index); | 
| 3604 | 3611 | 
| 3605   // For regexp code. | 3612   // For regexp code. | 
| 3606   const uint16_t* ExternalTwoByteStringGetData(unsigned start); | 3613   const uint16_t* ExternalTwoByteStringGetData(unsigned start); | 
| 3607 | 3614 | 
| 3608   // Casting. | 3615   // Casting. | 
| 3609   static inline ExternalTwoByteString* cast(Object* obj); | 3616   static inline ExternalTwoByteString* cast(Object* obj); | 
| 3610 | 3617 | 
| 3611   // Support for StringInputBuffer. | 3618   // Support for StringInputBuffer. | 
| 3612   void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 3619   void ExternalTwoByteStringReadBlockIntoBuffer(ReadBlockBuffer* buffer, | 
| 3613                                                 unsigned* offset_ptr, | 3620                                                 unsigned* offset_ptr, | 
| 3614                                                 unsigned chars); | 3621                                                 unsigned chars); | 
| 3615 | 3622 | 
|  | 3623   // Identify the map for the external string/symbol with a particular length. | 
|  | 3624   static inline Map* StringMap(int length); | 
|  | 3625   static inline Map* SymbolMap(int length); | 
| 3616  private: | 3626  private: | 
| 3617   DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); | 3627   DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalTwoByteString); | 
| 3618 }; | 3628 }; | 
| 3619 | 3629 | 
| 3620 | 3630 | 
| 3621 // A flat string reader provides random access to the contents of a | 3631 // A flat string reader provides random access to the contents of a | 
| 3622 // string independent of the character width of the string.  The handle | 3632 // string independent of the character width of the string.  The handle | 
| 3623 // must be valid as long as the reader is being used. | 3633 // must be valid as long as the reader is being used. | 
| 3624 class FlatStringReader BASE_EMBEDDED { | 3634 class FlatStringReader BASE_EMBEDDED { | 
| 3625  public: | 3635  public: | 
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4227     } else { | 4237     } else { | 
| 4228       value &= ~(1 << bit_position); | 4238       value &= ~(1 << bit_position); | 
| 4229     } | 4239     } | 
| 4230     return value; | 4240     return value; | 
| 4231   } | 4241   } | 
| 4232 }; | 4242 }; | 
| 4233 | 4243 | 
| 4234 } }  // namespace v8::internal | 4244 } }  // namespace v8::internal | 
| 4235 | 4245 | 
| 4236 #endif  // V8_OBJECTS_H_ | 4246 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|