CodeBlock's cloned SymbolTables only need the captured names.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jan 2014 03:38:06 +0000 (03:38 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Jan 2014 03:38:06 +0000 (03:38 +0000)
<https://webkit.org/b/127978>

Renamed SymbolTable::clone() to SymbolTable::cloneCapturedNames()
and make it skip over any symbols that aren't captured, since those
won't be needed after codegen.

This is a first step towards getting rid of redundant symbol tables.

Reviewed by Geoffrey Garen.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
* runtime/SymbolTable.cpp:
(JSC::SymbolTable::cloneCapturedNames):
* runtime/SymbolTable.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163151 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/runtime/SymbolTable.cpp
Source/JavaScriptCore/runtime/SymbolTable.h

index 6893b0b0459eeed6d7469d0e6f19681f3dd0d23f..21ee04ff5f0b1046a311dff749d67d95ee505f1f 100644 (file)
@@ -1,3 +1,22 @@
+2014-01-30  Andreas Kling  <akling@apple.com>
+
+        CodeBlock's cloned SymbolTables only need the captured names.
+        <https://webkit.org/b/127978>
+
+        Renamed SymbolTable::clone() to SymbolTable::cloneCapturedNames()
+        and make it skip over any symbols that aren't captured, since those
+        won't be needed after codegen.
+
+        This is a first step towards getting rid of redundant symbol tables.
+
+        Reviewed by Geoffrey Garen.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::CodeBlock):
+        * runtime/SymbolTable.cpp:
+        (JSC::SymbolTable::cloneCapturedNames):
+        * runtime/SymbolTable.h:
+
 2014-01-28  Timothy Hatcher  <timothy@apple.com>
 
         Add column number and call timing support to LegacyProfiler.
index 263ec7cadf4f79ca8102441e62bf2a05b5ddc3f2..cb0dc6fbf138ede3e7dbf3455c39b5112f337a7a 100644 (file)
@@ -1558,7 +1558,7 @@ CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlin
     
     if (SymbolTable* symbolTable = unlinkedCodeBlock->symbolTable()) {
         if (codeType() == FunctionCode && symbolTable->captureCount()) {
-            m_symbolTable.set(*m_vm, m_ownerExecutable.get(), symbolTable->clone(*m_vm));
+            m_symbolTable.set(*m_vm, m_ownerExecutable.get(), symbolTable->cloneCapturedNames(*m_vm));
             didCloneSymbolTable = true;
         } else
             m_symbolTable.set(*m_vm, m_ownerExecutable.get(), symbolTable);
index 556dbf7afd47129358e3b8a23d156bbca9b9944a..8ad55b10102185ae25f8ab51bd790445510a2625 100644 (file)
@@ -134,7 +134,7 @@ void SymbolTable::WatchpointCleanup::finalizeUnconditionally()
     }
 }
 
-SymbolTable* SymbolTable::clone(VM& vm)
+SymbolTable* SymbolTable::cloneCapturedNames(VM& vm)
 {
     SymbolTable* result = SymbolTable::create(vm);
     
@@ -142,10 +142,10 @@ SymbolTable* SymbolTable::clone(VM& vm)
     result->m_usesNonStrictEval = m_usesNonStrictEval;
     result->m_captureStart = m_captureStart;
     result->m_captureEnd = m_captureEnd;
-    
-    Map::iterator iter = m_map.begin();
-    Map::iterator end = m_map.end();
-    for (; iter != end; ++iter) {
+
+    for (auto iter = m_map.begin(), end = m_map.end(); iter != end; ++iter) {
+        if (!isCaptured(iter->value.getIndex()))
+            continue;
         result->m_map.add(
             iter->key,
             SymbolTableEntry(iter->value.getIndex(), iter->value.getAttributes()));
index 6e2c26d683f34ad74c975b9334023f081ae3702a..04367344e0fbc729fa49b9da639f05e565abc9bf 100644 (file)
@@ -467,7 +467,7 @@ public:
     const SlowArgument* slowArguments() { return m_slowArguments.get(); }
     void setSlowArguments(std::unique_ptr<SlowArgument[]> slowArguments) { m_slowArguments = std::move(slowArguments); }
     
-    SymbolTable* clone(VM&);
+    SymbolTable* cloneCapturedNames(VM&);
 
     static void visitChildren(JSCell*, SlotVisitor&);