| 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 "isolate.h" | 8 #include "isolate.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 PretenureFlag pretenure = NOT_TENURED); | 172 PretenureFlag pretenure = NOT_TENURED); |
| 173 | 173 |
| 174 // Creates a single character string where the character has given code. | 174 // Creates a single character string where the character has given code. |
| 175 // A cache is used for ASCII codes. | 175 // A cache is used for ASCII codes. |
| 176 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); | 176 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); |
| 177 | 177 |
| 178 // Create a new cons string object which consists of a pair of strings. | 178 // Create a new cons string object which consists of a pair of strings. |
| 179 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, | 179 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, |
| 180 Handle<String> right); | 180 Handle<String> right); |
| 181 | 181 |
| 182 Handle<ConsString> NewRawConsString(String::Encoding encoding); | |
| 183 | |
| 184 // Create a new sequential string containing the concatenation of the inputs. | 182 // Create a new sequential string containing the concatenation of the inputs. |
| 185 Handle<String> NewFlatConcatString(Handle<String> first, | 183 Handle<String> NewFlatConcatString(Handle<String> first, |
| 186 Handle<String> second); | 184 Handle<String> second); |
| 187 | 185 |
| 188 // Create a new string object which holds a proper substring of a string. | 186 // Create a new string object which holds a proper substring of a string. |
| 189 Handle<String> NewProperSubString(Handle<String> str, | 187 Handle<String> NewProperSubString(Handle<String> str, |
| 190 int begin, | 188 int begin, |
| 191 int end); | 189 int end); |
| 192 | 190 |
| 193 // Create a new string object which holds a substring of a string. | 191 // Create a new string object which holds a substring of a string. |
| 194 Handle<String> NewSubString(Handle<String> str, int begin, int end) { | 192 Handle<String> NewSubString(Handle<String> str, int begin, int end) { |
| 195 if (begin == 0 && end == str->length()) return str; | 193 if (begin == 0 && end == str->length()) return str; |
| 196 return NewProperSubString(str, begin, end); | 194 return NewProperSubString(str, begin, end); |
| 197 } | 195 } |
| 198 | 196 |
| 199 Handle<SlicedString> NewRawSlicedString(String::Encoding encoding); | |
| 200 | |
| 201 // Creates a new external String object. There are two String encodings | 197 // Creates a new external String object. There are two String encodings |
| 202 // in the system: ASCII and two byte. Unlike other String types, it does | 198 // in the system: ASCII and two byte. Unlike other String types, it does |
| 203 // not make sense to have a UTF-8 factory function for external strings, | 199 // not make sense to have a UTF-8 factory function for external strings, |
| 204 // because we cannot change the underlying buffer. Note that these strings | 200 // because we cannot change the underlying buffer. Note that these strings |
| 205 // are backed by a string resource that resides outside the V8 heap. | 201 // are backed by a string resource that resides outside the V8 heap. |
| 206 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( | 202 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( |
| 207 const ExternalAsciiString::Resource* resource); | 203 const ExternalAsciiString::Resource* resource); |
| 208 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( | 204 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( |
| 209 const ExternalTwoByteString::Resource* resource); | 205 const ExternalTwoByteString::Resource* resource); |
| 210 | 206 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 InstanceType type, | 289 InstanceType type, |
| 294 int instance_size, | 290 int instance_size, |
| 295 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 291 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 296 | 292 |
| 297 Handle<HeapObject> NewFillerObject(int size, | 293 Handle<HeapObject> NewFillerObject(int size, |
| 298 bool double_align, | 294 bool double_align, |
| 299 AllocationSpace space); | 295 AllocationSpace space); |
| 300 | 296 |
| 301 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); | 297 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); |
| 302 | 298 |
| 299 Handle<JSObject> CopyJSObject(Handle<JSObject> object); |
| 300 |
| 301 Handle<JSObject> CopyJSObjectWithAllocationSite(Handle<JSObject> object, |
| 302 Handle<AllocationSite> site); |
| 303 |
| 303 Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array, | 304 Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array, |
| 304 Handle<Map> map); | 305 Handle<Map> map); |
| 305 | 306 |
| 306 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); | 307 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); |
| 307 | 308 |
| 308 // This method expects a COW array in new space, and creates a copy | 309 // This method expects a COW array in new space, and creates a copy |
| 309 // of it in old space. | 310 // of it in old space. |
| 310 Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array); | 311 Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array); |
| 311 | 312 |
| 312 Handle<FixedDoubleArray> CopyFixedDoubleArray( | 313 Handle<FixedDoubleArray> CopyFixedDoubleArray( |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // the string representation of the number. Otherwise return undefined. | 681 // the string representation of the number. Otherwise return undefined. |
| 681 Handle<Object> GetNumberStringCache(Handle<Object> number); | 682 Handle<Object> GetNumberStringCache(Handle<Object> number); |
| 682 | 683 |
| 683 // Update the cache with a new number-string pair. | 684 // Update the cache with a new number-string pair. |
| 684 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 685 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 685 }; | 686 }; |
| 686 | 687 |
| 687 } } // namespace v8::internal | 688 } } // namespace v8::internal |
| 688 | 689 |
| 689 #endif // V8_FACTORY_H_ | 690 #endif // V8_FACTORY_H_ |
| OLD | NEW |