193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// Copyright 2013 the V8 project authors. All rights reserved. 293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// Redistribution and use in source and binary forms, with or without 393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// modification, are permitted provided that the following conditions are 493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// met: 593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// 693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// * Redistributions of source code must retain the above copyright 793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// notice, this list of conditions and the following disclaimer. 893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// * Redistributions in binary form must reproduce the above 993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// copyright notice, this list of conditions and the following 1093a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// disclaimer in the documentation and/or other materials provided 1193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// with the distribution. 1293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// * Neither the name of Google Inc. nor the names of its 1393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// contributors may be used to endorse or promote products derived 1493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// from this software without specific prior written permission. 1593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// 1693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2093a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 2893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org#ifndef V8_HYDROGEN_UINT32_ANALYSIS_H_ 2993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org#define V8_HYDROGEN_UINT32_ANALYSIS_H_ 3093a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 3193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org#include "hydrogen.h" 3293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 3393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.orgnamespace v8 { 3493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.orgnamespace internal { 3593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 3693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 3793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// Discover instructions that can be marked with kUint32 flag allowing 3893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org// them to produce full range uint32 values. 3993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.orgclass HUint32AnalysisPhase : public HPhase { 4093a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org public: 4193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org explicit HUint32AnalysisPhase(HGraph* graph) 4293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org : HPhase("H_Compute safe UInt32 operations", graph), phis_(4, zone()) { } 4393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 4493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org void Run(); 4593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 4693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org private: 4793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org INLINE(bool IsSafeUint32Use(HValue* val, HValue* use)); 4893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org INLINE(bool Uint32UsesAreSafe(HValue* uint32val)); 4993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org INLINE(bool CheckPhiOperands(HPhi* phi)); 5093a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org INLINE(void UnmarkPhi(HPhi* phi, ZoneList<HPhi*>* worklist)); 5193a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org INLINE(void UnmarkUnsafePhis()); 5293a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 5393a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org ZoneList<HPhi*> phis_; 5493a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org}; 5593a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 5693a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 5793a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org} } // namespace v8::internal 5893a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org 5993a47f4837f2137c8d8349250fd8e91da3108126jkummerow@chromium.org#endif // V8_HYDROGEN_UINT32_ANALYSIS_H_ 60