⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 180711 in webkit


Ignore:
Timestamp:
Feb 26, 2015, 4:55:19 PM (12 years ago)
Author:
fpizlo@apple.com
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.

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r180703 r180711  
     12015-02-26  Filip Pizlo  <fpizlo@apple.com>
     2
     3        The bool returning form of BytecodeGenerator::addVar() can be removed
     4        https://bugs.webkit.org/show_bug.cgi?id=142064
     5
     6        Reviewed by Mark Lam.
     7       
     8        It's easier to implement addVar() when you don't have to return whether it's a new
     9        variable or not.
     10
     11        * bytecompiler/BytecodeGenerator.cpp:
     12        (JSC::BytecodeGenerator::addVar):
     13        * bytecompiler/BytecodeGenerator.h:
     14        (JSC::BytecodeGenerator::addVar): Deleted.
     15
    1162015-02-26  Filip Pizlo  <fpizlo@apple.com>
    217
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r180595 r180711  
    124124}
    125125
    126 bool BytecodeGenerator::addVar(
    127     const Identifier& ident, ConstantMode constantMode, WatchMode watchMode, RegisterID*& r0)
     126RegisterID* BytecodeGenerator::addVar(
     127    const Identifier& ident, ConstantMode constantMode, WatchMode watchMode)
    128128{
    129129    ASSERT(static_cast<size_t>(m_codeBlock->m_numVars) == m_calleeRegisters.size());
     
    134134    SymbolTable::Map::AddResult result = symbolTable().add(locker, ident.impl(), newEntry);
    135135
    136     if (!result.isNewEntry) {
    137         r0 = &registerFor(result.iterator->value.getIndex());
    138         return false;
    139     }
     136    if (!result.isNewEntry)
     137        return &registerFor(result.iterator->value.getIndex());
    140138   
    141139    if (watchMode == IsWatchable) {
     
    145143    }
    146144   
    147     r0 = addVar();
    148    
    149145    ASSERT(watchMode == NotWatchable || static_cast<size_t>(m_codeBlock->m_numVars) == m_watchableVariables.size());
    150146   
    151     return true;
     147    return addVar();
    152148}
    153149
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r180595 r180711  
    614614        // Adds a var slot and maps it to the name ident in symbolTable().
    615615        enum WatchMode { IsWatchable, NotWatchable };
    616         RegisterID* addVar(const Identifier& ident, ConstantMode constantMode, WatchMode watchMode)
    617         {
    618             RegisterID* local;
    619             addVar(ident, constantMode, watchMode, local);
    620             return local;
    621         }
    622 
    623         // Ditto. Returns true if a new RegisterID was added, false if a pre-existing RegisterID was re-used.
    624         bool addVar(const Identifier&, ConstantMode, WatchMode, RegisterID*&);
    625        
     616        RegisterID* addVar(const Identifier&, ConstantMode, WatchMode);
     617
    626618        // Adds an anonymous var slot. To give this slot a name, add it to symbolTable().
    627619        RegisterID* addVar()
Note: See TracChangeset for help on using the changeset viewer.