Backout a2843362ce9b (
Bug 786126) - Are we fast yet regression.
--- a/js/src/ion/TypeOracle.cpp
+++ b/js/src/ion/TypeOracle.cpp
@@ -368,26 +368,16 @@ TypeInferenceOracle::elementReadIsPacked
void
TypeInferenceOracle::elementReadGeneric(JSScript *script, jsbytecode *pc, bool *cacheable, bool *monitorResult)
{
MIRType obj = getMIRType(script->analysis()->poppedTypes(pc, 1));
MIRType id = getMIRType(script->analysis()->poppedTypes(pc, 0));
*cacheable = (obj == MIRType_Object &&
(id == MIRType_Value || id == MIRType_Int32 || id == MIRType_String));
-
- // Turn off cacheing if the element is int32 and we've seen non-native objects as the target
- // of this getelem.
- if (*cacheable) {
- if (id == MIRType_Int32) {
- if (script->analysis()->getCode(pc).nonNativeGetElement)
- *cacheable = false;
- }
- }
-
if (*cacheable)
*monitorResult = (id == MIRType_String || script->analysis()->getCode(pc).getStringElement);
else
*monitorResult = true;
}
bool
TypeInferenceOracle::elementWriteIsDenseArray(JSScript *script, jsbytecode *pc)
--- a/js/src/jsanalyze.h
+++ b/js/src/jsanalyze.h
@@ -106,21 +106,20 @@ class Bytecode
/* Call whose result should be monitored. */
bool monitoredTypesReturn : 1;
/*
* Dynamically observed state about the execution of this opcode. These are
* hints about the script for use during compilation.
*/
- bool arrayWriteHole: 1; /* SETELEM which has written to an array hole. */
- bool getStringElement:1; /* GETELEM which has accessed string properties. */
- bool nonNativeGetElement:1; /* GETELEM on a non-native object. */
- bool accessGetter: 1; /* Property read on a shape with a getter hook. */
- bool notIdempotent: 1; /* Don't use an idempotent cache for this property read. */
+ bool arrayWriteHole: 1; /* SETELEM which has written to an array hole. */
+ bool getStringElement:1; /* GETELEM which has accessed string properties. */
+ bool accessGetter: 1; /* Property read on a shape with a getter hook. */
+ bool notIdempotent: 1; /* Don't use an idempotent cache for this property read. */
/* Stack depth before this opcode. */
uint32_t stackDepth;
private:
union {
/* If this is a JOF_TYPESET opcode, index into the observed types for the op. */
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -681,29 +681,16 @@ GetObjectElementOperation(JSContext *cx,
if (op == JSOP_CALLELEM && JS_UNLIKELY(obj->isXML())) {
jsid id;
if (!FetchElementId(cx, obj, rref, &id, res))
return false;
return js_GetXMLMethod(cx, obj, id, res);
}
#endif
- bool updateAnalysis = false;
- RootedScript script(cx, NULL);
- jsbytecode *pc = NULL;
- if (!cx->fp()->beginsIonActivation()) {
- // Don't call GetPcScript from inside Ion since it's expensive.
- types::TypeScript::GetPcScript(cx, &script, &pc);
- if (script->hasAnalysis())
- updateAnalysis = true;
- }
-
- if (updateAnalysis && !obj->isNative())
- script->analysis()->getCode(pc).nonNativeGetElement = true;
-
uint32_t index;
if (IsDefinitelyIndex(rref, &index)) {
do {
if (obj->isDenseArray()) {
if (index < obj->getDenseArrayInitializedLength()) {
res.set(obj->getDenseArrayElement(index));
if (!res.isMagic())
break;
@@ -711,18 +698,26 @@ GetObjectElementOperation(JSContext *cx,
} else if (obj->isArguments()) {
if (obj->asArguments().maybeGetElement(index, res))
break;
}
if (!JSObject::getElement(cx, obj, obj, index, res))
return false;
} while(0);
} else {
- if (updateAnalysis)
- script->analysis()->getCode(pc).getStringElement = true;
+ if (!cx->fp()->beginsIonActivation()) {
+ // Don't update getStringElement if called from Ion code, since
+ // ion::GetPcScript is expensive.
+ RootedScript script(cx);
+ jsbytecode *pc;
+ types::TypeScript::GetPcScript(cx, &script, &pc);
+
+ if (script->hasAnalysis())
+ script->analysis()->getCode(pc).getStringElement = true;
+ }
SpecialId special;
res.set(rref);
if (ValueIsSpecial(obj, res, &special, cx)) {
if (!JSObject::getSpecial(cx, obj, obj, special, res))
return false;
} else {
JSAtom *name = ToAtom(cx, res);