Changeset 26617 in webkit for trunk/JavaScriptCore
- Timestamp:
- Oct 15, 2007, 1:36:57 PM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r26603 r26617 1 2007-10-12 Geoffrey Garen <[email protected]> 2 3 Reviewed by Maciej Stachowiak. 4 5 Fixed http://bugs.webkit.org/show_bug.cgi?id=15490 6 Iteration statements sometimes incorrectly evaluate to the empty value 7 (KDE r670547). 8 9 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] 10 11 This patch is a merge of KDE r670547, with substantial modification 12 for performance. 13 14 It fixes do-while statements to evaluate to a value. (They used 15 to evaluate to the empty value in all cases.) 16 17 It also fixes SourceElementsNode to maintain the value of abnormal 18 completions like "break" and "continue." 19 20 It also re-works the main execution loop in SourceElementsNode so that 21 it (1) makes a little more sense and (2) avoids unnecessary work. This 22 is a .28% speedup on command-line JS iBench. 23 24 * kjs/nodes.cpp: 25 (DoWhileNode::execute): 26 (SourceElementsNode::execute): 27 1 28 2007-10-15 Simon Hausmann <[email protected]> 2 29 -
trunk/JavaScriptCore/kjs/completion.h
r20310 r26617 53 53 ComplType complType() const { return comp; } 54 54 JSValue *value() const { return val; } 55 void setValue(JSValue* v) { val = v; } 55 56 Identifier target() const { return tar; } 56 57 bool isValueCompletion() const { return !!val; } -
trunk/JavaScriptCore/kjs/nodes.cpp
r26582 r26617 1808 1808 JSValue *bv; 1809 1809 Completion c; 1810 JSValue* value = 0; 1810 1811 1811 1812 do { … … 1820 1821 return Completion(Interrupted); 1821 1822 1823 if (c.isValueCompletion()) 1824 value = c.value(); 1825 1822 1826 if (!((c.complType() == Continue) && ls.contains(c.target()))) { 1823 1827 if ((c.complType() == Break) && ls.contains(c.target())) 1824 return Completion(Normal, 0);1828 return Completion(Normal, value); 1825 1829 if (c.complType() != Normal) 1826 1830 return c; … … 1830 1834 } while (bv->toBoolean(exec)); 1831 1835 1832 return Completion(Normal, 0);1836 return Completion(Normal, value); 1833 1837 } 1834 1838 … … 2560 2564 { 2561 2565 KJS_CHECKEXCEPTION 2562 2563 Completion c1 = node->execute(exec); 2564 KJS_CHECKEXCEPTION; 2565 if (c1.complType() != Normal) 2566 return c1; 2567 2568 for (SourceElementsNode *n = next.get(); n; n = n->next.get()) { 2569 Completion c2 = n->node->execute(exec); 2570 if (c2.complType() != Normal) 2571 return c2; 2572 // The spec says to return c2 here, but it seems that mozilla returns c1 if 2573 // c2 doesn't have a value 2574 if (c2.value()) 2575 c1 = c2; 2576 } 2577 2578 return c1; 2566 JSValue* v = 0; 2567 SourceElementsNode* n = this; 2568 while (1) { 2569 Completion c = n->node->execute(exec); 2570 2571 if (JSValue* v2 = c.value()) 2572 v = v2; 2573 c.setValue(v); 2574 2575 if (c.complType() != Normal) 2576 return c; 2577 2578 n = n->next.get(); 2579 if (!n) 2580 return c; 2581 } 2579 2582 } 2580 2583
Note:
See TracChangeset
for help on using the changeset viewer.