This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| frame #48830: 0x000000010024eca0 game`v8::internal::(anonymous namespace)::InstantiateFunction(isolate=0x000000010200aa00, data=<unavailable>, name=<unavailable>) + 512 at api-natives.cc:268 | |
| frame #48831: 0x000000010024f3be game`v8::internal::(anonymous namespace)::InstantiateObject(isolate=0x000000010200aa00, data=Handle<v8::internal::ObjectTemplateInfo> @ r15) + 222 at api-natives.cc:219 | |
| frame #48832: 0x000000010024eca0 game`v8::internal::(anonymous namespace)::InstantiateFunction(isolate=0x000000010200aa00, data=<unavailable>, name=<unavailable>) + 512 at api-natives.cc:268 | |
| frame #48833: 0x000000010024f3be game`v8::internal::(anonymous namespace)::InstantiateObject(isolate=0x000000010200aa00, data=Handle<v8::internal::ObjectTemplateInfo> @ r15) + 222 at api-natives.cc:219 | |
| frame #48834: 0x000000010024eca0 game`v8::internal::(anonymous namespace)::InstantiateFunction(isolate=0x000000010200aa00, data=<unavailable>, name=<unavailable>) + 512 at api-natives.cc:268 | |
| frame #48835: 0x00000001002 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // if this is called repeatedly | |
| javascript_engine.wrap_class<World>(); | |
| javascript_engine.wrap_class<World>(); | |
| javascript_engine.wrap_class<World>(); | |
| // wrap class is just this: | |
| return V8ClassWrapper<T>::get_instance(this->isolate); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FOO | |
| <unknown>:0: Uncaught ReferenceError: bar is not defined | |
| # | |
| # Fatal error in v8::ToLocalChecked | |
| # Empty MaybeLocal. | |
| # | |
| Illegal instruction: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JavascriptEngine::JavascriptEngine() | |
| { | |
| printf("platform %p\n", platform.get()); | |
| assert(initialized); | |
| // Create a new Isolate and make it the current one. | |
| v8::Isolate::CreateParams create_params; | |
| create_params.array_buffer_allocator = (v8::ArrayBuffer::Allocator *) &JavascriptEngine::allocator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename ... CONSTRUCTOR_PARAMETER_TYPES> | |
| static void v8_constructor(const v8::FunctionCallbackInfo<v8::Value>& args) { | |
| T * new_cpp_object = call_cpp_constructor<CONSTRUCTOR_PARAMETER_TYPES...>(args, std::index_sequence_for<CONSTRUCTOR_PARAMETER_TYPES...>()); | |
| // other stuff in here removed | |
| } | |
| template <typename ...Fs, size_t...ns, class WHY> | |
| static T * call_cpp_constructor(const WHY & args, std::index_sequence<ns...>){ | |
| return new T(CastToNative<Fs>()(args[ns])...); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename T> | |
| struct CastToNative {}; | |
| template<> | |
| struct CastToNative<int> { | |
| int operator()(Local<Value> value){return value->ToInteger()->Value();} | |
| }; | |
| template<> | |
| struct CastToNative<char *> { | |
| char * operator()(Local<Value> value){return *v8::String::Utf8Value(value);} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename METHOD_TYPE> | |
| struct RunMethod {}; | |
| template<typename RETURN_TYPE, typename CLASS_TYPE, typename ... PARAMETERS> | |
| struct RunMethod<RETURN_TYPE(CLASS_TYPE::*)(PARAMETERS...)>{ | |
| typedef RETURN_TYPE(CLASS_TYPE::*METHOD_TYPE)(PARAMETERS...); | |
| CLASS_TYPE & object; | |
| METHOD_TYPE method; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T> | |
| class Singleton | |
| { | |
| public: | |
| static T* Instance() { | |
| if(!m_pInstance) m_pInstance = new T; | |
| assert(m_pInstance != NULL); | |
| return m_pInstance; | |
| } | |
| protected: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 05 | |
| template <class T> | |
| 06 | |
| class Singleton | |
| 07 | |
| { | |
| 08 | |
| public: | |
| 09 | |
| static T* Instance() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename METHOD_TYPE> | |
| struct RunMethod {}; | |
| template<typename RETURN_TYPE, typename CLASS_TYPE, typename ... PARAMETERS> | |
| struct RunMethod<RETURN_TYPE(CLASS_TYPE::*)(PARAMETERS...)>{ | |
| typedef RETURN_TYPE(CLASS_TYPE::*METHOD_TYPE)(PARAMETERS...); | |
| CLASS_TYPE object; | |
| METHOD_TYPE method; | |
| RunMethod(CLASS_TYPE object, METHOD_TYPE method) : object(object), method(method) {} |