Ignore:
Timestamp:
Sep 26, 2008, 6:44:15 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-26 Gavin Barraclough <[email protected]>

Reviewed by Maciej Stachowiak & Oliver Hunt.

Add support for reusing temporary JSNumberCells. This change is based on the observation
that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
operation that would produce a JSNumberCell, we can reuse the object rather than allocating
a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
(a * b) will have a numeric result (or else it will have thrown an exception), so the result
will either be a JSNumberCell or a JSImmediate.

This patch changes three areas of JSC:

  • The AST now tracks type information about the result of each node.
  • This information is consumed in bytecode compilation, and certain bytecode operations now carry the statically determined type information about their operands.
  • CTI uses the information in a number of fashions:
    • Where an operand to certain arithmetic operations is reusable, it will plant code to try to perform the operation in JIT code & reuse the cell, where appropriate.
    • Where it can be statically determined that an operand can only be numeric (typically the result of another arithmetic operation) the code will not redundantly check that the JSCell is a JSNumberCell.
    • Where either of the operands to an add are non-numeric do not plant an optimized arithmetic code path, just call straight out to the C function.

+6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
+1% v8-tests (improvements in raytrace & crypto)

  • VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
  • VM/CTI.h:
  • kjs/JSNumberCell.h:
  • masm/X86Assembler.h:
  • VM/CodeBlock.cpp: Add type information to specific bytecodes.
  • VM/CodeGenerator.cpp:
  • VM/CodeGenerator.h:
  • VM/Machine.cpp:
  • kjs/nodes.cpp: Track static type information for nodes.
  • kjs/nodes.h:
  • kjs/ResultDescriptor.h: (Added)
  • JavaScriptCore.xcodeproj/project.pbxproj:
File:
1 edited

Legend:

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

    r36863 r36976  
    8787                869083150E6518D7000D36ED /* WREC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 869083130E6518D7000D36ED /* WREC.cpp */; };
    8888                869083160E6518D7000D36ED /* WREC.h in Headers */ = {isa = PBXBuildFile; fileRef = 869083140E6518D7000D36ED /* WREC.h */; settings = {ATTRIBUTES = (Private, ); }; };
     89                869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 869EBCB60E8C6D4A008722CC /* ResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
    8990                905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */; };
    9091                90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 90D3469B0E285280009492EE /* RefCountedLeakCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    589590                869083130E6518D7000D36ED /* WREC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WREC.cpp; sourceTree = "<group>"; };
    590591                869083140E6518D7000D36ED /* WREC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WREC.h; sourceTree = "<group>"; };
     592                869EBCB60E8C6D4A008722CC /* ResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultType.h; sourceTree = "<group>"; };
    591593                905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCountedLeakCounter.cpp; sourceTree = "<group>"; };
    592594                90D3469B0E285280009492EE /* RefCountedLeakCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCountedLeakCounter.h; sourceTree = "<group>"; };
     
    12711273                                BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
    12721274                                BCD202C00E1706A7002C7E82 /* RegExpPrototype.h */,
     1275                                869EBCB60E8C6D4A008722CC /* ResultType.h */,
    12731276                                9374D3A8038D9D74008635CE /* ScopeChain.cpp */,
    12741277                                9374D3A7038D9D74008635CE /* ScopeChain.h */,
     
    15971600                                7E2ADD8E0E79AAD500D50C51 /* CharacterClassConstructor.h in Headers */,
    15981601                                140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */,
     1602                                869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
    15991603                        );
    16001604                        runOnlyForDeploymentPostprocessing = 0;
     
    20762080                        baseConfigurationReference = 1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */;
    20772081                        buildSettings = {
     2082                                GCC_VERSION = 4.0;
    20782083                                STRIP_INSTALLED_PRODUCT = NO;
    20792084                        };
Note: See TracChangeset for help on using the changeset viewer.