LCOV - code coverage report
Current view: top level - src/interpreter - bytecode-flags.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 28 28 100.0 %
Date: 2017-10-20 Functions: 7 7 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             : #include "src/interpreter/bytecode-flags.h"
       6             : 
       7             : #include "src/ast/ast-value-factory.h"
       8             : #include "src/ast/ast.h"
       9             : #include "src/builtins/builtins-constructor.h"
      10             : #include "src/code-stubs.h"
      11             : #include "src/objects-inl.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : namespace interpreter {
      16             : 
      17             : // static
      18      111459 : uint8_t CreateArrayLiteralFlags::Encode(bool use_fast_shallow_clone,
      19             :                                         int runtime_flags) {
      20             :   uint8_t result = FlagsBits::encode(runtime_flags);
      21      111459 :   result |= FastCloneSupportedBit::encode(use_fast_shallow_clone);
      22      111459 :   return result;
      23             : }
      24             : 
      25             : // static
      26      263561 : uint8_t CreateObjectLiteralFlags::Encode(int runtime_flags,
      27             :                                          bool fast_clone_supported) {
      28             :   uint8_t result = FlagsBits::encode(runtime_flags);
      29      263561 :   result |= FastCloneSupportedBit::encode(fast_clone_supported);
      30      263561 :   return result;
      31             : }
      32             : 
      33             : // static
      34     3968317 : uint8_t CreateClosureFlags::Encode(bool pretenure, bool is_function_scope) {
      35             :   uint8_t result = PretenuredBit::encode(pretenure);
      36     3968317 :   if (!FLAG_always_opt && !FLAG_prepare_always_opt &&
      37     2692411 :       pretenure == NOT_TENURED && is_function_scope) {
      38     1250349 :     result |= FastNewClosureBit::encode(true);
      39             :   }
      40     3968317 :   return result;
      41             : }
      42             : 
      43             : // static
      44      145602 : TestTypeOfFlags::LiteralFlag TestTypeOfFlags::GetFlagForLiteral(
      45      794765 :     const AstStringConstants* ast_constants, Literal* literal) {
      46      145602 :   const AstRawString* raw_literal = literal->raw_value()->AsString();
      47      145602 :   if (raw_literal == ast_constants->number_string()) {
      48             :     return LiteralFlag::kNumber;
      49      107307 :   } else if (raw_literal == ast_constants->string_string()) {
      50             :     return LiteralFlag::kString;
      51       95616 :   } else if (raw_literal == ast_constants->symbol_string()) {
      52             :     return LiteralFlag::kSymbol;
      53       94987 :   } else if (raw_literal == ast_constants->boolean_string()) {
      54             :     return LiteralFlag::kBoolean;
      55       94252 :   } else if (raw_literal == ast_constants->undefined_string()) {
      56             :     return LiteralFlag::kUndefined;
      57       87702 :   } else if (raw_literal == ast_constants->function_string()) {
      58             :     return LiteralFlag::kFunction;
      59       23697 :   } else if (raw_literal == ast_constants->object_string()) {
      60             :     return LiteralFlag::kObject;
      61             :   } else {
      62         228 :     return LiteralFlag::kOther;
      63             :   }
      64             : }
      65             : 
      66             : // static
      67      145417 : uint8_t TestTypeOfFlags::Encode(LiteralFlag literal_flag) {
      68      145417 :   return static_cast<uint8_t>(literal_flag);
      69             : }
      70             : 
      71             : // static
      72       34405 : TestTypeOfFlags::LiteralFlag TestTypeOfFlags::Decode(uint8_t raw_flag) {
      73             :   DCHECK_LE(raw_flag, static_cast<uint8_t>(LiteralFlag::kOther));
      74       34405 :   return static_cast<LiteralFlag>(raw_flag);
      75             : }
      76             : 
      77             : // static
      78       30941 : uint8_t StoreLookupSlotFlags::Encode(LanguageMode language_mode,
      79             :                                      LookupHoistingMode lookup_hoisting_mode) {
      80             :   DCHECK_IMPLIES(lookup_hoisting_mode == LookupHoistingMode::kLegacySloppy,
      81             :                  language_mode == LanguageMode::kSloppy);
      82             :   return LanguageModeBit::encode(language_mode) |
      83       61882 :          LookupHoistingModeBit::encode(static_cast<bool>(lookup_hoisting_mode));
      84             : }
      85             : 
      86             : }  // namespace interpreter
      87             : }  // namespace internal
      88             : }  // namespace v8

Generated by: LCOV version 1.10