Title: [180711] trunk/Source/_javascript_Core
Revision
180711
Author
fpi...@apple.com
Date
2015-02-26 16:55:19 -0800 (Thu, 26 Feb 2015)

Log Message

The bool returning form of BytecodeGenerator::addVar() can be removed
https://bugs.webkit.org/show_bug.cgi?id=142064

Reviewed by Mark Lam.
        
It's easier to implement addVar() when you don't have to return whether it's a new
variable or not.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::addVar):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::addVar): Deleted.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (180710 => 180711)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-27 00:30:06 UTC (rev 180710)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-27 00:55:19 UTC (rev 180711)
@@ -1,5 +1,20 @@
 2015-02-26  Filip Pizlo  <fpi...@apple.com>
 
+        The bool returning form of BytecodeGenerator::addVar() can be removed
+        https://bugs.webkit.org/show_bug.cgi?id=142064
+
+        Reviewed by Mark Lam.
+        
+        It's easier to implement addVar() when you don't have to return whether it's a new
+        variable or not.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::addVar):
+        * bytecompiler/BytecodeGenerator.h:
+        (JSC::BytecodeGenerator::addVar): Deleted.
+
+2015-02-26  Filip Pizlo  <fpi...@apple.com>
+
         Various array access corner cases should take OSR exit feedback
         https://bugs.webkit.org/show_bug.cgi?id=142056
 

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (180710 => 180711)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-02-27 00:30:06 UTC (rev 180710)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-02-27 00:55:19 UTC (rev 180711)
@@ -123,8 +123,8 @@
     return ParserError(ParserError::ErrorNone);
 }
 
-bool BytecodeGenerator::addVar(
-    const Identifier& ident, ConstantMode constantMode, WatchMode watchMode, RegisterID*& r0)
+RegisterID* BytecodeGenerator::addVar(
+    const Identifier& ident, ConstantMode constantMode, WatchMode watchMode)
 {
     ASSERT(static_cast<size_t>(m_codeBlock->m_numVars) == m_calleeRegisters.size());
     
@@ -133,10 +133,8 @@
     SymbolTableEntry newEntry(index, constantMode == IsConstant ? ReadOnly : 0);
     SymbolTable::Map::AddResult result = symbolTable().add(locker, ident.impl(), newEntry);
 
-    if (!result.isNewEntry) {
-        r0 = &registerFor(result.iterator->value.getIndex());
-        return false;
-    }
+    if (!result.isNewEntry)
+        return &registerFor(result.iterator->value.getIndex());
     
     if (watchMode == IsWatchable) {
         while (m_watchableVariables.size() < static_cast<size_t>(m_codeBlock->m_numVars))
@@ -144,11 +142,9 @@
         m_watchableVariables.append(ident);
     }
     
-    r0 = addVar();
-    
     ASSERT(watchMode == NotWatchable || static_cast<size_t>(m_codeBlock->m_numVars) == m_watchableVariables.size());
     
-    return true;
+    return addVar();
 }
 
 BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, ProfilerMode profilerMode)

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (180710 => 180711)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2015-02-27 00:30:06 UTC (rev 180710)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2015-02-27 00:55:19 UTC (rev 180711)
@@ -613,16 +613,8 @@
 
         // Adds a var slot and maps it to the name ident in symbolTable().
         enum WatchMode { IsWatchable, NotWatchable };
-        RegisterID* addVar(const Identifier& ident, ConstantMode constantMode, WatchMode watchMode)
-        {
-            RegisterID* local;
-            addVar(ident, constantMode, watchMode, local);
-            return local;
-        }
+        RegisterID* addVar(const Identifier&, ConstantMode, WatchMode);
 
-        // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
-        bool addVar(const Identifier&, ConstantMode, WatchMode, RegisterID*&);
-        
         // Adds an anonymous var slot. To give this slot a name, add it to symbolTable().
         RegisterID* addVar()
         {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to