Bug 799818 part 1 - Ensure return type before optimizing getelem for strings. r=jandem

This commit is contained in:
Nicolas B. Pierron 2012-10-19 14:30:37 -07:00
Родитель 1847a73fea
Коммит 55ea96ff64
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -5054,6 +5054,9 @@ IonBuilder::jsop_getelem_string()
MStringLength *length = MStringLength::New(str);
current->add(length);
// This will cause an invalidation of this script once the 'undefined' type
// is monitored by the interpreter.
JS_ASSERT(oracle->propertyRead(script_, pc)->getKnownTypeTag() == JSVAL_TYPE_STRING);
id = addBoundsCheck(id, length);
MCharCodeAt *charCode = MCharCodeAt::New(str, id);

Просмотреть файл

@ -357,8 +357,11 @@ TypeInferenceOracle::elementReadIsString(JSScript *script, jsbytecode *pc)
if (id->getKnownTypeTag() != JSVAL_TYPE_INT32)
return false;
types::TypeSet *pushed = script->analysis()->pushedTypes(pc, 0);
if (!pushed->hasType(types::Type::StringType()))
// This function is used for jsop_getelem_string which should return
// undefined if this is out-side the string bounds. Currently we just
// fallback to a CallGetElement.
StackTypeSet *pushed = script->analysis()->pushedTypes(pc, 0);
if (pushed->getKnownTypeTag() != JSVAL_TYPE_STRING)
return false;
return true;