| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 PretenureFlag pretenure = NOT_TENURED); | 179 PretenureFlag pretenure = NOT_TENURED); |
| 180 | 180 |
| 181 // Creates a single character string where the character has given code. | 181 // Creates a single character string where the character has given code. |
| 182 // A cache is used for ASCII codes. | 182 // A cache is used for ASCII codes. |
| 183 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); | 183 Handle<String> LookupSingleCharacterStringFromCode(uint32_t code); |
| 184 | 184 |
| 185 // Create a new cons string object which consists of a pair of strings. | 185 // Create a new cons string object which consists of a pair of strings. |
| 186 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, | 186 MUST_USE_RESULT MaybeHandle<String> NewConsString(Handle<String> left, |
| 187 Handle<String> right); | 187 Handle<String> right); |
| 188 | 188 |
| 189 Handle<ConsString> NewRawConsString(String::Encoding encoding); | |
| 190 | |
| 191 // Create a new sequential string containing the concatenation of the inputs. | 189 // Create a new sequential string containing the concatenation of the inputs. |
| 192 Handle<String> NewFlatConcatString(Handle<String> first, | 190 Handle<String> NewFlatConcatString(Handle<String> first, |
| 193 Handle<String> second); | 191 Handle<String> second); |
| 194 | 192 |
| 195 // Create a new string object which holds a proper substring of a string. | 193 // Create a new string object which holds a proper substring of a string. |
| 196 Handle<String> NewProperSubString(Handle<String> str, | 194 Handle<String> NewProperSubString(Handle<String> str, |
| 197 int begin, | 195 int begin, |
| 198 int end); | 196 int end); |
| 199 | 197 |
| 200 // Create a new string object which holds a substring of a string. | 198 // Create a new string object which holds a substring of a string. |
| 201 Handle<String> NewSubString(Handle<String> str, int begin, int end) { | 199 Handle<String> NewSubString(Handle<String> str, int begin, int end) { |
| 202 if (begin == 0 && end == str->length()) return str; | 200 if (begin == 0 && end == str->length()) return str; |
| 203 return NewProperSubString(str, begin, end); | 201 return NewProperSubString(str, begin, end); |
| 204 } | 202 } |
| 205 | 203 |
| 206 Handle<SlicedString> NewRawSlicedString(String::Encoding encoding); | |
| 207 | |
| 208 // Creates a new external String object. There are two String encodings | 204 // Creates a new external String object. There are two String encodings |
| 209 // in the system: ASCII and two byte. Unlike other String types, it does | 205 // in the system: ASCII and two byte. Unlike other String types, it does |
| 210 // not make sense to have a UTF-8 factory function for external strings, | 206 // not make sense to have a UTF-8 factory function for external strings, |
| 211 // because we cannot change the underlying buffer. Note that these strings | 207 // because we cannot change the underlying buffer. Note that these strings |
| 212 // are backed by a string resource that resides outside the V8 heap. | 208 // are backed by a string resource that resides outside the V8 heap. |
| 213 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( | 209 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromAscii( |
| 214 const ExternalAsciiString::Resource* resource); | 210 const ExternalAsciiString::Resource* resource); |
| 215 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( | 211 MUST_USE_RESULT MaybeHandle<String> NewExternalStringFromTwoByte( |
| 216 const ExternalTwoByteString::Resource* resource); | 212 const ExternalTwoByteString::Resource* resource); |
| 217 | 213 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 InstanceType type, | 296 InstanceType type, |
| 301 int instance_size, | 297 int instance_size, |
| 302 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); | 298 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
| 303 | 299 |
| 304 Handle<HeapObject> NewFillerObject(int size, | 300 Handle<HeapObject> NewFillerObject(int size, |
| 305 bool double_align, | 301 bool double_align, |
| 306 AllocationSpace space); | 302 AllocationSpace space); |
| 307 | 303 |
| 308 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); | 304 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); |
| 309 | 305 |
| 306 Handle<JSObject> CopyJSObject(Handle<JSObject> object); |
| 307 |
| 308 Handle<JSObject> CopyJSObjectWithMemento(Handle<JSObject> object, |
| 309 Handle<AllocationSite> site); |
| 310 |
| 311 Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array, |
| 312 Handle<Map> map); |
| 313 |
| 310 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); | 314 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); |
| 311 | 315 |
| 312 // This method expects a COW array in new space, and creates a copy | 316 // This method expects a COW array in new space, and creates a copy |
| 313 // of it in old space. | 317 // of it in old space. |
| 314 Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array); | 318 Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array); |
| 315 | 319 |
| 316 Handle<FixedArray> CopySizeFixedArray(Handle<FixedArray> array, | 320 Handle<FixedArray> CopySizeFixedArray(Handle<FixedArray> array, |
| 317 int new_length, | 321 int new_length, |
| 318 PretenureFlag pretenure = NOT_TENURED); | 322 PretenureFlag pretenure = NOT_TENURED); |
| 319 | 323 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 // the string representation of the number. Otherwise return undefined. | 692 // the string representation of the number. Otherwise return undefined. |
| 689 Handle<Object> GetNumberStringCache(Handle<Object> number); | 693 Handle<Object> GetNumberStringCache(Handle<Object> number); |
| 690 | 694 |
| 691 // Update the cache with a new number-string pair. | 695 // Update the cache with a new number-string pair. |
| 692 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 696 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 693 }; | 697 }; |
| 694 | 698 |
| 695 } } // namespace v8::internal | 699 } } // namespace v8::internal |
| 696 | 700 |
| 697 #endif // V8_FACTORY_H_ | 701 #endif // V8_FACTORY_H_ |
| OLD | NEW |