Bug 610480: fix some MSVC warnings, r=jwalden
authorDavid Mandelin <dmandelin@mozilla.com>
Wed, 10 Nov 2010 16:46:33 -0800
changeset 57776 9af757c2776a5dc11a70170c37c102775cf6d842
parent 57775 f52f5d7feb298aa1edf851cb56c97f8ea5745de7
child 57777 d6b327f772cab8252741d7e06852f9e738a7f2c0
push id17032
push userrsayre@mozilla.com
push dateWed, 17 Nov 2010 21:55:39 +0000
treeherdermozilla-central@78a42f77bb90 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs610480
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 610480: fix some MSVC warnings, r=jwalden
js/src/jsapi.h
js/src/jsobj.cpp
js/src/methodjit/FrameState.cpp
js/src/methodjit/FrameState.h
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -355,16 +355,18 @@ JSID_IS_INT(jsid id)
 
 static JS_ALWAYS_INLINE int32
 JSID_TO_INT(jsid id)
 {
     JS_ASSERT(JSID_IS_INT(id));
     return ((int32)JSID_BITS(id)) >> 1;
 }
 
+// Note: when changing these values, verify that their use in
+// js_CheckForStringIndex is still valid.
 #define JSID_INT_MIN  (-(1 << 30))
 #define JSID_INT_MAX  ((1 << 30) - 1)
 
 static JS_ALWAYS_INLINE JSBool
 INT_FITS_IN_JSID(int32 i)
 {
     return ((jsuint)(i) - (jsuint)JSID_INT_MIN <=
             (jsuint)(JSID_INT_MAX - JSID_INT_MIN));
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1193,17 +1193,17 @@ EvalKernel(JSContext *cx, uintN argc, Va
      * Try the JSON parser first because it's much faster.  If the eval string
      * isn't JSON, JSON parsing will probably fail quickly, so little time
      * will be lost.
      */
     if (length > 2 && chars[0] == '(' && chars[length - 1] == ')') {
         JSONParser *jp = js_BeginJSONParse(cx, vp, /* suppressErrors = */true);
         if (jp != NULL) {
             /* Run JSON-parser on string inside ( and ). */
-            JSBool ok = js_ConsumeJSONText(cx, jp, chars + 1, length - 2);
+            bool ok = js_ConsumeJSONText(cx, jp, chars + 1, length - 2);
             ok &= js_FinishJSONParse(cx, jp, NullValue());
             if (ok)
                 return true;
         }
     }
 
     /*
      * Direct calls to eval are supposed to see the caller's |this|. If we
@@ -4205,17 +4205,17 @@ js_CheckForStringIndex(jsid id)
      */
     if (cp != end || (negative && index == 0))
         return id;
 
     if (negative) {
         if (oldIndex < -(JSID_INT_MIN / 10) ||
             (oldIndex == -(JSID_INT_MIN / 10) && c <= (-JSID_INT_MIN % 10)))
         {
-            id = INT_TO_JSID(jsint(-index));
+            id = INT_TO_JSID(-jsint(index));
         }
     } else {
         if (oldIndex < JSID_INT_MAX / 10 ||
             (oldIndex == JSID_INT_MAX / 10 && c <= (JSID_INT_MAX % 10)))
         {
             id = INT_TO_JSID(jsint(index));
         }
     }
--- a/js/src/methodjit/FrameState.cpp
+++ b/js/src/methodjit/FrameState.cpp
@@ -44,17 +44,17 @@ using namespace js;
 using namespace js::mjit;
 
 /* Because of Value alignment */
 JS_STATIC_ASSERT(sizeof(FrameEntry) % 8 == 0);
 
 FrameState::FrameState(JSContext *cx, JSScript *script, Assembler &masm)
   : cx(cx), script(script), masm(masm), entries(NULL),
 #if defined JS_NUNBOX32
-    reifier(cx, *this),
+    reifier(cx, *thisFromCtor()),
 #endif
     inTryBlock(false)
 {
 }
 
 FrameState::~FrameState()
 {
     cx->free(entries);
--- a/js/src/methodjit/FrameState.h
+++ b/js/src/methodjit/FrameState.h
@@ -231,16 +231,17 @@ class FrameState
 
         /* Hack - simplifies register allocation for pairs. */
         FrameEntry *save_;
         
         /* Part of the FrameEntry that owns the FE. */
         RematInfo::RematType type_;
     };
 
+    FrameState *thisFromCtor() { return this; }
   public:
     FrameState(JSContext *cx, JSScript *script, Assembler &masm);
     ~FrameState();
     bool init(uint32 nargs);
 
     /*
      * Pushes a synced slot.
      */