js/src/jit/UnreachableCodeElimination.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * vim: set ts=8 sts=4 et sw=4 tw=99:
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef jit_UnreachableCodeElimination_h
     8 #define jit_UnreachableCodeElimination_h
    10 #include "jit/MIRGraph.h"
    12 namespace js {
    13 namespace jit {
    15 class MIRGraph;
    17 class UnreachableCodeElimination
    18 {
    19     typedef Vector<MBasicBlock *, 16, SystemAllocPolicy> BlockList;
    21     MIRGenerator *mir_;
    22     MIRGraph &graph_;
    23     uint32_t marked_;
    24     bool redundantPhis_;
    25     bool rerunAliasAnalysis_;
    26     bool disableAliasAnalysis_;
    28     bool prunePointlessBranchesAndMarkReachableBlocks();
    29     void checkDependencyAndRemoveUsesFromUnmarkedBlocks(MDefinition *instr);
    30     bool removeUnmarkedBlocksAndClearDominators();
    31     bool removeUnmarkedBlocksAndCleanup();
    33     bool enqueue(MBasicBlock *block, BlockList &list);
    34     MBasicBlock *optimizableSuccessor(MBasicBlock *block);
    36   public:
    37     UnreachableCodeElimination(MIRGenerator *mir, MIRGraph &graph)
    38       : mir_(mir),
    39         graph_(graph),
    40         marked_(0),
    41         redundantPhis_(false),
    42         rerunAliasAnalysis_(false),
    43         disableAliasAnalysis_(false)
    44     {}
    46     // Walks the graph and discovers what is reachable. Removes everything else.
    47     bool analyze();
    49     // Removes any blocks that are not marked.  Assumes that these blocks are not
    50     // reachable.  The parameter |marked| should be the number of blocks that
    51     // are marked.
    52     bool removeUnmarkedBlocks(size_t marked);
    54     // Call this function to prevent alias analysis to run a second time if we
    55     // do not need it.
    56     void disableAliasAnalysis() {
    57         disableAliasAnalysis_ = true;
    58     }
    59 };
    61 } /* namespace jit */
    62 } /* namespace js */
    64 #endif /* jit_UnreachableCodeElimination_h */

mercurial