Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/objects.h

Issue 100249: When strings can change from an ASCII representation to a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/log.cc ('k') | src/objects.cc » ('j') | src/objects-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 // string can potentially alter its shape. Also be aware that a GC caused by 3200 // string can potentially alter its shape. Also be aware that a GC caused by
3201 // something else can alter the shape of a string due to ConsString 3201 // something else can alter the shape of a string due to ConsString
3202 // shortcutting. Keeping these restrictions in mind has proven to be error- 3202 // shortcutting. Keeping these restrictions in mind has proven to be error-
3203 // prone and so we no longer put StringShapes in variables unless there is a 3203 // prone and so we no longer put StringShapes in variables unless there is a
3204 // concrete performance benefit at that particular point in the code. 3204 // concrete performance benefit at that particular point in the code.
3205 class StringShape BASE_EMBEDDED { 3205 class StringShape BASE_EMBEDDED {
3206 public: 3206 public:
3207 inline explicit StringShape(String* s); 3207 inline explicit StringShape(String* s);
3208 inline explicit StringShape(Map* s); 3208 inline explicit StringShape(Map* s);
3209 inline explicit StringShape(InstanceType t); 3209 inline explicit StringShape(InstanceType t);
3210 inline bool IsAsciiRepresentation();
3211 inline bool IsTwoByteRepresentation();
3212 inline bool IsSequential(); 3210 inline bool IsSequential();
3213 inline bool IsExternal(); 3211 inline bool IsExternal();
3214 inline bool IsCons(); 3212 inline bool IsCons();
3215 inline bool IsSliced(); 3213 inline bool IsSliced();
3216 inline bool IsExternalAscii(); 3214 inline bool IsExternalAscii();
3217 inline bool IsExternalTwoByte(); 3215 inline bool IsExternalTwoByte();
3218 inline bool IsSequentialAscii(); 3216 inline bool IsSequentialAscii();
3219 inline bool IsSequentialTwoByte(); 3217 inline bool IsSequentialTwoByte();
3220 inline bool IsSymbol(); 3218 inline bool IsSymbol();
3221 inline StringRepresentationTag representation_tag(); 3219 inline StringRepresentationTag representation_tag();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 inline int length(); 3251 inline int length();
3254 inline void set_length(int value); 3252 inline void set_length(int value);
3255 3253
3256 // Get and set the uninterpreted length field of the string. Notice 3254 // Get and set the uninterpreted length field of the string. Notice
3257 // that the length field is also used to cache the hash value of 3255 // that the length field is also used to cache the hash value of
3258 // strings. In order to get or set the actual length of the string 3256 // strings. In order to get or set the actual length of the string
3259 // use the length() and set_length methods. 3257 // use the length() and set_length methods.
3260 inline uint32_t length_field(); 3258 inline uint32_t length_field();
3261 inline void set_length_field(uint32_t value); 3259 inline void set_length_field(uint32_t value);
3262 3260
3261 inline bool IsAsciiRepresentation();
3262 inline bool IsTwoByteRepresentation();
3263
3263 // Get and set individual two byte chars in the string. 3264 // Get and set individual two byte chars in the string.
3264 inline void Set(int index, uint16_t value); 3265 inline void Set(int index, uint16_t value);
3265 // Get individual two byte char in the string. Repeated calls 3266 // Get individual two byte char in the string. Repeated calls
3266 // to this method are not efficient unless the string is flat. 3267 // to this method are not efficient unless the string is flat.
3267 inline uint16_t Get(int index); 3268 inline uint16_t Get(int index);
3268 3269
3269 // Try to flatten the top level ConsString that is hiding behind this 3270 // Try to flatten the top level ConsString that is hiding behind this
3270 // string. This is a no-op unless the string is a ConsString or a 3271 // string. This is a no-op unless the string is a ConsString or a
3271 // SlicedString. Flatten mutates the ConsString and might return a 3272 // SlicedString. Flatten mutates the ConsString and might return a
3272 // failure. 3273 // failure.
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
4367 } else { 4368 } else {
4368 value &= ~(1 << bit_position); 4369 value &= ~(1 << bit_position);
4369 } 4370 }
4370 return value; 4371 return value;
4371 } 4372 }
4372 }; 4373 };
4373 4374
4374 } } // namespace v8::internal 4375 } } // namespace v8::internal
4375 4376
4376 #endif // V8_OBJECTS_H_ 4377 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/objects.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698