| 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 #include "src/type-feedback-vector.h" | 10 #include "src/type-feedback-vector.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // JS modules are pretenured. | 403 // JS modules are pretenured. |
| 404 Handle<JSModule> NewJSModule(Handle<Context> context, | 404 Handle<JSModule> NewJSModule(Handle<Context> context, |
| 405 Handle<ScopeInfo> scope_info); | 405 Handle<ScopeInfo> scope_info); |
| 406 | 406 |
| 407 // JS arrays are pretenured when allocated by the parser. | 407 // JS arrays are pretenured when allocated by the parser. |
| 408 | 408 |
| 409 // Create a JSArray with a specified length and elements initialized | 409 // Create a JSArray with a specified length and elements initialized |
| 410 // according to the specified mode. | 410 // according to the specified mode. |
| 411 Handle<JSArray> NewJSArray( | 411 Handle<JSArray> NewJSArray( |
| 412 ElementsKind elements_kind, int length, int capacity, | 412 ElementsKind elements_kind, int length, int capacity, |
| 413 Strength strength = Strength::WEAK, | |
| 414 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, | 413 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 415 PretenureFlag pretenure = NOT_TENURED); | 414 PretenureFlag pretenure = NOT_TENURED); |
| 416 | 415 |
| 417 Handle<JSArray> NewJSArray( | 416 Handle<JSArray> NewJSArray( |
| 418 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 417 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 419 Strength strength = Strength::WEAK, | |
| 420 PretenureFlag pretenure = NOT_TENURED) { | 418 PretenureFlag pretenure = NOT_TENURED) { |
| 421 if (capacity != 0) { | 419 if (capacity != 0) { |
| 422 elements_kind = GetHoleyElementsKind(elements_kind); | 420 elements_kind = GetHoleyElementsKind(elements_kind); |
| 423 } | 421 } |
| 424 return NewJSArray(elements_kind, 0, capacity, strength, | 422 return NewJSArray(elements_kind, 0, capacity, |
| 425 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 423 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); |
| 426 } | 424 } |
| 427 | 425 |
| 428 // Create a JSArray with the given elements. | 426 // Create a JSArray with the given elements. |
| 429 Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 427 Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
| 430 ElementsKind elements_kind, int length, | 428 ElementsKind elements_kind, int length, |
| 431 Strength strength = Strength::WEAK, | |
| 432 PretenureFlag pretenure = NOT_TENURED); | 429 PretenureFlag pretenure = NOT_TENURED); |
| 433 | 430 |
| 434 Handle<JSArray> NewJSArrayWithElements( | 431 Handle<JSArray> NewJSArrayWithElements( |
| 435 Handle<FixedArrayBase> elements, | 432 Handle<FixedArrayBase> elements, |
| 436 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 433 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 437 Strength strength = Strength::WEAK, | |
| 438 PretenureFlag pretenure = NOT_TENURED) { | 434 PretenureFlag pretenure = NOT_TENURED) { |
| 439 return NewJSArrayWithElements(elements, elements_kind, elements->length(), | 435 return NewJSArrayWithElements(elements, elements_kind, elements->length(), |
| 440 strength, pretenure); | 436 pretenure); |
| 441 } | 437 } |
| 442 | 438 |
| 443 void NewJSArrayStorage( | 439 void NewJSArrayStorage( |
| 444 Handle<JSArray> array, | 440 Handle<JSArray> array, |
| 445 int length, | 441 int length, |
| 446 int capacity, | 442 int capacity, |
| 447 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); | 443 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
| 448 | 444 |
| 449 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); | 445 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); |
| 450 | 446 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 int end_position, | 640 int end_position, |
| 645 Handle<Object> script, | 641 Handle<Object> script, |
| 646 Handle<Object> stack_frames); | 642 Handle<Object> stack_frames); |
| 647 | 643 |
| 648 Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared); | 644 Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared); |
| 649 | 645 |
| 650 // Return a map for given number of properties using the map cache in the | 646 // Return a map for given number of properties using the map cache in the |
| 651 // native context. | 647 // native context. |
| 652 Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context, | 648 Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context, |
| 653 int number_of_properties, | 649 int number_of_properties, |
| 654 bool is_strong, | |
| 655 bool* is_result_from_cache); | 650 bool* is_result_from_cache); |
| 656 | 651 |
| 657 // Creates a new FixedArray that holds the data associated with the | 652 // Creates a new FixedArray that holds the data associated with the |
| 658 // atom regexp and stores it in the regexp. | 653 // atom regexp and stores it in the regexp. |
| 659 void SetRegExpAtomData(Handle<JSRegExp> regexp, | 654 void SetRegExpAtomData(Handle<JSRegExp> regexp, |
| 660 JSRegExp::Type type, | 655 JSRegExp::Type type, |
| 661 Handle<String> source, | 656 Handle<String> source, |
| 662 JSRegExp::Flags flags, | 657 JSRegExp::Flags flags, |
| 663 Handle<Object> match_pattern); | 658 Handle<Object> match_pattern); |
| 664 | 659 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 698 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 704 | 699 |
| 705 // Creates a function initialized with a shared part. | 700 // Creates a function initialized with a shared part. |
| 706 Handle<JSFunction> NewFunction(Handle<Map> map, | 701 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 707 Handle<SharedFunctionInfo> info, | 702 Handle<SharedFunctionInfo> info, |
| 708 Handle<Context> context, | 703 Handle<Context> context, |
| 709 PretenureFlag pretenure = TENURED); | 704 PretenureFlag pretenure = TENURED); |
| 710 | 705 |
| 711 // Create a JSArray with no elements and no length. | 706 // Create a JSArray with no elements and no length. |
| 712 Handle<JSArray> NewJSArray(ElementsKind elements_kind, | 707 Handle<JSArray> NewJSArray(ElementsKind elements_kind, |
| 713 Strength strength = Strength::WEAK, | |
| 714 PretenureFlag pretenure = NOT_TENURED); | 708 PretenureFlag pretenure = NOT_TENURED); |
| 715 }; | 709 }; |
| 716 | 710 |
| 717 } // namespace internal | 711 } // namespace internal |
| 718 } // namespace v8 | 712 } // namespace v8 |
| 719 | 713 |
| 720 #endif // V8_FACTORY_H_ | 714 #endif // V8_FACTORY_H_ |
| OLD | NEW |