Title: [117097] branches/safari-536-branch

Diff

Modified: branches/safari-536-branch/LayoutTests/ChangeLog (117096 => 117097)


--- branches/safari-536-branch/LayoutTests/ChangeLog	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/LayoutTests/ChangeLog	2012-05-15 18:07:24 UTC (rev 117097)
@@ -1,3 +1,19 @@
+2012-05-15  Lucas Forschler  <[email protected]>
+
+    Merge 116361
+
+    2012-05-07  Oliver Hunt  <[email protected]>
+
+            LLInt doesn't check for Ropes when performing a character switch
+            https://bugs.webkit.org/show_bug.cgi?id=85837
+
+            Reviewed by Filip Pizlo.
+
+            Add a few tests to force the use of ropes on switch statements.
+
+            * fast/js/script-tests/switch-behaviour.js:
+            * fast/js/switch-behaviour-expected.txt:
+
 2012-05-04  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Gardening, unskip test after r116097.

Modified: branches/safari-536-branch/LayoutTests/fast/js/script-tests/switch-behaviour.js (117096 => 117097)


--- branches/safari-536-branch/LayoutTests/fast/js/script-tests/switch-behaviour.js	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/LayoutTests/fast/js/script-tests/switch-behaviour.js	2012-05-15 18:07:24 UTC (rev 117097)
@@ -231,6 +231,12 @@
 }
 
 // Character switch
+var emptyString1 = "";
+var emptyString2 = "";
+shouldBe("characterSwitch('A' + emptyString1)", '"A"');
+shouldBe("characterSwitch('A' + emptyString1 + emptyString2)", '"A"');
+shouldBe("characterSwitch(emptyString1 + emptyString2)", '"default"');
+
 shouldBe("characterSwitch('\0')", '"\0"');
 shouldBe("characterSwitch('A')", '"A"');
 shouldBe("characterSwitch('a')", '"a"');

Modified: branches/safari-536-branch/LayoutTests/fast/js/switch-behaviour-expected.txt (117096 => 117097)


--- branches/safari-536-branch/LayoutTests/fast/js/switch-behaviour-expected.txt	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/LayoutTests/fast/js/switch-behaviour-expected.txt	2012-05-15 18:07:24 UTC (rev 117097)
@@ -3,6 +3,9 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS characterSwitch('A' + emptyString1) is "A"
+PASS characterSwitch('A' + emptyString1 + emptyString2) is "A"
+PASS characterSwitch(emptyString1 + emptyString2) is "default"
 PASS characterSwitch('\0') is "\0"
 PASS characterSwitch('A') is "A"
 PASS characterSwitch('a') is "a"

Modified: branches/safari-536-branch/Source/_javascript_Core/ChangeLog (117096 => 117097)


--- branches/safari-536-branch/Source/_javascript_Core/ChangeLog	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/Source/_javascript_Core/ChangeLog	2012-05-15 18:07:24 UTC (rev 117097)
@@ -1,5 +1,25 @@
 2012-05-15  Lucas Forschler  <[email protected]>
 
+    Merge 116361
+
+    2012-05-07  Oliver Hunt  <[email protected]>
+
+            LLInt doesn't check for Ropes when performing a character switch
+            https://bugs.webkit.org/show_bug.cgi?id=85837
+
+            Reviewed by Filip Pizlo.
+
+            Make LLint check if the scrutinee of a char switch is a rope, and if
+            so fall back to a slow case.
+
+            * llint/LLIntSlowPaths.cpp:
+            (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+            (LLInt):
+            * llint/LowLevelInterpreter32_64.asm:
+            * llint/LowLevelInterpreter64.asm:
+
+2012-05-15  Lucas Forschler  <[email protected]>
+
     Merge 116367
 
     2012-05-07  Andy Estes  <[email protected]>

Modified: branches/safari-536-branch/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (117096 => 117097)


--- branches/safari-536-branch/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-05-15 18:07:24 UTC (rev 117097)
@@ -1167,6 +1167,20 @@
     LLINT_END();
 }
 
+LLINT_SLOW_PATH_DECL(slow_path_switch_char)
+{
+    LLINT_BEGIN();
+    JSValue scrutinee = LLINT_OP_C(3).jsValue();
+    ASSERT(scrutinee.isString());
+    JSString* value = asString(scrutinee);
+    ASSERT(value->length() == 1);
+    int defaultOffset = pc[2].u.operand;
+    StringImpl* impl = asString(scrutinee)->value(exec).impl();
+    CodeBlock* codeBlock = exec->codeBlock();
+    pc += codeBlock->characterSwitchJumpTable(pc[1].u.operand).offsetForValue((*impl)[0], defaultOffset);
+    LLINT_END();
+}
+
 LLINT_SLOW_PATH_DECL(slow_path_switch_string)
 {
     LLINT_BEGIN();

Modified: branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (117096 => 117097)


--- branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2012-05-15 18:07:24 UTC (rev 117097)
@@ -1446,8 +1446,9 @@
     bineq t1, CellTag, .opSwitchCharFallThrough
     loadp JSCell::m_structure[t0], t1
     bbneq Structure::m_typeInfo + TypeInfo::m_type[t1], StringType, .opSwitchCharFallThrough
+    bineq JSString::m_length[t0], 1, .opSwitchCharFallThrough
     loadp JSString::m_value[t0], t0
-    bineq StringImpl::m_length[t0], 1, .opSwitchCharFallThrough
+    btpz  t0, .opSwitchOnRope
     loadp StringImpl::m_data8[t0], t1
     btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit
     loadh [t1], t0
@@ -1465,7 +1466,11 @@
 .opSwitchCharFallThrough:
     dispatchBranch(8[PC])
 
+.opSwitchOnRope:
+    callSlowPath(_llint_slow_path_switch_char)
+    dispatch(0)
 
+
 _llint_op_new_func:
     traceExecution()
     btiz 12[PC], .opNewFuncUnchecked

Modified: branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (117096 => 117097)


--- branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2012-05-15 18:05:25 UTC (rev 117096)
+++ branches/safari-536-branch/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2012-05-15 18:07:24 UTC (rev 117097)
@@ -1292,8 +1292,9 @@
     btpnz t1, tagMask, .opSwitchCharFallThrough
     loadp JSCell::m_structure[t1], t0
     bbneq Structure::m_typeInfo + TypeInfo::m_type[t0], StringType, .opSwitchCharFallThrough
+    bineq JSString::m_length[t1], 1, .opSwitchCharFallThrough
     loadp JSString::m_value[t1], t0
-    bineq StringImpl::m_length[t0], 1, .opSwitchCharFallThrough
+    btpz  t0, .opSwitchOnRope
     loadp StringImpl::m_data8[t0], t1
     btinz StringImpl::m_hashAndFlags[t0], HashFlags8BitBuffer, .opSwitchChar8Bit
     loadh [t1], t0
@@ -1311,7 +1312,11 @@
 .opSwitchCharFallThrough:
     dispatchInt(16[PB, PC, 8])
 
+.opSwitchOnRope:
+    callSlowPath(_llint_slow_path_switch_char)
+    dispatch(0)
 
+
 _llint_op_new_func:
     traceExecution()
     btiz 24[PB, PC, 8], .opNewFuncUnchecked
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to