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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 Handle<T> New(Handle<Map> map, AllocationSpace space); | 653 Handle<T> New(Handle<Map> map, AllocationSpace space); |
653 | 654 |
654 template<typename T> | 655 template<typename T> |
655 Handle<T> New(Handle<Map> map, | 656 Handle<T> New(Handle<Map> map, |
656 AllocationSpace space, | 657 AllocationSpace space, |
657 Handle<AllocationSite> allocation_site); | 658 Handle<AllocationSite> allocation_site); |
658 | 659 |
659 // Creates a code object that is not yet fully initialized yet. | 660 // Creates a code object that is not yet fully initialized yet. |
660 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); | 661 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); |
661 | 662 |
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. | 663 // Create a new map cache. |
677 Handle<MapCache> NewMapCache(int at_least_space_for); | 664 Handle<MapCache> NewMapCache(int at_least_space_for); |
678 | 665 |
679 // Update the map cache in the native context with (keys, map) | 666 // Update the map cache in the native context with (keys, map) |
680 Handle<MapCache> AddToMapCache(Handle<Context> context, | 667 Handle<MapCache> AddToMapCache(Handle<Context> context, |
681 Handle<FixedArray> keys, | 668 Handle<FixedArray> keys, |
682 Handle<Map> map); | 669 Handle<Map> map); |
683 | 670 |
684 // Attempt to find the number in a small cache. If we finds it, return | 671 // Attempt to find the number in a small cache. If we finds it, return |
685 // the string representation of the number. Otherwise return undefined. | 672 // the string representation of the number. Otherwise return undefined. |
686 Handle<Object> GetNumberStringCache(Handle<Object> number); | 673 Handle<Object> GetNumberStringCache(Handle<Object> number); |
687 | 674 |
688 // Update the cache with a new number-string pair. | 675 // Update the cache with a new number-string pair. |
689 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 676 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 677 |
| 678 // Initializes a function with a shared part and prototype. |
| 679 // Note: this code was factored out of NewFunction such that other parts of |
| 680 // the VM could use it. Specifically, a function that creates instances of |
| 681 // type JS_FUNCTION_TYPE benefit from the use of this function. |
| 682 inline void InitializeFunction(Handle<JSFunction> function, |
| 683 Handle<SharedFunctionInfo> info, |
| 684 Handle<Context> context); |
| 685 |
| 686 // Creates a function initialized with a shared part. |
| 687 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 688 Handle<SharedFunctionInfo> info, |
| 689 Handle<Context> context, |
| 690 PretenureFlag pretenure = TENURED); |
| 691 |
| 692 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 693 Handle<SharedFunctionInfo> info); |
690 }; | 694 }; |
691 | 695 |
692 } } // namespace v8::internal | 696 } } // namespace v8::internal |
693 | 697 |
694 #endif // V8_FACTORY_H_ | 698 #endif // V8_FACTORY_H_ |
OLD | NEW |