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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 // constructor. The object is reinitialized and behaves as an | 445 // constructor. The object is reinitialized and behaves as an |
446 // object that has been freshly allocated using the constructor. | 446 // object that has been freshly allocated using the constructor. |
447 void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global, | 447 void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global, |
448 Handle<JSFunction> constructor); | 448 Handle<JSFunction> constructor); |
449 | 449 |
450 // Change the type of the argument into a JS object/function and reinitialize. | 450 // Change the type of the argument into a JS object/function and reinitialize. |
451 void BecomeJSObject(Handle<JSReceiver> object); | 451 void BecomeJSObject(Handle<JSReceiver> object); |
452 void BecomeJSFunction(Handle<JSReceiver> object); | 452 void BecomeJSFunction(Handle<JSReceiver> object); |
453 | 453 |
454 Handle<JSFunction> NewFunction(Handle<String> name, | 454 Handle<JSFunction> NewFunction(Handle<String> name, |
455 MaybeHandle<Code> maybe_code, | 455 Handle<Code> code, |
456 MaybeHandle<Object> maybe_prototype = | 456 Handle<Object> prototype); |
457 MaybeHandle<Object>()); | |
458 Handle<JSFunction> NewFunction(Handle<String> name); | 457 Handle<JSFunction> NewFunction(Handle<String> name); |
| 458 Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| 459 Handle<Code> code); |
459 | 460 |
460 Handle<JSFunction> NewFunctionFromSharedFunctionInfo( | 461 Handle<JSFunction> NewFunctionFromSharedFunctionInfo( |
461 Handle<SharedFunctionInfo> function_info, | 462 Handle<SharedFunctionInfo> function_info, |
462 Handle<Context> context, | 463 Handle<Context> context, |
463 PretenureFlag pretenure = TENURED); | 464 PretenureFlag pretenure = TENURED); |
464 | 465 |
465 Handle<JSFunction> NewFunction(Handle<Object> maybe_prototype, | 466 Handle<JSFunction> NewFunction(Handle<String> name, |
466 Handle<String> name, | 467 Handle<Code> code, |
| 468 Handle<Object> prototype, |
467 InstanceType type, | 469 InstanceType type, |
468 int instance_size, | 470 int instance_size); |
469 Handle<Code> code); | |
470 Handle<JSFunction> NewFunction(Handle<String> name, | 471 Handle<JSFunction> NewFunction(Handle<String> name, |
| 472 Handle<Code> code, |
471 InstanceType type, | 473 InstanceType type, |
472 int instance_size, | 474 int instance_size); |
473 Handle<Code> code); | |
474 | 475 |
475 // Create a serialized scope info. | 476 // Create a serialized scope info. |
476 Handle<ScopeInfo> NewScopeInfo(int length); | 477 Handle<ScopeInfo> NewScopeInfo(int length); |
477 | 478 |
478 // Create an External object for V8's external API. | 479 // Create an External object for V8's external API. |
479 Handle<JSObject> NewExternal(void* value); | 480 Handle<JSObject> NewExternal(void* value); |
480 | 481 |
481 // The reference to the Code object is stored in self_reference. | 482 // The reference to the Code object is stored in self_reference. |
482 // This allows generated code to reference its own Code object | 483 // This allows generated code to reference its own Code object |
483 // by containing this handle. | 484 // by containing this handle. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 591 } |
591 | 592 |
592 // Allocates a new SharedFunctionInfo object. | 593 // Allocates a new SharedFunctionInfo object. |
593 Handle<SharedFunctionInfo> NewSharedFunctionInfo( | 594 Handle<SharedFunctionInfo> NewSharedFunctionInfo( |
594 Handle<String> name, | 595 Handle<String> name, |
595 int number_of_literals, | 596 int number_of_literals, |
596 bool is_generator, | 597 bool is_generator, |
597 Handle<Code> code, | 598 Handle<Code> code, |
598 Handle<ScopeInfo> scope_info, | 599 Handle<ScopeInfo> scope_info, |
599 Handle<FixedArray> feedback_vector); | 600 Handle<FixedArray> feedback_vector); |
600 Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); | 601 Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name, |
| 602 MaybeHandle<Code> code); |
601 | 603 |
602 // Allocate a new type feedback vector | 604 // Allocate a new type feedback vector |
603 Handle<FixedArray> NewTypeFeedbackVector(int slot_count); | 605 Handle<FixedArray> NewTypeFeedbackVector(int slot_count); |
604 | 606 |
605 // Allocates a new JSMessageObject object. | 607 // Allocates a new JSMessageObject object. |
606 Handle<JSMessageObject> NewJSMessageObject( | 608 Handle<JSMessageObject> NewJSMessageObject( |
607 Handle<String> type, | 609 Handle<String> type, |
608 Handle<JSArray> arguments, | 610 Handle<JSArray> arguments, |
609 int start_position, | 611 int start_position, |
610 int end_position, | 612 int end_position, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 Handle<T> New(Handle<Map> map, AllocationSpace space); | 654 Handle<T> New(Handle<Map> map, AllocationSpace space); |
653 | 655 |
654 template<typename T> | 656 template<typename T> |
655 Handle<T> New(Handle<Map> map, | 657 Handle<T> New(Handle<Map> map, |
656 AllocationSpace space, | 658 AllocationSpace space, |
657 Handle<AllocationSite> allocation_site); | 659 Handle<AllocationSite> allocation_site); |
658 | 660 |
659 // Creates a code object that is not yet fully initialized yet. | 661 // Creates a code object that is not yet fully initialized yet. |
660 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); | 662 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); |
661 | 663 |
662 // Initializes a function with a shared part and prototype. | |
663 // Note: this code was factored out of NewFunction such that other parts of | |
664 // the VM could use it. Specifically, a function that creates instances of | |
665 // type JS_FUNCTION_TYPE benefit from the use of this function. | |
666 inline void InitializeFunction(Handle<JSFunction> function, | |
667 Handle<SharedFunctionInfo> info, | |
668 Handle<Context> context); | |
669 | |
670 // Creates a function initialized with a shared part. | |
671 inline Handle<JSFunction> NewFunction(Handle<Map> map, | |
672 Handle<SharedFunctionInfo> info, | |
673 Handle<Context> context, | |
674 PretenureFlag pretenure = TENURED); | |
675 | |
676 // Create a new map cache. | 664 // Create a new map cache. |
677 Handle<MapCache> NewMapCache(int at_least_space_for); | 665 Handle<MapCache> NewMapCache(int at_least_space_for); |
678 | 666 |
679 // Update the map cache in the native context with (keys, map) | 667 // Update the map cache in the native context with (keys, map) |
680 Handle<MapCache> AddToMapCache(Handle<Context> context, | 668 Handle<MapCache> AddToMapCache(Handle<Context> context, |
681 Handle<FixedArray> keys, | 669 Handle<FixedArray> keys, |
682 Handle<Map> map); | 670 Handle<Map> map); |
683 | 671 |
684 // Attempt to find the number in a small cache. If we finds it, return | 672 // Attempt to find the number in a small cache. If we finds it, return |
685 // the string representation of the number. Otherwise return undefined. | 673 // the string representation of the number. Otherwise return undefined. |
686 Handle<Object> GetNumberStringCache(Handle<Object> number); | 674 Handle<Object> GetNumberStringCache(Handle<Object> number); |
687 | 675 |
688 // Update the cache with a new number-string pair. | 676 // Update the cache with a new number-string pair. |
689 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 677 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 678 |
| 679 // Initializes a function with a shared part and prototype. |
| 680 // Note: this code was factored out of NewFunction such that other parts of |
| 681 // the VM could use it. Specifically, a function that creates instances of |
| 682 // type JS_FUNCTION_TYPE benefit from the use of this function. |
| 683 inline void InitializeFunction(Handle<JSFunction> function, |
| 684 Handle<SharedFunctionInfo> info, |
| 685 Handle<Context> context); |
| 686 |
| 687 // Creates a function initialized with a shared part. |
| 688 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 689 Handle<SharedFunctionInfo> info, |
| 690 Handle<Context> context, |
| 691 PretenureFlag pretenure = TENURED); |
| 692 |
| 693 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 694 Handle<String> name, |
| 695 MaybeHandle<Code> maybe_code); |
690 }; | 696 }; |
691 | 697 |
692 } } // namespace v8::internal | 698 } } // namespace v8::internal |
693 | 699 |
694 #endif // V8_FACTORY_H_ | 700 #endif // V8_FACTORY_H_ |
OLD | NEW |