Ignore:
Timestamp:
Sep 15, 2015, 12:26:45 PM (10 years ago)
Author:
[email protected]
Message:

functions that use try/catch will allocate a top level JSLexicalEnvironment even when it is not necessary
https://bugs.webkit.org/show_bug.cgi?id=148169

Patch by Saam barati <[email protected]> on 2015-09-15
Reviewed by Geoffrey Garen.

We used to do this before we had proper lexical scoping
in the bytecode generator. There is absolutely no reason
why need to allocate a top-level "var" activation when a
function/program uses a "catch" block.

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createTryStatement):
(JSC::ASTBuilder::incConstants):
(JSC::ASTBuilder::usesThis):
(JSC::ASTBuilder::usesArguments):
(JSC::ASTBuilder::usesWith):
(JSC::ASTBuilder::usesEval):
(JSC::ASTBuilder::usesCatch): Deleted.

  • parser/Nodes.h:

(JSC::ScopeNode::isStrictMode):
(JSC::ScopeNode::setUsesArguments):
(JSC::ScopeNode::usesThis):
(JSC::ScopeNode::needsActivation):
(JSC::ScopeNode::hasCapturedVariables):
(JSC::ScopeNode::captures):
(JSC::ScopeNode::needsActivationForMoreThanVariables): Deleted.

  • parser/ParserModes.h:
  • runtime/Executable.h:

(JSC::ScriptExecutable::usesEval):
(JSC::ScriptExecutable::usesArguments):
(JSC::ScriptExecutable::needsActivation):
(JSC::ScriptExecutable::isStrictMode):
(JSC::ScriptExecutable::ecmaMode):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/ParserModes.h

    r188417 r189819  
    11/*
    2  * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012, 2013, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    140140typedef unsigned CodeFeatures;
    141141
    142 const CodeFeatures NoFeatures = 0;
    143 const CodeFeatures EvalFeature = 1 << 0;
    144 const CodeFeatures ArgumentsFeature = 1 << 1;
    145 const CodeFeatures WithFeature = 1 << 2;
    146 const CodeFeatures CatchFeature = 1 << 3;
    147 const CodeFeatures ThisFeature = 1 << 4;
    148 const CodeFeatures StrictModeFeature = 1 << 5;
    149 const CodeFeatures ShadowsArgumentsFeature = 1 << 6;
    150 const CodeFeatures ModifiedParameterFeature = 1 << 7;
    151 const CodeFeatures ModifiedArgumentsFeature = 1 << 8;
     142const CodeFeatures NoFeatures =                    0;
     143const CodeFeatures EvalFeature =              1 << 0;
     144const CodeFeatures ArgumentsFeature =         1 << 1;
     145const CodeFeatures WithFeature =              1 << 2;
     146const CodeFeatures ThisFeature =              1 << 3;
     147const CodeFeatures StrictModeFeature =        1 << 4;
     148const CodeFeatures ShadowsArgumentsFeature =  1 << 5;
     149const CodeFeatures ModifiedParameterFeature = 1 << 6;
     150const CodeFeatures ModifiedArgumentsFeature = 1 << 7;
    152151
    153 const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ModifiedParameterFeature;
     152const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ModifiedParameterFeature;
    154153
    155154} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.