LCOV - code coverage report
Current view: top level - test/cctest/compiler - test-run-unwinding-info.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 8 8 100.0 %
Date: 2019-01-20 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright 2016 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             : // Test enabled only on supported architectures.
       6             : #if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM) || \
       7             :     defined(V8_TARGET_ARCH_ARM64)
       8             : 
       9             : #include "src/flags.h"
      10             : #include "src/objects-inl.h"
      11             : #include "src/objects.h"
      12             : #include "test/cctest/compiler/function-tester.h"
      13             : 
      14             : namespace v8 {
      15             : namespace internal {
      16             : namespace compiler {
      17             : 
      18       28342 : TEST(RunUnwindingInfo) {
      19           5 :   FLAG_always_opt = true;
      20           5 :   FLAG_perf_prof_unwinding_info = true;
      21             : 
      22             :   FunctionTester tester(
      23             :       "(function (x) {\n"
      24             :       "  function f(x) { return x*x; }\n"
      25             :       "  return x > 0 ? x+1 : f(x);\n"
      26           5 :       "})");
      27             : 
      28           5 :   tester.Call(tester.Val(-1));
      29             : 
      30          10 :   CHECK(tester.function->code()->has_unwinding_info());
      31           5 : }
      32             : 
      33             : // TODO(ssanfilippo) Build low-level graph and check that state is correctly
      34             : // restored in the following situation:
      35             : //
      36             : //                         +-----------------+
      37             : //                         |     no frame    |---+
      38             : //  check that a           +-----------------+   |
      39             : //  a noframe state        | construct frame |<--+
      40             : //  is restored here  -->  +-----------------+   |
      41             : //                         | construct frame |<--+
      42             : //                         +-----------------+
      43             : //
      44             : // Same for <construct>/<destruct>/<destruct> (a <construct> status is restored)
      45             : 
      46             : // TODO(ssanfilippo) Intentionally reach a BB with different initial states
      47             : // and check that the UnwindingInforWriter fails in debug mode:
      48             : //
      49             : //      +----------------+
      50             : //  +---|     State A    |
      51             : //  |   +----------------+
      52             : //  |   |  State B != A  |---+
      53             : //  |   +----------------+   |
      54             : //  +-->|  Failure here  |<--+
      55             : //      +----------------+
      56             : 
      57             : }  // namespace compiler
      58             : }  // namespace internal
      59       85011 : }  // namespace v8
      60             : 
      61             : #endif

Generated by: LCOV version 1.10