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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // TODO(aandrey): Maybe these should take table, index and kind arguments. | 469 // TODO(aandrey): Maybe these should take table, index and kind arguments. |
470 Handle<JSMapIterator> NewJSMapIterator(); | 470 Handle<JSMapIterator> NewJSMapIterator(); |
471 Handle<JSSetIterator> NewJSSetIterator(); | 471 Handle<JSSetIterator> NewJSSetIterator(); |
472 | 472 |
473 // Creates a new JSIteratorResult object with the arguments {value} and | 473 // Creates a new JSIteratorResult object with the arguments {value} and |
474 // {done}. Implemented according to ES6 section 7.4.7 CreateIterResultObject. | 474 // {done}. Implemented according to ES6 section 7.4.7 CreateIterResultObject. |
475 Handle<JSIteratorResult> NewJSIteratorResult(Handle<Object> value, | 475 Handle<JSIteratorResult> NewJSIteratorResult(Handle<Object> value, |
476 Handle<Object> done); | 476 Handle<Object> done); |
477 | 477 |
478 // Allocates a Harmony proxy. | 478 // Allocates a Harmony proxy. |
479 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); | 479 Handle<JSProxy> NewJSProxy(Handle<JSReceiver> target, |
| 480 Handle<JSReceiver> handler, |
| 481 Handle<Object> prototype); |
480 | 482 |
481 // Allocates a Harmony function proxy. | 483 // Allocates a Harmony function proxy. |
482 Handle<JSProxy> NewJSFunctionProxy(Handle<Object> handler, | 484 Handle<JSProxy> NewJSFunctionProxy(Handle<JSReceiver> target, |
| 485 Handle<JSReceiver> handler, |
483 Handle<JSReceiver> call_trap, | 486 Handle<JSReceiver> call_trap, |
484 Handle<Object> construct_trap, | 487 Handle<Object> construct_trap, |
485 Handle<Object> prototype); | 488 Handle<Object> prototype); |
486 | 489 |
487 // Reinitialize an JSGlobalProxy based on a constructor. The object | 490 // Reinitialize an JSGlobalProxy based on a constructor. The object |
488 // must have the same size as objects allocated using the | 491 // must have the same size as objects allocated using the |
489 // constructor. The object is reinitialized and behaves as an | 492 // constructor. The object is reinitialized and behaves as an |
490 // object that has been freshly allocated using the constructor. | 493 // object that has been freshly allocated using the constructor. |
491 void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global, | 494 void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global, |
492 Handle<JSFunction> constructor); | 495 Handle<JSFunction> constructor); |
493 | 496 |
494 Handle<JSGlobalProxy> NewUninitializedJSGlobalProxy(); | 497 Handle<JSGlobalProxy> NewUninitializedJSGlobalProxy(); |
495 | 498 |
496 // Change the type of the argument into a JS object/function and reinitialize. | |
497 void BecomeJSObject(Handle<JSProxy> object); | |
498 void BecomeJSFunction(Handle<JSProxy> object); | |
499 | |
500 Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code, | 499 Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code, |
501 Handle<Object> prototype, | 500 Handle<Object> prototype, |
502 bool read_only_prototype = false, | 501 bool read_only_prototype = false, |
503 bool is_strict = false); | 502 bool is_strict = false); |
504 Handle<JSFunction> NewFunction(Handle<String> name); | 503 Handle<JSFunction> NewFunction(Handle<String> name); |
505 Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, | 504 Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
506 Handle<Code> code, | 505 Handle<Code> code, |
507 bool is_strict = false); | 506 bool is_strict = false); |
508 | 507 |
509 Handle<JSFunction> NewFunctionFromSharedFunctionInfo( | 508 Handle<JSFunction> NewFunctionFromSharedFunctionInfo( |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 705 |
707 // Creates a function initialized with a shared part. | 706 // Creates a function initialized with a shared part. |
708 Handle<JSFunction> NewFunction(Handle<Map> map, | 707 Handle<JSFunction> NewFunction(Handle<Map> map, |
709 Handle<SharedFunctionInfo> info, | 708 Handle<SharedFunctionInfo> info, |
710 Handle<Context> context, | 709 Handle<Context> context, |
711 PretenureFlag pretenure = TENURED); | 710 PretenureFlag pretenure = TENURED); |
712 | 711 |
713 Handle<JSFunction> NewFunction(Handle<Map> map, | 712 Handle<JSFunction> NewFunction(Handle<Map> map, |
714 Handle<String> name, | 713 Handle<String> name, |
715 MaybeHandle<Code> maybe_code); | 714 MaybeHandle<Code> maybe_code); |
716 | |
717 // Reinitialize a JSProxy into an (empty) JS object of respective type and | |
718 // size, but keeping the original prototype. The receiver must have at least | |
719 // the size of the new object. The object is reinitialized and behaves as an | |
720 // object that has been freshly allocated. | |
721 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | |
722 }; | 715 }; |
723 | 716 |
724 } // namespace internal | 717 } // namespace internal |
725 } // namespace v8 | 718 } // namespace v8 |
726 | 719 |
727 #endif // V8_FACTORY_H_ | 720 #endif // V8_FACTORY_H_ |
OLD | NEW |