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

          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 "include/v8.h"
       6             : 
       7             : #include "src/handles-inl.h"
       8             : #include "src/isolate.h"
       9             : #include "test/cctest/cctest.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : namespace test_factory {
      14             : 
      15       28342 : TEST(Factory_NewCode) {
      16           5 :   LocalContext env;
      17           5 :   v8::Isolate* isolate = env->GetIsolate();
      18             :   Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate);
      19             :   HandleScope scope(i_isolate);
      20             : 
      21             :   // Create a big function that ends up in CODE_LO_SPACE.
      22             :   const int instruction_size = kMaxRegularHeapObjectSize + 1;
      23           5 :   std::unique_ptr<byte[]> instructions(new byte[instruction_size]);
      24             : 
      25           5 :   CodeDesc desc;
      26           5 :   desc.buffer = instructions.get();
      27           5 :   desc.buffer_size = instruction_size;
      28           5 :   desc.instr_size = instruction_size;
      29             :   desc.reloc_size = 0;
      30             :   desc.constant_pool_size = 0;
      31             :   desc.unwinding_info = nullptr;
      32             :   desc.unwinding_info_size = 0;
      33             :   desc.origin = nullptr;
      34             :   Handle<Object> self_ref;
      35             :   Handle<Code> code =
      36           5 :       i_isolate->factory()->NewCode(desc, Code::WASM_FUNCTION, self_ref);
      37             : 
      38          10 :   CHECK(i_isolate->heap()->InSpace(*code, CODE_LO_SPACE));
      39             : #if VERIFY_HEAP
      40             :   code->ObjectVerify(i_isolate);
      41             : #endif
      42           5 : }
      43             : 
      44             : }  // namespace test_factory
      45             : }  // namespace internal
      46       85011 : }  // namespace v8

Generated by: LCOV version 1.10