Ignore:
Timestamp:
Oct 31, 2008, 12:59:08 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-30 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.


Fixed a small bit of https://bugs.webkit.org/show_bug.cgi?id=21962
AST uses way too much memory


Removed a word from StatementNode by nixing LabelStack and turning it
into a compile-time data structure managed by CodeGenerator.


v8 tests and SunSpider, run by Gavin, report no change.


  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::CodeGenerator): (JSC::CodeGenerator::newLabelScope): (JSC::CodeGenerator::breakTarget): (JSC::CodeGenerator::continueTarget):
  • VM/CodeGenerator.h: Nixed the JumpContext system because it depended on a LabelStack in the AST, and it was a little cumbersome on the client side. Replaced with LabelScope, which tracks all break / continue information in the CodeGenerator, just like we track LabelIDs and other stacks of compile-time data.
  • kjs/LabelScope.h: Added. (JSC::LabelScope::): (JSC::LabelScope::LabelScope): (JSC::LabelScope::ref): (JSC::LabelScope::deref): (JSC::LabelScope::refCount): (JSC::LabelScope::breakTarget): (JSC::LabelScope::continueTarget): (JSC::LabelScope::type): (JSC::LabelScope::name): (JSC::LabelScope::scopeDepth): Simple abstraction for holding everything you might want to know about a break-able / continue-able scope.
  • kjs/LabelStack.cpp: Removed.
  • kjs/LabelStack.h: Removed.
  • kjs/grammar.y: No need to push labels at parse time -- we don't store LabelStacks in the AST anymore.
  • kjs/nodes.cpp: (JSC::DoWhileNode::emitCode): (JSC::WhileNode::emitCode): (JSC::ForNode::emitCode): (JSC::ForInNode::emitCode): (JSC::ContinueNode::emitCode): (JSC::BreakNode::emitCode): (JSC::SwitchNode::emitCode): (JSC::LabelNode::emitCode):
  • kjs/nodes.h: (JSC::StatementNode::): (JSC::LabelNode::): Use LabelScope where we used to use JumpContext. Simplified a bunch of code. Touched up label-related error messages a bit.
  • kjs/nodes2string.cpp: (JSC::LabelNode::streamTo): Updated for rename.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r38046 r38047  
    121121                95FDFA140E22998F0006FB00 /* HeavyProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95FDFA130E22998F0006FB00 /* HeavyProfile.cpp */; };
    122122                95FDFA160E2299980006FB00 /* HeavyProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95FDFA150E2299980006FB00 /* HeavyProfile.h */; };
     123                960097A60EBABB58007A7297 /* LabelScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 960097A50EBABB58007A7297 /* LabelScope.h */; };
    123124                A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
    124125                A72701B60DADE94900E548D7 /* ExceptionHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72701B40DADE94900E548D7 /* ExceptionHelpers.cpp */; };
     
    204205                BC18C42E0E16F5CD00B34460 /* JSWrapperObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
    205206                BC18C42F0E16F5CD00B34460 /* LabelID.h in Headers */ = {isa = PBXBuildFile; fileRef = 149B20D70D8A0891009CB8C7 /* LabelID.h */; };
    206                 BC18C4300E16F5CD00B34460 /* LabelStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B813A80CD1D01900DF59D6 /* LabelStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
    207207                BC18C4310E16F5CD00B34460 /* lexer.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8660255597D01FF60F7 /* lexer.h */; };
    208208                BC18C4340E16F5CD00B34460 /* ListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EB7450B708F540063461B /* ListHashSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    498498                6592C317098B7DE10003D4F6 /* VectorTraits.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VectorTraits.h; sourceTree = "<group>"; };
    499499                65B174BE09D1000200820339 /* chartables.c */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.c; fileEncoding = 30; path = chartables.c; sourceTree = "<group>"; };
    500                 65B813A80CD1D01900DF59D6 /* LabelStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelStack.h; sourceTree = "<group>"; };
    501500                65C02FBB0637462A003E7EE6 /* protect.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = protect.h; sourceTree = "<group>"; tabWidth = 8; };
    502501                65C647B3093EF8D60022C380 /* RefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RefPtr.h; sourceTree = "<group>"; tabWidth = 8; };
     
    587586                95FDFA130E22998F0006FB00 /* HeavyProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HeavyProfile.cpp; path = profiler/HeavyProfile.cpp; sourceTree = "<group>"; };
    588587                95FDFA150E2299980006FB00 /* HeavyProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HeavyProfile.h; path = profiler/HeavyProfile.h; sourceTree = "<group>"; };
     588                960097A50EBABB58007A7297 /* LabelScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LabelScope.h; path = kjs/LabelScope.h; sourceTree = "<group>"; };
    589589                A72700770DAC605600E548D7 /* JSNotAnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotAnObject.h; sourceTree = "<group>"; };
    590590                A72700780DAC605600E548D7 /* JSNotAnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotAnObject.cpp; sourceTree = "<group>"; };
     
    609609                BC02E98B0E183E38000F9297 /* ErrorInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorInstance.h; sourceTree = "<group>"; };
    610610                BC02E9B60E1842FA000F9297 /* JSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSString.cpp; sourceTree = "<group>"; };
    611                 BC02E9B70E1844CF000F9297 /* LabelStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelStack.cpp; sourceTree = "<group>"; };
    612611                BC02E9B80E184545000F9297 /* GetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetterSetter.cpp; sourceTree = "<group>"; };
    613612                BC02E9B90E184580000F9297 /* JSNumberCell.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNumberCell.cpp; sourceTree = "<group>"; };
     
    938937                        isa = PBXGroup;
    939938                        children = (
     939                                960097A50EBABB58007A7297 /* LabelScope.h */,
    940940                                149B15E90D81F986009CB8C7 /* CodeGenerator.cpp */,
    941941                                149B15E80D81F986009CB8C7 /* CodeGenerator.h */,
     
    11131113                                14ABB454099C2A0F00E2A24F /* JSType.h */,
    11141114                                93F1981A08245AAE001E9ABC /* keywords.table */,
    1115                                 BC02E9B70E1844CF000F9297 /* LabelStack.cpp */,
    1116                                 65B813A80CD1D01900DF59D6 /* LabelStack.h */,
    11171115                                F692A8680255597D01FF60F7 /* lookup.cpp */,
    11181116                                F692A8690255597D01FF60F7 /* lookup.h */,
     
    14421440                                BC18C42E0E16F5CD00B34460 /* JSWrapperObject.h in Headers */,
    14431441                                BC18C42F0E16F5CD00B34460 /* LabelID.h in Headers */,
    1444                                 BC18C4300E16F5CD00B34460 /* LabelStack.h in Headers */,
    14451442                                BC18C4310E16F5CD00B34460 /* lexer.h in Headers */,
    14461443                                BC18C4340E16F5CD00B34460 /* ListHashSet.h in Headers */,
     
    15621559                                14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */,
    15631560                                BC9041480EB9250900FE26FA /* StructureIDTransitionTable.h in Headers */,
     1561                                960097A60EBABB58007A7297 /* LabelScope.h in Headers */,
    15641562                                BC95437D0EBA70FD0072B6D3 /* PropertyMapHashTable.h in Headers */,
    15651563                                1C61516D0EBAC7A00031376F /* ProfilerServer.h in Headers */,
Note: See TracChangeset for help on using the changeset viewer.