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

Side by Side Diff: src/objects.h

Issue 18552: Fix bug where strings were not flattened before regexp. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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/jsregexp.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 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 // use the length() and set_length methods. 3124 // use the length() and set_length methods.
3125 inline uint32_t length_field(); 3125 inline uint32_t length_field();
3126 inline void set_length_field(uint32_t value); 3126 inline void set_length_field(uint32_t value);
3127 3127
3128 // Get and set individual two byte chars in the string. 3128 // Get and set individual two byte chars in the string.
3129 inline void Set(StringShape shape, int index, uint16_t value); 3129 inline void Set(StringShape shape, int index, uint16_t value);
3130 // Get individual two byte char in the string. Repeated calls 3130 // Get individual two byte char in the string. Repeated calls
3131 // to this method are not efficient unless the string is flat. 3131 // to this method are not efficient unless the string is flat.
3132 inline uint16_t Get(StringShape shape, int index); 3132 inline uint16_t Get(StringShape shape, int index);
3133 3133
3134 // Flatten the top level ConsString that is hiding behind this 3134 // Try to flatten the top level ConsString that is hiding behind this
3135 // string. This is a no-op unless the string is a ConsString or a 3135 // string. This is a no-op unless the string is a ConsString or a
3136 // SlicedString. Flatten mutates the ConsString and might return a 3136 // SlicedString. Flatten mutates the ConsString and might return a
3137 // failure. 3137 // failure.
3138 Object* Flatten(StringShape shape); 3138 Object* TryFlatten(StringShape shape);
3139 // Try to flatten the string. Do not allow handling of allocation 3139
3140 // failures. After calling TryFlatten, the string could still be a 3140 // Try to flatten the string. Checks first inline to see if it is necessary.
3141 // ConsString. 3141 // Do not handle allocation failures. After calling TryFlattenIfNotFlat, the
3142 inline void TryFlatten(StringShape shape); 3142 // string could still be a ConsString, in which case a failure is returned.
3143 // Use FlattenString from Handles.cc to be sure to flatten.
3144 inline Object* TryFlattenIfNotFlat(StringShape shape);
3143 3145
3144 Vector<const char> ToAsciiVector(); 3146 Vector<const char> ToAsciiVector();
3145 Vector<const uc16> ToUC16Vector(); 3147 Vector<const uc16> ToUC16Vector();
3146 3148
3147 // Mark the string as an undetectable object. It only applies to 3149 // Mark the string as an undetectable object. It only applies to
3148 // ascii and two byte string types. 3150 // ascii and two byte string types.
3149 bool MarkAsUndetectable(); 3151 bool MarkAsUndetectable();
3150 3152
3151 // Slice the string and return a substring. 3153 // Slice the string and return a substring.
3152 Object* Slice(int from, int to); 3154 Object* Slice(int from, int to);
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 } else { 4221 } else {
4220 value &= ~(1 << bit_position); 4222 value &= ~(1 << bit_position);
4221 } 4223 }
4222 return value; 4224 return value;
4223 } 4225 }
4224 }; 4226 };
4225 4227
4226 } } // namespace v8::internal 4228 } } // namespace v8::internal
4227 4229
4228 #endif // V8_OBJECTS_H_ 4230 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698