LCOV - code coverage report
Current view: top level - src/compiler - operator.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 13 13 100.0 %
Date: 2017-04-26 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // Copyright 2014 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #include "src/compiler/operator.h"
       6             : 
       7             : #include <limits>
       8             : 
       9             : namespace v8 {
      10             : namespace internal {
      11             : namespace compiler {
      12             : 
      13             : namespace {
      14             : 
      15             : template <typename N>
      16             : V8_INLINE N CheckRange(size_t val) {
      17   837948666 :   CHECK_LE(val, std::numeric_limits<N>::max());
      18   558631953 :   return static_cast<N>(val);
      19             : }
      20             : 
      21             : }  // namespace
      22             : 
      23             : 
      24             : // static
      25             : STATIC_CONST_MEMBER_DEFINITION const size_t Operator::kMaxControlOutputCount;
      26             : 
      27    93105900 : Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic,
      28             :                    size_t value_in, size_t effect_in, size_t control_in,
      29             :                    size_t value_out, size_t effect_out, size_t control_out)
      30             :     : opcode_(opcode),
      31             :       properties_(properties),
      32             :       mnemonic_(mnemonic),
      33             :       value_in_(CheckRange<uint32_t>(value_in)),
      34             :       effect_in_(CheckRange<uint16_t>(effect_in)),
      35             :       control_in_(CheckRange<uint16_t>(control_in)),
      36             :       value_out_(CheckRange<uint16_t>(value_out)),
      37             :       effect_out_(CheckRange<uint8_t>(effect_out)),
      38   651737853 :       control_out_(CheckRange<uint32_t>(control_out)) {}
      39             : 
      40         154 : std::ostream& operator<<(std::ostream& os, const Operator& op) {
      41             :   op.PrintTo(os);
      42         154 :   return os;
      43             : }
      44             : 
      45         273 : void Operator::PrintToImpl(std::ostream& os, PrintVerbosity verbose) const {
      46         273 :   os << mnemonic();
      47         273 : }
      48             : 
      49         140 : void Operator::PrintPropsTo(std::ostream& os) const {
      50         140 :   std::string separator = "";
      51             : 
      52             : #define PRINT_PROP_IF_SET(name)         \
      53             :   if (HasProperty(Operator::k##name)) { \
      54             :     os << separator;                    \
      55             :     os << #name;                        \
      56             :     separator = ", ";                   \
      57             :   }
      58        1309 :   OPERATOR_PROPERTY_LIST(PRINT_PROP_IF_SET)
      59             : #undef PRINT_PROP_IF_SET
      60         140 : }
      61             : 
      62             : }  // namespace compiler
      63             : }  // namespace internal
      64             : }  // namespace v8

Generated by: LCOV version 1.10