Fast-path for string constructors only works for new/call with a single argument (491989, r=dmandelin).

This commit is contained in:
Andreas Gal 2009-05-11 14:03:29 -07:00
parent 5f2681ef36
commit 89e9d61d35
2 changed files with 9 additions and 1 deletions

View File

@ -7696,7 +7696,7 @@ TraceRecorder::functionCall(uintN argc, JSOp mode)
jsval* argv = &tval + 1; jsval* argv = &tval + 1;
if (native == js_Array) if (native == js_Array)
return newArray(JSVAL_TO_OBJECT(fval), argc, argv, &fval); return newArray(JSVAL_TO_OBJECT(fval), argc, argv, &fval);
if (native == js_String && argc >= 1) { if (native == js_String && argc == 1) {
if (mode == JSOP_NEW) if (mode == JSOP_NEW)
return newString(JSVAL_TO_OBJECT(fval), 1, argv, &fval); return newString(JSVAL_TO_OBJECT(fval), 1, argv, &fval);
if (!JSVAL_IS_PRIMITIVE(argv[0])) { if (!JSVAL_IS_PRIMITIVE(argv[0])) {

View File

@ -5187,6 +5187,14 @@ testShiftRightArithmetic.expected =
"-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1"; "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1";
test(testShiftRightArithmetic); test(testShiftRightArithmetic);
function testStringConstructorWithExtraArg() {
for (let i = 0; i < 5; ++i)
new String(new String(), 2);
return "ok";
}
testStringConstructorWithExtraArg.expected = "ok";
test(testStringConstructorWithExtraArg);
/***************************************************************************** /*****************************************************************************
* * * *
* _____ _ _ _____ ______ _____ _______ * * _____ _ _ _____ ______ _____ _______ *