LCOV - code coverage report
Current view: top level - src/ast - variables.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 6 6 100.0 %
Date: 2017-04-26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2011 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/ast/variables.h"
       6             : 
       7             : #include "src/ast/scopes.h"
       8             : #include "src/globals.h"
       9             : #include "src/objects-inl.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14             : // ----------------------------------------------------------------------------
      15             : // Implementation Variable.
      16             : 
      17    64529557 : Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
      18             :                    VariableKind kind, InitializationFlag initialization_flag,
      19             :                    MaybeAssignedFlag maybe_assigned_flag)
      20             :     : scope_(scope),
      21             :       name_(name),
      22             :       local_if_not_shadowed_(nullptr),
      23             :       next_(nullptr),
      24             :       index_(-1),
      25             :       initializer_position_(kNoSourcePosition),
      26             :       bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) |
      27             :                  InitializationFlagField::encode(initialization_flag) |
      28             :                  VariableModeField::encode(mode) | IsUsedField::encode(false) |
      29             :                  ForceContextAllocationField::encode(false) |
      30             :                  LocationField::encode(VariableLocation::UNALLOCATED) |
      31   258118228 :                  VariableKindField::encode(kind)) {
      32             :   // Var declared variables never need initialization.
      33             :   DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
      34    64529557 : }
      35             : 
      36             : 
      37    62440593 : bool Variable::IsGlobalObjectProperty() const {
      38             :   // Temporaries are never global, they must always be allocated in the
      39             :   // activation frame.
      40   106316808 :   return (IsDynamicVariableMode(mode()) || mode() == VAR) &&
      41   151509164 :          scope_ != nullptr && scope_->is_script_scope();
      42             : }
      43             : 
      44             : }  // namespace internal
      45             : }  // namespace v8

Generated by: LCOV version 1.10