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

Side by Side Diff: src/objects.h

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »
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 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 bool is_valid_; 3023 bool is_valid_;
3024 }; 3024 };
3025 3025
3026 3026
3027 // The characteristics of a string are stored in its map. Retrieving these 3027 // The characteristics of a string are stored in its map. Retrieving these
3028 // few bits of information is moderately expensive, involving two memory 3028 // few bits of information is moderately expensive, involving two memory
3029 // loads where the second is dependent on the first. To improve efficiency 3029 // loads where the second is dependent on the first. To improve efficiency
3030 // the shape of the string is given its own class so that it can be retrieved 3030 // the shape of the string is given its own class so that it can be retrieved
3031 // once and used for several string operations. A StringShape is small enough 3031 // once and used for several string operations. A StringShape is small enough
3032 // to be passed by value and is immutable, but be aware that flattening a 3032 // to be passed by value and is immutable, but be aware that flattening a
3033 // string can potentially alter its shape. 3033 // string can potentially alter its shape. Also be aware that a GC caused by
3034 // something else can alter the shape of a string due to ConsString
3035 // shortcutting.
3034 // 3036 //
3035 // Most of the methods designed to interrogate a string as to its exact nature 3037 // Most of the methods designed to interrogate a string as to its exact nature
3036 // have been made into methods on StringShape in order to encourage the use of 3038 // have been made into methods on StringShape in order to encourage the use of
3037 // StringShape. The String class has both a length() and a length(StringShape) 3039 // StringShape. The String class has both a length() and a length(StringShape)
3038 // operation. The former is simpler to type, but the latter is faster if you 3040 // operation. The former is simpler to type, but the latter is faster if you
3039 // need the StringShape for some other operation immediately before or after. 3041 // need the StringShape for some other operation immediately before or after.
3040 class StringShape BASE_EMBEDDED { 3042 class StringShape BASE_EMBEDDED {
3041 public: 3043 public:
3042 inline explicit StringShape(String* s); 3044 inline explicit StringShape(String* s);
3043 inline explicit StringShape(Map* s); 3045 inline explicit StringShape(Map* s);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 inline void TryFlatten(StringShape shape); 3117 inline void TryFlatten(StringShape shape);
3116 3118
3117 Vector<const char> ToAsciiVector(); 3119 Vector<const char> ToAsciiVector();
3118 Vector<const uc16> ToUC16Vector(); 3120 Vector<const uc16> ToUC16Vector();
3119 3121
3120 // Mark the string as an undetectable object. It only applies to 3122 // Mark the string as an undetectable object. It only applies to
3121 // ascii and two byte string types. 3123 // ascii and two byte string types.
3122 bool MarkAsUndetectable(); 3124 bool MarkAsUndetectable();
3123 3125
3124 // Slice the string and return a substring. 3126 // Slice the string and return a substring.
3125 Object* Slice(StringShape shape, int from, int to); 3127 Object* Slice(int from, int to);
3126 3128
3127 // String equality operations. 3129 // String equality operations.
3128 inline bool Equals(String* other); 3130 inline bool Equals(String* other);
3129 bool IsEqualTo(Vector<const char> str); 3131 bool IsEqualTo(Vector<const char> str);
3130 3132
3131 // Return a UTF8 representation of the string. The string is null 3133 // Return a UTF8 representation of the string. The string is null
3132 // terminated but may optionally contain nulls. Length is returned 3134 // terminated but may optionally contain nulls. Length is returned
3133 // in length_output if length_output is not a null pointer The string 3135 // in length_output if length_output is not a null pointer The string
3134 // should be nearly flat, otherwise the performance of this method may 3136 // should be nearly flat, otherwise the performance of this method may
3135 // be very slow (quadratic in the length). Setting robustness_flag to 3137 // be very slow (quadratic in the length). Setting robustness_flag to
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 inline String* buffer(); 3472 inline String* buffer();
3471 inline void set_buffer(String* buffer); 3473 inline void set_buffer(String* buffer);
3472 3474
3473 // The start index of the slice. 3475 // The start index of the slice.
3474 inline int start(); 3476 inline int start();
3475 inline void set_start(int start); 3477 inline void set_start(int start);
3476 3478
3477 // Dispatched behavior. 3479 // Dispatched behavior.
3478 uint16_t SlicedStringGet(int index); 3480 uint16_t SlicedStringGet(int index);
3479 3481
3480 // Flatten any ConsString hiding behind this SlicedString.
3481 Object* SlicedStringFlatten();
3482
3483 // Casting. 3482 // Casting.
3484 static inline SlicedString* cast(Object* obj); 3483 static inline SlicedString* cast(Object* obj);
3485 3484
3486 // Garbage collection support. 3485 // Garbage collection support.
3487 void SlicedStringIterateBody(ObjectVisitor* v); 3486 void SlicedStringIterateBody(ObjectVisitor* v);
3488 3487
3489 // Layout description 3488 // Layout description
3490 static const int kBufferOffset = String::kSize; 3489 static const int kBufferOffset = String::kSize;
3491 static const int kStartOffset = kBufferOffset + kPointerSize; 3490 static const int kStartOffset = kBufferOffset + kPointerSize;
3492 static const int kSize = kStartOffset + kIntSize; 3491 static const int kSize = kStartOffset + kIntSize;
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
4172 } else { 4171 } else {
4173 value &= ~(1 << bit_position); 4172 value &= ~(1 << bit_position);
4174 } 4173 }
4175 return value; 4174 return value;
4176 } 4175 }
4177 }; 4176 };
4178 4177
4179 } } // namespace v8::internal 4178 } } // namespace v8::internal
4180 4179
4181 #endif // V8_OBJECTS_H_ 4180 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698