OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ |
6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ |
7 | 7 |
8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 | 10 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( | 149 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( |
150 Vector<const char> str, | 150 Vector<const char> str, |
151 PretenureFlag pretenure = NOT_TENURED); | 151 PretenureFlag pretenure = NOT_TENURED); |
152 | 152 |
153 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( | 153 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
154 Vector<const uc16> str, | 154 Vector<const uc16> str, |
155 PretenureFlag pretenure = NOT_TENURED); | 155 PretenureFlag pretenure = NOT_TENURED); |
156 | 156 |
157 // Allocates an internalized string in old space based on the character | 157 // Allocates an internalized string in old space based on the character |
158 // stream. | 158 // stream. |
159 MUST_USE_RESULT Handle<String> NewInternalizedStringFromUtf8( | 159 Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str, |
160 Vector<const char> str, | 160 int chars, uint32_t hash_field); |
161 int chars, | |
162 uint32_t hash_field); | |
163 | 161 |
164 MUST_USE_RESULT Handle<String> NewOneByteInternalizedString( | 162 Handle<String> NewOneByteInternalizedString(Vector<const uint8_t> str, |
165 Vector<const uint8_t> str, uint32_t hash_field); | 163 uint32_t hash_field); |
166 | 164 |
167 MUST_USE_RESULT Handle<String> NewOneByteInternalizedSubString( | 165 Handle<String> NewOneByteInternalizedSubString( |
168 Handle<SeqOneByteString> string, int offset, int length, | 166 Handle<SeqOneByteString> string, int offset, int length, |
169 uint32_t hash_field); | 167 uint32_t hash_field); |
170 | 168 |
171 MUST_USE_RESULT Handle<String> NewTwoByteInternalizedString( | 169 Handle<String> NewTwoByteInternalizedString(Vector<const uc16> str, |
172 Vector<const uc16> str, | 170 uint32_t hash_field); |
173 uint32_t hash_field); | |
174 | 171 |
175 MUST_USE_RESULT Handle<String> NewInternalizedStringImpl( | 172 Handle<String> NewInternalizedStringImpl(Handle<String> string, int chars, |
176 Handle<String> string, int chars, uint32_t hash_field); | 173 uint32_t hash_field); |
177 | 174 |
178 // Compute the matching internalized string map for a string if possible. | 175 // Compute the matching internalized string map for a string if possible. |
179 // Empty handle is returned if string is in new space or not flattened. | 176 // Empty handle is returned if string is in new space or not flattened. |
180 MUST_USE_RESULT MaybeHandle<Map> InternalizedStringMapForString( | 177 MUST_USE_RESULT MaybeHandle<Map> InternalizedStringMapForString( |
181 Handle<String> string); | 178 Handle<String> string); |
182 | 179 |
183 // Allocates and partially initializes an one-byte or two-byte String. The | 180 // Allocates and partially initializes an one-byte or two-byte String. The |
184 // characters of the string are uninitialized. Currently used in regexp code | 181 // characters of the string are uninitialized. Currently used in regexp code |
185 // only, where they are pretenured. | 182 // only, where they are pretenured. |
186 MUST_USE_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString( | 183 MUST_USE_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString( |
187 int length, | 184 int length, |
188 PretenureFlag pretenure = NOT_TENURED); | 185 PretenureFlag pretenure = NOT_TENURED); |
189 MUST_USE_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString( | 186 MUST_USE_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString( |
190 int length, | 187 int length, |
191 PretenureFlag pretenure = NOT_TENURED); | 188 PretenureFlag pretenure = NOT_TENURED); |
192 | 189 |
193 // Creates a single character string where the character has given code. | 190 // Creates a single character string where the character has given code. |
194 // A cache is used for Latin1 codes. | 191 // A cache is used for Latin1 codes. |
195 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); | 192 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); |
196 | 193 |
197 // Create a new cons string object which consists of a pair of strings. | 194 // Create a new cons string object which consists of a pair of strings. |
198 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, | 195 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, |
199 Handle<String> right); | 196 Handle<String> right); |
200 MUST_USE_RESULT MaybeHandle<String> NewOneByteConsString( | |
201 int length, Handle<String> left, Handle<String> right); | |
202 MUST_USE_RESULT MaybeHandle<String> NewTwoByteConsString( | |
203 int length, Handle<String> left, Handle<String> right); | |
204 MUST_USE_RESULT MaybeHandle<String> NewRawConsString(Handle<Map> map, | |
205 int length, | |
206 Handle<String> left, | |
207 Handle<String> right); | |
208 | 197 |
209 // Create a new string object which holds a proper substring of a string. | 198 // Create a new string object which holds a proper substring of a string. |
210 Handle<String> NewProperSubString(Handle<String> str, | 199 Handle<String> NewProperSubString(Handle<String> str, |
211 int begin, | 200 int begin, |
212 int end); | 201 int end); |
213 | 202 |
214 // Create a new string object which holds a substring of a string. | 203 // Create a new string object which holds a substring of a string. |
215 Handle<String> NewSubString(Handle<String> str, int begin, int end) { | 204 Handle<String> NewSubString(Handle<String> str, int begin, int end) { |
216 if (begin == 0 && end == str->length()) return str; | 205 if (begin == 0 && end == str->length()) return str; |
217 return NewProperSubString(str, begin, end); | 206 return NewProperSubString(str, begin, end); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 // Reinitialize a JSProxy into an (empty) JS object of respective type and | 716 // Reinitialize a JSProxy into an (empty) JS object of respective type and |
728 // size, but keeping the original prototype. The receiver must have at least | 717 // size, but keeping the original prototype. The receiver must have at least |
729 // the size of the new object. The object is reinitialized and behaves as an | 718 // the size of the new object. The object is reinitialized and behaves as an |
730 // object that has been freshly allocated. | 719 // object that has been freshly allocated. |
731 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 720 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); |
732 }; | 721 }; |
733 | 722 |
734 } } // namespace v8::internal | 723 } } // namespace v8::internal |
735 | 724 |
736 #endif // V8_FACTORY_H_ | 725 #endif // V8_FACTORY_H_ |
OLD | NEW |