| 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // to do that. | 626 // to do that. |
| 627 template<typename T> | 627 template<typename T> |
| 628 Handle<T> New(Handle<Map> map, AllocationSpace space); | 628 Handle<T> New(Handle<Map> map, AllocationSpace space); |
| 629 | 629 |
| 630 template<typename T> | 630 template<typename T> |
| 631 Handle<T> New(Handle<Map> map, | 631 Handle<T> New(Handle<Map> map, |
| 632 AllocationSpace space, | 632 AllocationSpace space, |
| 633 Handle<AllocationSite> allocation_site); | 633 Handle<AllocationSite> allocation_site); |
| 634 | 634 |
| 635 // Initializes a function with a shared part and prototype. | 635 // Initializes a function with a shared part and prototype. |
| 636 // Note: this code was factored out of NewFunctionHelper such that | 636 // Note: this code was factored out of NewFunction such that other parts of |
| 637 // other parts of the VM could use it. Specifically, a function that creates | 637 // the VM could use it. Specifically, a function that creates instances of |
| 638 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. | 638 // type JS_FUNCTION_TYPE benefit from the use of this function. |
| 639 inline void InitializeFunction(Handle<JSFunction> function, | 639 inline void InitializeFunction(Handle<JSFunction> function, |
| 640 Handle<SharedFunctionInfo> shared, | 640 Handle<SharedFunctionInfo> info, |
| 641 Handle<Object> prototype); | 641 Handle<Context> context, |
| 642 MaybeHandle<Object> maybe_prototype); |
| 642 | 643 |
| 643 // Creates a function initialized with a shared part. | 644 // Creates a function initialized with a shared part. |
| 644 inline Handle<JSFunction> NewFunctionHelper( | 645 inline Handle<JSFunction> NewFunction(Handle<SharedFunctionInfo> info, |
| 645 Handle<Map> function_map, | 646 Handle<Context> context, |
| 646 Handle<SharedFunctionInfo> shared, | 647 MaybeHandle<Object> maybe_prototype, |
| 647 Handle<Object> prototype, | 648 PretenureFlag pretenure = TENURED); |
| 648 PretenureFlag pretenure = TENURED); | |
| 649 | 649 |
| 650 // Create a new map cache. | 650 // Create a new map cache. |
| 651 Handle<MapCache> NewMapCache(int at_least_space_for); | 651 Handle<MapCache> NewMapCache(int at_least_space_for); |
| 652 | 652 |
| 653 // Update the map cache in the native context with (keys, map) | 653 // Update the map cache in the native context with (keys, map) |
| 654 Handle<MapCache> AddToMapCache(Handle<Context> context, | 654 Handle<MapCache> AddToMapCache(Handle<Context> context, |
| 655 Handle<FixedArray> keys, | 655 Handle<FixedArray> keys, |
| 656 Handle<Map> map); | 656 Handle<Map> map); |
| 657 | 657 |
| 658 // Attempt to find the number in a small cache. If we finds it, return | 658 // Attempt to find the number in a small cache. If we finds it, return |
| 659 // the string representation of the number. Otherwise return undefined. | 659 // the string representation of the number. Otherwise return undefined. |
| 660 Handle<Object> GetNumberStringCache(Handle<Object> number); | 660 Handle<Object> GetNumberStringCache(Handle<Object> number); |
| 661 | 661 |
| 662 // Update the cache with a new number-string pair. | 662 // Update the cache with a new number-string pair. |
| 663 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 663 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 664 }; | 664 }; |
| 665 | 665 |
| 666 } } // namespace v8::internal | 666 } } // namespace v8::internal |
| 667 | 667 |
| 668 #endif // V8_FACTORY_H_ | 668 #endif // V8_FACTORY_H_ |
| OLD | NEW |