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 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 MaybeHandle<Object> NewEvalError(const char* message, | 552 MaybeHandle<Object> NewEvalError(const char* message, |
553 Vector<Handle<Object> > args); | 553 Vector<Handle<Object> > args); |
554 | 554 |
555 Handle<String> NumberToString(Handle<Object> number, | 555 Handle<String> NumberToString(Handle<Object> number, |
556 bool check_number_string_cache = true); | 556 bool check_number_string_cache = true); |
557 | 557 |
558 Handle<String> Uint32ToString(uint32_t value) { | 558 Handle<String> Uint32ToString(uint32_t value) { |
559 return NumberToString(NewNumberFromUint(value)); | 559 return NumberToString(NewNumberFromUint(value)); |
560 } | 560 } |
561 | 561 |
562 enum ApiInstanceType { | |
563 JavaScriptObjectType, | |
564 GlobalObjectType, | |
565 GlobalProxyType | |
566 }; | |
567 | |
568 Handle<JSFunction> CreateApiFunction( | |
569 Handle<FunctionTemplateInfo> data, | |
570 Handle<Object> prototype, | |
571 ApiInstanceType type = JavaScriptObjectType); | |
572 | |
573 Handle<JSFunction> InstallMembers(Handle<JSFunction> function); | 562 Handle<JSFunction> InstallMembers(Handle<JSFunction> function); |
574 | 563 |
575 // Installs interceptors on the instance. 'desc' is a function template, | |
576 // and instance is an object instance created by the function of this | |
577 // function template. | |
578 MUST_USE_RESULT MaybeHandle<FunctionTemplateInfo> ConfigureInstance( | |
579 Handle<FunctionTemplateInfo> desc, Handle<JSObject> instance); | |
580 | |
581 #define ROOT_ACCESSOR(type, name, camel_name) \ | 564 #define ROOT_ACCESSOR(type, name, camel_name) \ |
582 inline Handle<type> name() { \ | 565 inline Handle<type> name() { \ |
583 return Handle<type>(bit_cast<type**>( \ | 566 return Handle<type>(bit_cast<type**>( \ |
584 &isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \ | 567 &isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \ |
585 } | 568 } |
586 ROOT_LIST(ROOT_ACCESSOR) | 569 ROOT_LIST(ROOT_ACCESSOR) |
587 #undef ROOT_ACCESSOR | 570 #undef ROOT_ACCESSOR |
588 | 571 |
589 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ | 572 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ |
590 inline Handle<Map> name##_map() { \ | 573 inline Handle<Map> name##_map() { \ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 // Reinitialize a JSProxy into an (empty) JS object of respective type and | 707 // Reinitialize a JSProxy into an (empty) JS object of respective type and |
725 // size, but keeping the original prototype. The receiver must have at least | 708 // size, but keeping the original prototype. The receiver must have at least |
726 // the size of the new object. The object is reinitialized and behaves as an | 709 // the size of the new object. The object is reinitialized and behaves as an |
727 // object that has been freshly allocated. | 710 // object that has been freshly allocated. |
728 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 711 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); |
729 }; | 712 }; |
730 | 713 |
731 } } // namespace v8::internal | 714 } } // namespace v8::internal |
732 | 715 |
733 #endif // V8_FACTORY_H_ | 716 #endif // V8_FACTORY_H_ |
OLD | NEW |