Chromium Code Reviews| Index: src/factory.h |
| diff --git a/src/factory.h b/src/factory.h |
| index 107cbfd1ceb8488cef9cd5f65ecac41f2ccc5975..7135e9c98c32ec62e0ed1aed91a2cbfab0c62afa 100644 |
| --- a/src/factory.h |
| +++ b/src/factory.h |
| @@ -388,6 +388,20 @@ class Factory V8_FINAL { |
| Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); |
| + // Reinitialize a JSReceiver into an (empty) JS object of respective type and |
| + // size, but keeping the original prototype. The receiver must have at least |
| + // the size of the new object. The object is reinitialized and behaves as an |
| + // object that has been freshly allocated. |
| + void ReinitializeJSReceiver( |
| + Handle<JSReceiver> object, InstanceType type, int size); |
| + |
| + // Reinitialize an JSGlobalProxy based on a constructor. The object |
| + // must have the same size as objects allocated using the |
| + // constructor. The object is reinitialized and behaves as an |
| + // object that has been freshly allocated using the constructor. |
| + void ReinitializeJSGlobalProxy( |
| + Handle<JSFunction> constructor, Handle<JSGlobalProxy> global); |
|
Michael Starzinger
2014/04/15 09:54:59
suggestion: I know it was like this before your ch
Igor Sheludko
2014/04/15 11:03:42
I agree, done.
|
| + |
| // Change the type of the argument into a JS object/function and reinitialize. |
| void BecomeJSObject(Handle<JSReceiver> object); |
| void BecomeJSFunction(Handle<JSReceiver> object); |
| @@ -395,22 +409,30 @@ class Factory V8_FINAL { |
| Handle<JSFunction> NewFunction(Handle<String> name, |
| Handle<Object> prototype); |
| - Handle<JSFunction> NewFunctionWithoutPrototype( |
|
Igor Sheludko
2014/04/15 08:33:32
moved declaration down
|
| - Handle<String> name, |
| - StrictMode strict_mode); |
| - |
| - Handle<JSFunction> NewFunction(Handle<Object> super, bool is_global); |
|
Igor Sheludko
2014/04/15 08:33:32
declaration only
|
| - |
| - Handle<JSFunction> BaseNewFunctionFromSharedFunctionInfo( |
|
Igor Sheludko
2014/04/15 08:33:32
one usage - inlined
|
| - Handle<SharedFunctionInfo> function_info, |
| - Handle<Map> function_map, |
| - PretenureFlag pretenure); |
| - |
| Handle<JSFunction> NewFunctionFromSharedFunctionInfo( |
| Handle<SharedFunctionInfo> function_info, |
| Handle<Context> context, |
| PretenureFlag pretenure = TENURED); |
| + Handle<JSFunction> NewFunction(Handle<String> name, |
| + InstanceType type, |
| + int instance_size, |
| + Handle<Code> code, |
| + bool force_initial_map); |
| + |
| + Handle<JSFunction> NewFunctionWithPrototype(Handle<String> name, |
| + InstanceType type, |
| + int instance_size, |
| + Handle<JSObject> prototype, |
| + Handle<Code> code, |
| + bool force_initial_map); |
| + |
| + Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| + StrictMode strict_mode); |
| + |
| + Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| + Handle<Code> code); |
| + |
| // Create a serialized scope info. |
| Handle<ScopeInfo> NewScopeInfo(int length); |
| @@ -466,26 +488,6 @@ class Factory V8_FINAL { |
| Vector< Handle<Object> > args); |
| - Handle<JSFunction> NewFunction(Handle<String> name, |
|
Igor Sheludko
2014/04/15 08:33:32
Moved these declarations up
|
| - InstanceType type, |
| - int instance_size, |
| - Handle<Code> code, |
| - bool force_initial_map); |
| - |
| - Handle<JSFunction> NewFunction(Handle<Map> function_map, |
|
Igor Sheludko
2014/04/15 08:33:32
declaration only
|
| - Handle<SharedFunctionInfo> shared, Handle<Object> prototype); |
| - |
| - |
| - Handle<JSFunction> NewFunctionWithPrototype(Handle<String> name, |
| - InstanceType type, |
| - int instance_size, |
| - Handle<JSObject> prototype, |
| - Handle<Code> code, |
| - bool force_initial_map); |
| - |
| - Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| - Handle<Code> code); |
| - |
| Handle<String> NumberToString(Handle<Object> number); |
| Handle<String> Uint32ToString(uint32_t value); |
| @@ -597,12 +599,29 @@ class Factory V8_FINAL { |
| private: |
| Isolate* isolate() { return reinterpret_cast<Isolate*>(this); } |
| - Handle<JSFunction> NewFunctionHelper(Handle<String> name, |
| - Handle<Object> prototype); |
| + // Creates a heap object based on the map. |
|
Michael Starzinger
2014/04/15 09:54:59
nit: Can we add one sentence saying that the field
Igor Sheludko
2014/04/15 11:03:42
Done.
|
| + template<typename T> |
| + Handle<T> New(Handle<Map> map, AllocationSpace space); |
| + |
| + template<typename T> |
| + Handle<T> New(Handle<Map> map, |
| + AllocationSpace space, |
| + Handle<AllocationSite> allocation_site); |
| + |
| + // Initializes a function with a shared part and prototype. |
| + // Note: this code was factored out of NewFunctionHelper such that |
| + // other parts of the VM could use it. Specifically, a function that creates |
| + // instances of type JS_FUNCTION_TYPE benefit from the use of this function. |
| + inline void InitializeFunction(Handle<JSFunction> function, |
| + Handle<SharedFunctionInfo> shared, |
| + Handle<Object> prototype); |
| - Handle<JSFunction> NewFunctionWithoutPrototypeHelper( |
| - Handle<String> name, |
| - StrictMode strict_mode); |
| + // Creates a function initialized with a shared part. |
| + inline Handle<JSFunction> NewFunctionHelper( |
| + Handle<Map> function_map, |
| + Handle<SharedFunctionInfo> shared, |
| + Handle<Object> prototype, |
| + PretenureFlag pretenure = TENURED); |
| // Create a new map cache. |
| Handle<MapCache> NewMapCache(int at_least_space_for); |