Browse Source

Duktape update, JSComponent update, disabling voluntary GC to smooth frames and due to GC issue

Josh Engebretson 10 years ago
parent
commit
ba8118dd07

+ 1 - 0
Source/AtomicJS/Javascript/JSAtomic.cpp

@@ -214,6 +214,7 @@ static void js_atomic_destroy_node(Node* node, duk_context* ctx, bool root = fal
 
 
     node->RemoveAllComponents();
     node->RemoveAllComponents();
     node->UnsubscribeFromAllEvents();
     node->UnsubscribeFromAllEvents();
+    node->Remove();
 
 
 }
 }
 
 

+ 3 - 0
Source/AtomicJS/Javascript/JSComponent.cpp

@@ -314,6 +314,9 @@ void JSComponent::InitInstance(bool hasArgs, int argIdx)
 
 
 void JSComponent::CallScriptMethod(const String& name, bool passValue, float value)
 void JSComponent::CallScriptMethod(const String& name, bool passValue, float value)
 {
 {
+    if (destroyed_ || !node_ || !node_->GetScene())
+        return;
+
     void* heapptr = JSGetHeapPtr();
     void* heapptr = JSGetHeapPtr();
 
 
     if (!heapptr)
     if (!heapptr)

+ 78 - 59
Source/ThirdParty/Duktape/duk_config.h

@@ -167,6 +167,11 @@ static __inline__ unsigned long long duk_rdtsc(void) {
 #define DUK_F_M68K
 #define DUK_F_M68K
 #endif
 #endif
 
 
+/* PowerPC */
+#if defined(__powerpc) || defined(__powerpc__) || defined(__PPC__)
+#define DUK_F_PPC
+#endif
+
 /* Linux */
 /* Linux */
 #if defined(__linux) || defined(__linux__) || defined(linux)
 #if defined(__linux) || defined(__linux__) || defined(linux)
 #define DUK_F_LINUX
 #define DUK_F_LINUX
@@ -451,8 +456,18 @@ static __inline__ unsigned long long duk_rdtsc(void) {
 #define DUK_USE_DATE_FMT_STRFTIME
 #define DUK_USE_DATE_FMT_STRFTIME
 #include <limits.h>
 #include <limits.h>
 #include <time.h>
 #include <time.h>
+#elif defined(DUK_F_PPC)
+#define DUK_USE_DATE_NOW_GETTIMEOFDAY
+#define DUK_USE_DATE_TZO_GMTIME_R
+#define DUK_USE_DATE_PRS_STRPTIME
+#define DUK_USE_DATE_FMT_STRFTIME
+#include <limits.h>
+#include <time.h>
+#ifndef UINTPTR_MAX
+#define UINTPTR_MAX UINT_MAX
+#endif
 #else
 #else
-#error AmigaOS but not M68K, not supported now
+#error AmigaOS but not M68K/PPC, not supported now
 #endif
 #endif
 #elif defined(DUK_F_WINDOWS)
 #elif defined(DUK_F_WINDOWS)
 /* Windows 32-bit and 64-bit are currently the same. */
 /* Windows 32-bit and 64-bit are currently the same. */
@@ -1391,9 +1406,9 @@ typedef struct duk_hthread duk_context;
 #define DUK_F_BYTEORDER 3
 #define DUK_F_BYTEORDER 3
 #endif
 #endif
 
 
-/* AmigaOS on M68k */
+/* AmigaOS on M68K or PPC */
 #if !defined(DUK_F_BYTEORDER) && defined(DUK_F_AMIGAOS)
 #if !defined(DUK_F_BYTEORDER) && defined(DUK_F_AMIGAOS)
-#if defined(DUK_F_M68K)
+#if defined(DUK_F_M68K) || defined(DUK_F_PPC)
 #define DUK_F_BYTEORDER 3
 #define DUK_F_BYTEORDER 3
 #endif
 #endif
 #endif
 #endif
@@ -1494,6 +1509,11 @@ typedef struct duk_hthread duk_context;
 #define DUK_USE_PACKED_TVAL_POSSIBLE
 #define DUK_USE_PACKED_TVAL_POSSIBLE
 #endif
 #endif
 
 
+/* PPC: packed always possible */
+#if !defined(DUK_USE_PACKED_TVAL_POSSIBLE) && defined(DUK_F_PPC)
+#define DUK_USE_PACKED_TVAL_POSSIBLE
+#endif
+
 /* With Emscripten, force unpacked duk_tval just to be safe, as it seems to
 /* With Emscripten, force unpacked duk_tval just to be safe, as it seems to
  * break at least on Firefox (probably IEEE double arithmetic is not 100%
  * break at least on Firefox (probably IEEE double arithmetic is not 100%
  * supported, especially for NaNs).
  * supported, especially for NaNs).
@@ -2146,6 +2166,8 @@ typedef FILE duk_file;
 #define DUK_USE_ARCH_STRING "mips64"
 #define DUK_USE_ARCH_STRING "mips64"
 #elif defined(DUK_F_SUPERH)
 #elif defined(DUK_F_SUPERH)
 #define DUK_USE_ARCH_STRING "sh"
 #define DUK_USE_ARCH_STRING "sh"
+#elif defined(DUK_F_PPC)
+#define DUK_USE_ARCH_STRING "ppc"
 #elif defined(DUK_F_M68K)
 #elif defined(DUK_F_M68K)
 #define DUK_USE_ARCH_STRING "m68k"
 #define DUK_USE_ARCH_STRING "m68k"
 #elif defined(DUK_F_FLASHPLAYER)
 #elif defined(DUK_F_FLASHPLAYER)
@@ -2695,20 +2717,6 @@ typedef FILE duk_file;
 #undef DUK_USE_TAILCALL
 #undef DUK_USE_TAILCALL
 #endif
 #endif
 
 
-/*
- *  Deep vs. shallow stack.
- *
- *  Some embedded platforms have very shallow stack (e.g. 64kB); default to
- *  a shallow stack on unknown platforms or known embedded platforms.
- */
-
-#if defined(DUK_F_LINUX) || defined(DUK_F_BSD) || defined(DUK_F_WINDOWS) || \
-    defined(DUK_F_APPLE) || defined(DUK_OPT_DEEP_C_STACK)
-#define DUK_USE_DEEP_C_STACK
-#else
-#undef DUK_USE_DEEP_C_STACK
-#endif
-
 /*
 /*
  *  Ecmascript compiler
  *  Ecmascript compiler
  */
  */
@@ -2979,6 +2987,59 @@ typedef FILE duk_file;
 #undef DUK_USE_GCC_PRAGMAS
 #undef DUK_USE_GCC_PRAGMAS
 #endif
 #endif
 
 
+/*
+ *  User declarations
+ */
+
+#if defined(DUK_OPT_DECLARE)
+#define DUK_USE_USER_DECLARE() DUK_OPT_DECLARE
+#else
+#define DUK_USE_USER_DECLARE() /* no user declarations */
+#endif
+
+/*
+ *  Autogenerated defaults
+ */
+
+#define DUK_USE_COMPILER_RECLIMIT 2500
+#undef DUK_USE_DATE_FORMAT_STRING
+#undef DUK_USE_DATE_GET_LOCAL_TZOFFSET
+#undef DUK_USE_DATE_GET_NOW
+#undef DUK_USE_DATE_PARSE_STRING
+#undef DUK_USE_DATE_PRS_GETDATE
+#undef DUK_USE_INTEGER_ME
+#define DUK_USE_JSON_DECNUMBER_FASTPATH
+#define DUK_USE_JSON_DECSTRING_FASTPATH
+#define DUK_USE_JSON_DEC_RECLIMIT 1000
+#define DUK_USE_JSON_EATWHITE_FASTPATH
+#define DUK_USE_JSON_ENC_RECLIMIT 1000
+#define DUK_USE_JSON_QUOTESTRING_FASTPATH
+#undef DUK_USE_JSON_STRINGIFY_FASTPATH
+#define DUK_USE_MARK_AND_SWEEP_RECLIMIT 256
+#define DUK_USE_NATIVE_CALL_RECLIMIT 1000
+#define DUK_USE_REGEXP_COMPILER_RECLIMIT 10000
+#define DUK_USE_REGEXP_EXECUTOR_RECLIMIT 10000
+
+/*
+ *  Alternative customization header
+ *
+ *  If you want to modify the final DUK_USE_xxx flags directly (without
+ *  using the available DUK_OPT_xxx flags), define DUK_OPT_HAVE_CUSTOM_H
+ *  and tweak the final flags there.
+ */
+
+#if defined(DUK_OPT_HAVE_CUSTOM_H)
+#include "duk_custom.h"
+#endif
+
+/*
+ *  You may add overriding #define/#undef directives below for
+ *  customization.  You of course cannot un-#include or un-typedef
+ *  anything; these require direct changes above.
+ */
+
+/* __OVERRIDE_DEFINES__ */
+
 /*
 /*
  *  Date provider selection
  *  Date provider selection
  *
  *
@@ -3040,48 +3101,6 @@ DUK_INTERNAL_DECL duk_bool_t duk_bi_date_format_parts_strftime(duk_context *ctx,
 
 
 #endif  /* DUK_COMPILING_DUKTAPE */
 #endif  /* DUK_COMPILING_DUKTAPE */
 
 
-/*
- *  User declarations
- */
-
-#if defined(DUK_OPT_DECLARE)
-#define DUK_USE_USER_DECLARE() DUK_OPT_DECLARE
-#else
-#define DUK_USE_USER_DECLARE() /* no user declarations */
-#endif
-
-/*
- *  Autogenerated defaults
- */
-
-#undef DUK_USE_DATE_PRS_GETDATE
-#undef DUK_USE_INTEGER_ME
-#define DUK_USE_JSON_DECNUMBER_FASTPATH
-#define DUK_USE_JSON_DECSTRING_FASTPATH
-#define DUK_USE_JSON_EATWHITE_FASTPATH
-#define DUK_USE_JSON_QUOTESTRING_FASTPATH
-// #undef DUK_USE_JSON_STRINGIFY_FASTPATH
-
-/*
- *  Alternative customization header
- *
- *  If you want to modify the final DUK_USE_xxx flags directly (without
- *  using the available DUK_OPT_xxx flags), define DUK_OPT_HAVE_CUSTOM_H
- *  and tweak the final flags there.
- */
-
-#if defined(DUK_OPT_HAVE_CUSTOM_H)
-#include "duk_custom.h"
-#endif
-
-/*
- *  You may add overriding #define/#undef directives below for
- *  customization.  You of course cannot un-#include or un-typedef
- *  anything; these require direct changes above.
- */
-
-/* __OVERRIDE_DEFINES__ */
-
 /*
 /*
  *  Sanity check for the final effective internal defines.  Also
  *  Sanity check for the final effective internal defines.  Also
  *  double checks user tweaks made by an optional duk_custom.h header.
  *  double checks user tweaks made by an optional duk_custom.h header.

File diff suppressed because it is too large
+ 246 - 175
Source/ThirdParty/Duktape/duktape.c


+ 26 - 24
Source/ThirdParty/Duktape/duktape.h

@@ -5,7 +5,7 @@
  *  include guard.  Other parts of the header are Duktape
  *  include guard.  Other parts of the header are Duktape
  *  internal and related to platform/compiler/feature detection.
  *  internal and related to platform/compiler/feature detection.
  *
  *
- *  Git commit 281739096bf0c73d5c494069b3146e80dcbbde58 (v1.2.0-289-g2817390).
+ *  Git commit de0a9aa6126e92054d0f36393371e26562f8b9ec (v1.2.0-373-gde0a9aa-dirty).
  *
  *
  *  See Duktape AUTHORS.rst and LICENSE.txt for copyright and
  *  See Duktape AUTHORS.rst and LICENSE.txt for copyright and
  *  licensing information.
  *  licensing information.
@@ -16,21 +16,21 @@
  *  ===============
  *  ===============
  *  Duktape license
  *  Duktape license
  *  ===============
  *  ===============
- *
+ *  
  *  (http://opensource.org/licenses/MIT)
  *  (http://opensource.org/licenses/MIT)
- *
+ *  
  *  Copyright (c) 2013-2015 by Duktape authors (see AUTHORS.rst)
  *  Copyright (c) 2013-2015 by Duktape authors (see AUTHORS.rst)
- *
+ *  
  *  Permission is hereby granted, free of charge, to any person obtaining a copy
  *  Permission is hereby granted, free of charge, to any person obtaining a copy
  *  of this software and associated documentation files (the "Software"), to deal
  *  of this software and associated documentation files (the "Software"), to deal
  *  in the Software without restriction, including without limitation the rights
  *  in the Software without restriction, including without limitation the rights
  *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  *  copies of the Software, and to permit persons to whom the Software is
  *  copies of the Software, and to permit persons to whom the Software is
  *  furnished to do so, subject to the following conditions:
  *  furnished to do so, subject to the following conditions:
- *
+ *  
  *  The above copyright notice and this permission notice shall be included in
  *  The above copyright notice and this permission notice shall be included in
  *  all copies or substantial portions of the Software.
  *  all copies or substantial portions of the Software.
- *
+ *  
  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -45,36 +45,36 @@
  *  ===============
  *  ===============
  *  Duktape authors
  *  Duktape authors
  *  ===============
  *  ===============
- *
+ *  
  *  Copyright
  *  Copyright
  *  =========
  *  =========
- *
+ *  
  *  Duktape copyrights are held by its authors.  Each author has a copyright
  *  Duktape copyrights are held by its authors.  Each author has a copyright
  *  to their contribution, and agrees to irrevocably license the contribution
  *  to their contribution, and agrees to irrevocably license the contribution
  *  under the Duktape ``LICENSE.txt``.
  *  under the Duktape ``LICENSE.txt``.
- *
+ *  
  *  Authors
  *  Authors
  *  =======
  *  =======
- *
+ *  
  *  Please include an e-mail address, a link to your GitHub profile, or something
  *  Please include an e-mail address, a link to your GitHub profile, or something
  *  similar to allow your contribution to be identified accurately.
  *  similar to allow your contribution to be identified accurately.
- *
+ *  
  *  The following people have contributed code and agreed to irrevocably license
  *  The following people have contributed code and agreed to irrevocably license
  *  their contributions under the Duktape ``LICENSE.txt`` (in order of appearance):
  *  their contributions under the Duktape ``LICENSE.txt`` (in order of appearance):
- *
+ *  
  *  * Sami Vaarala <[email protected]>
  *  * Sami Vaarala <[email protected]>
  *  * Niki Dobrev
  *  * Niki Dobrev
  *  * Andreas \u00d6man <[email protected]>
  *  * Andreas \u00d6man <[email protected]>
  *  * L\u00e1szl\u00f3 Lang\u00f3 <[email protected]>
  *  * L\u00e1szl\u00f3 Lang\u00f3 <[email protected]>
  *  * Legimet <[email protected]>
  *  * Legimet <[email protected]>
  *  * Karl Skomski <[email protected]>
  *  * Karl Skomski <[email protected]>
- *
+ *  
  *  Other contributions
  *  Other contributions
  *  ===================
  *  ===================
- *
+ *  
  *  The following people have contributed something other than code (e.g. reported
  *  The following people have contributed something other than code (e.g. reported
  *  bugs, provided ideas, etc; roughly in order of appearance):
  *  bugs, provided ideas, etc; roughly in order of appearance):
- *
+ *  
  *  * Greg Burns
  *  * Greg Burns
  *  * Anthony Rabine
  *  * Anthony Rabine
  *  * Carlos Costa
  *  * Carlos Costa
@@ -103,7 +103,8 @@
  *  * https://github.com/Kelledin
  *  * https://github.com/Kelledin
  *  * https://github.com/sstruchtrup
  *  * https://github.com/sstruchtrup
  *  * Michael Drake (https://github.com/tlsa)
  *  * Michael Drake (https://github.com/tlsa)
- *
+ *  * https://github.com/chris-y
+ *  
  *  If you are accidentally missing from this list, send me an e-mail
  *  If you are accidentally missing from this list, send me an e-mail
  *  (``[email protected]``) and I'll fix the omission.
  *  (``[email protected]``) and I'll fix the omission.
  */
  */
@@ -115,10 +116,10 @@
 
 
 // ATOMIC BEGIN
 // ATOMIC BEGIN
 
 
-// Disabling this 8/8/2015, if having problems with GC (objects being rescued
-// during finalization), reenable and make sure option is also enabled when
-// building Duktape's dist
-// #define DUK_OPT_NO_VOLUNTARY_GC
+// Disabling Voluntary GC as there is a finalization issue
+// and this seems to smooth out framerate
+// https://github.com/svaarala/duktape/issues/108
+#define DUK_OPT_NO_VOLUNTARY_GC
 
 
 // enable JSON string fast path which requires fast int
 // enable JSON string fast path which requires fast int
 // https://github.com/svaarala/duktape/issues/204
 // https://github.com/svaarala/duktape/issues/204
@@ -228,7 +229,7 @@ struct duk_number_list_entry {
  * so that application code can easily log which Duktape snapshot was used.
  * so that application code can easily log which Duktape snapshot was used.
  * Not available in the Ecmascript environment.
  * Not available in the Ecmascript environment.
  */
  */
-#define DUK_GIT_DESCRIBE                  "v1.2.0-289-g2817390"
+#define DUK_GIT_DESCRIBE                  "v1.2.0-373-gde0a9aa-dirty"
 
 
 /* Duktape debug protocol version used by this build. */
 /* Duktape debug protocol version used by this build. */
 #define DUK_DEBUG_PROTOCOL_VERSION        1
 #define DUK_DEBUG_PROTOCOL_VERSION        1
@@ -290,9 +291,9 @@ struct duk_number_list_entry {
 #define DUK_ENUM_NO_PROXY_BEHAVIOR        (1 << 5)    /* enumerate a proxy object itself without invoking proxy behavior */
 #define DUK_ENUM_NO_PROXY_BEHAVIOR        (1 << 5)    /* enumerate a proxy object itself without invoking proxy behavior */
 
 
 /* Compilation flags for duk_compile() and duk_eval() */
 /* Compilation flags for duk_compile() and duk_eval() */
-#define DUK_COMPILE_EVAL                  (1 << 0)    /* compile eval code (instead of program) */
-#define DUK_COMPILE_FUNCTION              (1 << 1)    /* compile function code (instead of program) */
-#define DUK_COMPILE_STRICT                (1 << 2)    /* use strict (outer) context for program, eval, or function */
+#define DUK_COMPILE_EVAL                  (1 << 0)    /* compile eval code (instead of global code) */
+#define DUK_COMPILE_FUNCTION              (1 << 1)    /* compile function code (instead of global code) */
+#define DUK_COMPILE_STRICT                (1 << 2)    /* use strict (outer) context for global, eval, or function code */
 #define DUK_COMPILE_SAFE                  (1 << 3)    /* (internal) catch compilation errors */
 #define DUK_COMPILE_SAFE                  (1 << 3)    /* (internal) catch compilation errors */
 #define DUK_COMPILE_NORESULT              (1 << 4)    /* (internal) omit eval result */
 #define DUK_COMPILE_NORESULT              (1 << 4)    /* (internal) omit eval result */
 #define DUK_COMPILE_NOSOURCE              (1 << 5)    /* (internal) no source string on stack */
 #define DUK_COMPILE_NOSOURCE              (1 << 5)    /* (internal) no source string on stack */
@@ -845,6 +846,7 @@ DUK_EXTERNAL_DECL duk_int_t duk_pcall(duk_context *ctx, duk_idx_t nargs);
 DUK_EXTERNAL_DECL duk_int_t duk_pcall_method(duk_context *ctx, duk_idx_t nargs);
 DUK_EXTERNAL_DECL duk_int_t duk_pcall_method(duk_context *ctx, duk_idx_t nargs);
 DUK_EXTERNAL_DECL duk_int_t duk_pcall_prop(duk_context *ctx, duk_idx_t obj_index, duk_idx_t nargs);
 DUK_EXTERNAL_DECL duk_int_t duk_pcall_prop(duk_context *ctx, duk_idx_t obj_index, duk_idx_t nargs);
 DUK_EXTERNAL_DECL void duk_new(duk_context *ctx, duk_idx_t nargs);
 DUK_EXTERNAL_DECL void duk_new(duk_context *ctx, duk_idx_t nargs);
+DUK_EXTERNAL_DECL duk_int_t duk_pnew(duk_context *ctx, duk_idx_t nargs);
 DUK_EXTERNAL_DECL duk_int_t duk_safe_call(duk_context *ctx, duk_safe_call_function func, duk_idx_t nargs, duk_idx_t nrets);
 DUK_EXTERNAL_DECL duk_int_t duk_safe_call(duk_context *ctx, duk_safe_call_function func, duk_idx_t nargs, duk_idx_t nrets);
 
 
 /*
 /*

Some files were not shown because too many files changed in this diff