| 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/feedback-vector.h" | 8 #include "src/feedback-vector.h" |
| 9 #include "src/globals.h" | 9 #include "src/globals.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 .ToHandleChecked(); | 159 .ToHandleChecked(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 inline Handle<String> NewStringFromAsciiChecked( | 162 inline Handle<String> NewStringFromAsciiChecked( |
| 163 const char* str, | 163 const char* str, |
| 164 PretenureFlag pretenure = NOT_TENURED) { | 164 PretenureFlag pretenure = NOT_TENURED) { |
| 165 return NewStringFromOneByte( | 165 return NewStringFromOneByte( |
| 166 OneByteVector(str), pretenure).ToHandleChecked(); | 166 OneByteVector(str), pretenure).ToHandleChecked(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 | |
| 170 // Allocates and fully initializes a String. There are two String encodings: | |
| 171 // one-byte and two-byte. One should choose between the threestring | |
| 172 // allocation functions based on the encoding of the string buffer used to | |
| 173 // initialized the string. | |
| 174 // - ...FromOneByte initializes the string from a buffer that is Latin1 | |
| 175 // encoded (it does not check that the buffer is Latin1 encoded) and the | |
| 176 // result will be Latin1 encoded. | |
| 177 // - ...FromUTF8 initializes the string from a buffer that is UTF-8 | |
| 178 // encoded. If the characters are all ASCII characters, the result | |
| 179 // will be Latin1 encoded, otherwise it will converted to two-byte. | |
| 180 // - ...FromTwoByte initializes the string from a buffer that is two-byte | |
| 181 // encoded. If the characters are all Latin1 characters, the | |
| 182 // result will be converted to Latin1, otherwise it will be left as | |
| 183 // two-byte. | |
| 184 | |
| 185 // TODO(dcarney): remove this function. | |
| 186 MUST_USE_RESULT inline MaybeHandle<String> NewStringFromAscii( | |
| 187 Vector<const char> str, | |
| 188 PretenureFlag pretenure = NOT_TENURED) { | |
| 189 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); | |
| 190 } | |
| 191 | |
| 192 // UTF8 strings are pretenured when used for regexp literal patterns and | 169 // UTF8 strings are pretenured when used for regexp literal patterns and |
| 193 // flags in the parser. | 170 // flags in the parser. |
| 194 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( | 171 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( |
| 195 Vector<const char> str, PretenureFlag pretenure = NOT_TENURED); | 172 Vector<const char> str, PretenureFlag pretenure = NOT_TENURED); |
| 196 | 173 |
| 197 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8SubString( | 174 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8SubString( |
| 198 Handle<SeqOneByteString> str, int begin, int end, | 175 Handle<SeqOneByteString> str, int begin, int end, |
| 199 PretenureFlag pretenure = NOT_TENURED); | 176 PretenureFlag pretenure = NOT_TENURED); |
| 200 | 177 |
| 201 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( | 178 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 822 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
| 846 FunctionMode function_mode); | 823 FunctionMode function_mode); |
| 847 | 824 |
| 848 void SetClassFunctionInstanceDescriptor(Handle<Map> map); | 825 void SetClassFunctionInstanceDescriptor(Handle<Map> map); |
| 849 }; | 826 }; |
| 850 | 827 |
| 851 } // namespace internal | 828 } // namespace internal |
| 852 } // namespace v8 | 829 } // namespace v8 |
| 853 | 830 |
| 854 #endif // V8_FACTORY_H_ | 831 #endif // V8_FACTORY_H_ |
| OLD | NEW |