LCOV - code coverage report
Current view: top level - src/compiler - machine-graph.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 35 43 81.4 %
Date: 2019-01-20 Functions: 11 13 84.6 %

          Line data    Source code
       1             : // Copyright 2018 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/machine-graph.h"
       6             : 
       7             : #include "src/compiler/node-properties.h"
       8             : #include "src/external-reference.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : namespace compiler {
      13             : 
      14    34329108 : Node* MachineGraph::Int32Constant(int32_t value) {
      15             :   Node** loc = cache_.FindInt32Constant(value);
      16    14817248 :   if (*loc == nullptr) {
      17    19511858 :     *loc = graph()->NewNode(common()->Int32Constant(value));
      18             :   }
      19    14817374 :   return *loc;
      20             : }
      21             : 
      22    15444085 : Node* MachineGraph::Int64Constant(int64_t value) {
      23             :   Node** loc = cache_.FindInt64Constant(value);
      24     8473824 :   if (*loc == nullptr) {
      25     6970178 :     *loc = graph()->NewNode(common()->Int64Constant(value));
      26             :   }
      27     8473898 :   return *loc;
      28             : }
      29             : 
      30     8260153 : Node* MachineGraph::IntPtrConstant(intptr_t value) {
      31           0 :   return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value))
      32     8260153 :                            : Int64Constant(static_cast<int64_t>(value));
      33             : }
      34             : 
      35           0 : Node* MachineGraph::RelocatableInt32Constant(int32_t value,
      36           0 :                                              RelocInfo::Mode rmode) {
      37             :   Node** loc = cache_.FindRelocatableInt32Constant(
      38             :       value, static_cast<RelocInfoMode>(rmode));
      39           0 :   if (*loc == nullptr) {
      40           0 :     *loc = graph()->NewNode(common()->RelocatableInt32Constant(value, rmode));
      41             :   }
      42           0 :   return *loc;
      43             : }
      44             : 
      45       86666 : Node* MachineGraph::RelocatableInt64Constant(int64_t value,
      46       91010 :                                              RelocInfo::Mode rmode) {
      47             :   Node** loc = cache_.FindRelocatableInt64Constant(
      48             :       value, static_cast<RelocInfoMode>(rmode));
      49       86673 :   if (*loc == nullptr) {
      50      136515 :     *loc = graph()->NewNode(common()->RelocatableInt64Constant(value, rmode));
      51             :   }
      52       86685 :   return *loc;
      53             : }
      54             : 
      55       86665 : Node* MachineGraph::RelocatableIntPtrConstant(intptr_t value,
      56             :                                               RelocInfo::Mode rmode) {
      57             :   return kSystemPointerSize == 8
      58             :              ? RelocatableInt64Constant(value, rmode)
      59       86665 :              : RelocatableInt32Constant(static_cast<int>(value), rmode);
      60             : }
      61             : 
      62       23152 : Node* MachineGraph::Float32Constant(float value) {
      63             :   Node** loc = cache_.FindFloat32Constant(value);
      64       12241 :   if (*loc == nullptr) {
      65       10911 :     *loc = graph()->NewNode(common()->Float32Constant(value));
      66             :   }
      67       12242 :   return *loc;
      68             : }
      69             : 
      70      770978 : Node* MachineGraph::Float64Constant(double value) {
      71             :   Node** loc = cache_.FindFloat64Constant(value);
      72      399272 :   if (*loc == nullptr) {
      73      371700 :     *loc = graph()->NewNode(common()->Float64Constant(value));
      74             :   }
      75      399280 :   return *loc;
      76             : }
      77             : 
      78        1677 : Node* MachineGraph::PointerConstant(intptr_t value) {
      79             :   Node** loc = cache_.FindPointerConstant(value);
      80        1265 :   if (*loc == nullptr) {
      81         412 :     *loc = graph()->NewNode(common()->PointerConstant(value));
      82             :   }
      83        1265 :   return *loc;
      84             : }
      85             : 
      86     4645617 : Node* MachineGraph::ExternalConstant(ExternalReference reference) {
      87     1918983 :   Node** loc = cache_.FindExternalConstant(reference);
      88     1918993 :   if (*loc == nullptr) {
      89     2726652 :     *loc = graph()->NewNode(common()->ExternalConstant(reference));
      90             :   }
      91     1919029 :   return *loc;
      92             : }
      93             : 
      94           0 : Node* MachineGraph::ExternalConstant(Runtime::FunctionId function_id) {
      95           0 :   return ExternalConstant(ExternalReference::Create(function_id));
      96             : }
      97             : 
      98             : }  // namespace compiler
      99             : }  // namespace internal
     100      183867 : }  // namespace v8

Generated by: LCOV version 1.10