gfx/angle/src/compiler/ForLoopUnroll.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 //
     2 // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
     3 // Use of this source code is governed by a BSD-style license that can be
     4 // found in the LICENSE file.
     5 //
     7 #ifndef ForLoopUnroll_h
     8 #define ForLoopUnroll_h
    10 #include "compiler/intermediate.h"
    12 struct TLoopIndexInfo {
    13     int id;
    14     int initValue;
    15     int stopValue;
    16     int incrementValue;
    17     TOperator op;
    18     int currentValue;
    19 };
    21 class ForLoopUnroll {
    22 public:
    23     ForLoopUnroll() { }
    25     void FillLoopIndexInfo(TIntermLoop* node, TLoopIndexInfo& info);
    27     // Update the info.currentValue for the next loop iteration.
    28     void Step();
    30     // Return false if loop condition is no longer satisfied.
    31     bool SatisfiesLoopCondition();
    33     // Check if the symbol is the index of a loop that's unrolled.
    34     bool NeedsToReplaceSymbolWithValue(TIntermSymbol* symbol);
    36     // Return the current value of a given loop index symbol.
    37     int GetLoopIndexValue(TIntermSymbol* symbol);
    39     void Push(TLoopIndexInfo& info);
    40     void Pop();
    42     static void MarkForLoopsWithIntegerIndicesForUnrolling(TIntermNode* root);
    44 private:
    45     int getLoopIncrement(TIntermLoop* node);
    47     int evaluateIntConstant(TIntermConstantUnion* node);
    49     TVector<TLoopIndexInfo> mLoopIndexStack;
    50 };
    52 #endif

mercurial