LCOV - code coverage report
Current view: top level - test/unittests/compiler - js-native-context-specialization-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 12 14 85.7 %
Date: 2019-02-19 Functions: 5 8 62.5 %

          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 "test/unittests/compiler/graph-unittest.h"
       6             : 
       7             : #include "src/compiler/js-native-context-specialization.h"
       8             : #include "src/compiler/js-operator.h"
       9             : #include "src/compiler/machine-operator.h"
      10             : #include "src/compiler/simplified-operator.h"
      11             : #include "src/dtoa.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : namespace compiler {
      16             : namespace js_native_context_specialization_unittest {
      17             : 
      18             : class JSNativeContextSpecializationTest : public GraphTest {
      19             :  public:
      20           1 :   explicit JSNativeContextSpecializationTest(int num_parameters = 1)
      21           1 :       : GraphTest(num_parameters), javascript_(zone()) {}
      22           1 :   ~JSNativeContextSpecializationTest() override {}
      23             : 
      24             :  protected:
      25             :   JSOperatorBuilder* javascript() { return &javascript_; }
      26             : 
      27             :  private:
      28             :   JSOperatorBuilder javascript_;
      29             : };
      30             : 
      31       15189 : TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) {
      32           1 :   const size_t str_len = 3;
      33           1 :   const size_t num_len = kBase10MaximalLength + 1;
      34             : 
      35             :   Node* const str_node = graph()->NewNode(
      36           3 :       common()->HeapConstant(factory()->InternalizeUtf8String("str")));
      37           2 :   EXPECT_EQ(
      38             :       JSNativeContextSpecialization::GetMaxStringLength(broker(), str_node),
      39           0 :       str_len);
      40             : 
      41           1 :   Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3));
      42           2 :   EXPECT_EQ(
      43             :       JSNativeContextSpecialization::GetMaxStringLength(broker(), num_node),
      44           0 :       num_len);
      45           1 : }
      46             : 
      47             : }  // namespace js_native_context_specialization_unittest
      48             : }  // namespace compiler
      49             : }  // namespace internal
      50        9111 : }  // namespace v8

Generated by: LCOV version 1.10