[INFER] Fix merge issues.
authorBrian Hackett <bhackett1024@gmail.com>
Fri, 15 Jul 2011 20:38:18 -0700
changeset 76044 a37127f33d2290c78ed3973868a66101c81d98a6
parent 76043 6b9bd44373e70c0841070a1eb6607d7426224093
child 76045 77b0c25be7fbd3cb871f627cfccc3e8fb1e16b9a
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone8.0a1
[INFER] Fix merge issues.
js/src/jsregexp.cpp
js/src/jsstr.cpp
js/src/methodjit/Compiler.cpp
--- a/js/src/jsregexp.cpp
+++ b/js/src/jsregexp.cpp
@@ -860,22 +860,17 @@ js_InitRegExpClass(JSContext *cx, JSObje
         !JS_AliasProperty(cx, ctor, "multiline",    "$*") ||
         !JS_AliasProperty(cx, ctor, "lastMatch",    "$&") ||
         !JS_AliasProperty(cx, ctor, "lastParen",    "$+") ||
         !JS_AliasProperty(cx, ctor, "leftContext",  "$`") ||
         !JS_AliasProperty(cx, ctor, "rightContext", "$'")) {
         return NULL;
     }
 
-    /*
-     * Capture properties added to each RegExp object. These are normal data
-     * properties with fixed type (modulo sets from script, which barriers
-     * and analysis will capture), so avoid the need to update the types each
-     * time a RegExp object is initialized.
-     */
+    /* Capture normal data properties pregenerated for RegExp objects. */
     TypeObject *type = proto->getNewType(cx);
     if (!type)
         return NULL;
     AddTypeProperty(cx, type, "source", Type::StringType());
     AddTypeProperty(cx, type, "global", Type::BooleanType());
     AddTypeProperty(cx, type, "ignoreCase", Type::BooleanType());
     AddTypeProperty(cx, type, "multiline", Type::BooleanType());
     AddTypeProperty(cx, type, "sticky", Type::BooleanType());
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -3197,16 +3197,22 @@ js_InitStringClass(JSContext *cx, JSObje
         return NULL;
 
     if (!DefinePropertiesAndBrand(cx, proto, NULL, string_methods) ||
         !DefinePropertiesAndBrand(cx, ctor, NULL, string_static_methods))
     {
         return NULL;
     }
 
+    /* Capture normal data properties pregenerated for String objects. */
+    TypeObject *type = proto->getNewType(cx);
+    if (!type)
+        return NULL;
+    AddTypeProperty(cx, type, "length", Type::Int32Type());
+
     if (!DefineConstructorAndPrototype(cx, global, JSProto_String, ctor, proto))
         return NULL;
 
     /*
      * Define escape/unescape, the URI encode/decode functions, and maybe
      * uneval on the global object.
      */
     if (!JS_DefineFunctions(cx, global, string_functions))
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -1620,16 +1620,22 @@ mjit::Compiler::generateMethod()
             /*
              * For calls of the form 'f.apply(x, arguments)' we can avoid
              * creating an args object by having ic::SplatApplyArgs pull
              * directly from the stack. To do this, we speculate here that
              * 'apply' actually refers to js_fun_apply. If this is not true,
              * the slow path in JSOP_FUNAPPLY will create the args object.
              */
             if (canUseApplyTricks()) {
+                /*
+                 * Check for interrupts at the JSOP_ARGUMENTS when using
+                 * apply tricks, see inlineCallHelper().
+                 */
+                interruptCheckHelper();
+
                 applyTricks = LazyArgsObj;
                 pushSyncedEntry(0);
             } else if (cx->typeInferenceEnabled() && !script->strictModeCode &&
                        !script->fun->getType(cx)->hasAnyFlags(types::OBJECT_FLAG_CREATED_ARGUMENTS)) {
                 frame.push(MagicValue(JS_LAZY_ARGUMENTS));
             } else {
                 jsop_arguments(REJOIN_FALLTHROUGH);
                 pushSyncedEntry(0);
@@ -3352,24 +3358,29 @@ mjit::Compiler::canUseApplyTricks()
            !analysis->jumpTarget(nextpc) &&
            !debugMode() && !a->parent;
 }
 
 /* See MonoIC.cpp, CallCompiler for more information on call ICs. */
 bool
 mjit::Compiler::inlineCallHelper(uint32 callImmArgc, bool callingNew, FrameSize &callFrameSize)
 {
-    /* Check for interrupts on function call */
-    interruptCheckHelper();
-
     int32 speculatedArgc;
     if (applyTricks == LazyArgsObj) {
         frame.pop();
         speculatedArgc = 1;
     } else {
+        /*
+         * Check for interrupts on function call. We don't do this for lazy
+         * arguments objects as the interrupt may kick this frame into the
+         * interpreter, which doesn't know about the apply tricks. Instead, we
+         * do the interrupt check at the start of the JSOP_ARGUMENTS.
+         */
+        interruptCheckHelper();
+
         speculatedArgc = callImmArgc;
     }
 
     FrameEntry *origCallee = frame.peek(-(speculatedArgc + 2));
     FrameEntry *origThis = frame.peek(-(speculatedArgc + 1));
 
     /*
      * 'this' does not need to be synced for constructing. :FIXME: is it
@@ -4159,17 +4170,17 @@ mjit::Compiler::jsop_getprop(JSAtom *ato
         JS_ASSERT(top->isType(JSVAL_TYPE_OBJECT) &&
                   atom == cx->runtime->atomState.classPrototypeAtom);
         rejoin = REJOIN_THIS_PROTOTYPE;
     }
 
     /* Handle length accesses on known strings without using a PIC. */
     if (atom == cx->runtime->atomState.lengthAtom &&
         top->isType(JSVAL_TYPE_STRING) &&
-        !hasTypeBarriers(PC)) {
+        (!cx->typeInferenceEnabled() || knownPushedType(0) == JSVAL_TYPE_INT32)) {
         if (top->isConstant()) {
             JSString *str = top->getValue().toString();
             Value v;
             v.setNumber(uint32(str->length()));
             frame.pop();
             frame.push(v);
         } else {
             RegisterID str = frame.ownRegForData(top);