Permalink
Browse files

Updates SpiderMonkey to v17.0

  • Loading branch information...
1 parent 7cf74db commit e22143bbff7b28bc9adcff0d41da8fe5e972a0b8 @ricardoquesada ricardoquesada committed Nov 21, 2012
View
@@ -18,6 +18,7 @@ version 2.1-beta4 XX-Nov-2012
. [FIX] Particles: "unscheduleUpdate" is no longer called at dealloc time
. [FIX] PhysicsSprite: Can be scaled up/down. AnchorPoint works OK.
. [3RD] JS Bindings: Updated to v0.4. Chipmunk-JS + cocos2d-html5 is compatible with cocos2d/chipmunk + JSB
+. [3RD] SpiderMonkey: Updated to v17.0
version 2.1-beta3 7-Nov-2012
@@ -253,6 +253,34 @@ struct RootMethods<T *>
static bool poisoned(T *v) { return IsPoisonedPtr(v); }
};
+#if !defined(JSGC_ROOT_ANALYSIS) && !defined(JSGC_USE_EXACT_ROOTING)
+template <typename T>
+struct RootSink {
+ static inline void dispose(const T &) {}
+};
+
+/*
+ * The *alleged* killer whale hack (see JS::Anchor<T> in jsapi.h) duplicated
+ * here because using JS::Anchor causes clang to emit bad instructions.
+ *
+ * In exact-gc builds, Rooted<T> always keeps the T reachable. In non-exact-gc
+ * builds, it does not, but conservative scanning usually picks up the slack.
+ * However in the case where the Rooted pointer is no longer used, but some
+ * subobject or malloc'd memory with the same lifetime may be used,
+ * conservative scanning can fail. JSStableString's chars() method makes it
+ * particularly attractive to use that way, so we use some voodoo to convince
+ * the compiler to keep the string pointer on the stack for the full lifetime
+ * of the Rooted<JSStableString *>.
+ */
+template <>
+struct RootSink<JSStableString *> {
+ static void dispose(JSStableString *ptr) {
+ JSStableString * volatile sink;
+ sink = ptr;
+ }
+};
+#endif
+
template <typename T>
class RootedBase {};
@@ -290,6 +318,8 @@ class Rooted : public RootedBase<T>
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
JS_ASSERT(*stack == this);
*stack = prev;
+#else
+ RootSink<T>::dispose(ptr);
#endif
}
@@ -200,6 +200,7 @@ typedef struct JSTracer JSTracer;
#ifdef __cplusplus
class JSFlatString;
+class JSStableString; // long story
class JSString;
#else
typedef struct JSFlatString JSFlatString;
Binary file not shown.
@@ -253,6 +253,34 @@ struct RootMethods<T *>
static bool poisoned(T *v) { return IsPoisonedPtr(v); }
};
+#if !defined(JSGC_ROOT_ANALYSIS) && !defined(JSGC_USE_EXACT_ROOTING)
+template <typename T>
+struct RootSink {
+ static inline void dispose(const T &) {}
+};
+
+/*
+ * The *alleged* killer whale hack (see JS::Anchor<T> in jsapi.h) duplicated
+ * here because using JS::Anchor causes clang to emit bad instructions.
+ *
+ * In exact-gc builds, Rooted<T> always keeps the T reachable. In non-exact-gc
+ * builds, it does not, but conservative scanning usually picks up the slack.
+ * However in the case where the Rooted pointer is no longer used, but some
+ * subobject or malloc'd memory with the same lifetime may be used,
+ * conservative scanning can fail. JSStableString's chars() method makes it
+ * particularly attractive to use that way, so we use some voodoo to convince
+ * the compiler to keep the string pointer on the stack for the full lifetime
+ * of the Rooted<JSStableString *>.
+ */
+template <>
+struct RootSink<JSStableString *> {
+ static void dispose(JSStableString *ptr) {
+ JSStableString * volatile sink;
+ sink = ptr;
+ }
+};
+#endif
+
template <typename T>
class RootedBase {};
@@ -290,6 +318,8 @@ class Rooted : public RootedBase<T>
#if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
JS_ASSERT(*stack == this);
*stack = prev;
+#else
+ RootSink<T>::dispose(ptr);
#endif
}
@@ -200,6 +200,7 @@ typedef struct JSTracer JSTracer;
#ifdef __cplusplus
class JSFlatString;
+class JSStableString; // long story
class JSString;
#else
typedef struct JSFlatString JSFlatString;
Binary file not shown.
@@ -759,7 +759,7 @@ var GameLayer = cc.LayerGradient.extend({
var sprite = cc.PhysicsSprite.createWithSpriteFrameName("coin01.png");
var radius = 0.95 * sprite.getContentSize().width / 2;
- var body = new cp.BodyStatic();
+ var body = new cp.StaticBody();
body.setPos( pos );
sprite.setBody( body.handle );
@@ -788,7 +788,7 @@ var GameLayer = cc.LayerGradient.extend({
createFinish:function( pos ) {
var sprite = cc.PhysicsSprite.createWithSpriteFrameName("farmers-market.png");
var cs = sprite.getContentSize();
- var body = new cp.BodyStatic();
+ var body = new cp.StaticBody();
sprite.setBody( body.handle );
body.setPos( pos );

0 comments on commit e22143b

Please sign in to comment.