LCOV - code coverage report
Current view: top level - test/unittests - code-stub-assembler-unittest.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 23 25 92.0 %
Date: 2019-04-17 Functions: 9 12 75.0 %

          Line data    Source code
       1             : // Copyright 2017 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/code-stub-assembler-unittest.h"
       6             : 
       7             : #include "src/code-factory.h"
       8             : #include "src/compiler/node.h"
       9             : #include "src/interface-descriptors.h"
      10             : #include "src/isolate.h"
      11             : #include "src/objects-inl.h"
      12             : #include "test/unittests/compiler/compiler-test-utils.h"
      13             : #include "test/unittests/compiler/node-test-utils.h"
      14             : 
      15             : using ::testing::_;
      16             : using v8::internal::compiler::Node;
      17             : 
      18             : namespace c = v8::internal::compiler;
      19             : 
      20             : namespace v8 {
      21             : namespace internal {
      22             : 
      23           3 : CodeStubAssemblerTestState::CodeStubAssemblerTestState(
      24             :     CodeStubAssemblerTest* test)
      25             :     : compiler::CodeAssemblerState(
      26             :           test->isolate(), test->zone(), VoidDescriptor{}, Code::STUB, "test",
      27           6 :           PoisoningMitigationLevel::kPoisonCriticalOnly) {}
      28             : 
      29       15444 : TARGET_TEST_F(CodeStubAssemblerTest, SmiTag) {
      30           1 :   CodeStubAssemblerTestState state(this);
      31             :   CodeStubAssemblerForTest m(&state);
      32           2 :   Node* value = m.Int32Constant(44);
      33           5 :   EXPECT_THAT(m.SmiTag(value),
      34             :               IsBitcastWordToTaggedSigned(c::IsIntPtrConstant(
      35           0 :                   static_cast<intptr_t>(44) << (kSmiShiftSize + kSmiTagSize))));
      36           4 :   EXPECT_THAT(m.SmiUntag(value),
      37             :               c::IsIntPtrConstant(static_cast<intptr_t>(44) >>
      38           0 :                                   (kSmiShiftSize + kSmiTagSize)));
      39           1 : }
      40             : 
      41       15444 : TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMax) {
      42           1 :   CodeStubAssemblerTestState state(this);
      43             :   CodeStubAssemblerForTest m(&state);
      44             :   {
      45           2 :     Node* a = m.IntPtrConstant(100);
      46           2 :     Node* b = m.IntPtrConstant(1);
      47           2 :     Node* z = m.IntPtrMax(a, b);
      48           4 :     EXPECT_THAT(z, c::IsIntPtrConstant(100));
      49             :   }
      50           1 : }
      51             : 
      52       15444 : TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMin) {
      53           1 :   CodeStubAssemblerTestState state(this);
      54             :   CodeStubAssemblerForTest m(&state);
      55             :   {
      56           2 :     Node* a = m.IntPtrConstant(100);
      57           2 :     Node* b = m.IntPtrConstant(1);
      58           2 :     Node* z = m.IntPtrMin(a, b);
      59           4 :     EXPECT_THAT(z, c::IsIntPtrConstant(1));
      60             :   }
      61           1 : }
      62             : 
      63             : }  // namespace internal
      64        9264 : }  // namespace v8

Generated by: LCOV version 1.10