LCOV - code coverage report
Current view: top level - js/src/vm - ArgumentsObject-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 10 27 37.0 %
Date: 2017-07-14 16:53:18 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: set ts=8 sts=4 et sw=4 tw=99:
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef vm_ArgumentsObject_inl_h
       8             : #define vm_ArgumentsObject_inl_h
       9             : 
      10             : #include "vm/ArgumentsObject.h"
      11             : 
      12             : #include "vm/EnvironmentObject.h"
      13             : 
      14             : #include "jsscriptinlines.h"
      15             : 
      16             : #include "vm/EnvironmentObject-inl.h"
      17             : 
      18             : namespace js {
      19             : 
      20             : inline const Value&
      21         193 : ArgumentsObject::element(uint32_t i) const
      22             : {
      23         193 :     MOZ_ASSERT(!isElementDeleted(i));
      24         193 :     const Value& v = data()->args[i];
      25         193 :     if (IsMagicScopeSlotValue(v)) {
      26           0 :         CallObject& callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>();
      27           0 :         return callobj.aliasedFormalFromArguments(v);
      28             :     }
      29         193 :     return v;
      30             : }
      31             : 
      32             : inline void
      33          49 : ArgumentsObject::setElement(JSContext* cx, uint32_t i, const Value& v)
      34             : {
      35          49 :     MOZ_ASSERT(!isElementDeleted(i));
      36          49 :     GCPtrValue& lhs = data()->args[i];
      37          49 :     if (IsMagicScopeSlotValue(lhs)) {
      38           0 :         uint32_t slot = SlotFromMagicScopeSlotValue(lhs);
      39           0 :         CallObject& callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as<CallObject>();
      40           0 :         for (Shape::Range<NoGC> r(callobj.lastProperty()); !r.empty(); r.popFront()) {
      41           0 :             if (r.front().slot() == slot) {
      42           0 :                 callobj.setAliasedFormalFromArguments(cx, lhs, r.front().propid(), v);
      43           0 :                 return;
      44             :             }
      45             :         }
      46           0 :         MOZ_CRASH("Bad Arguments::setElement");
      47             :     }
      48          49 :     lhs = v;
      49             : }
      50             : 
      51             : inline bool
      52           0 : ArgumentsObject::maybeGetElements(uint32_t start, uint32_t count, Value* vp)
      53             : {
      54           0 :     MOZ_ASSERT(start + count >= start);
      55             : 
      56           0 :     uint32_t length = initialLength();
      57           0 :     if (start > length || start + count > length || isAnyElementDeleted())
      58           0 :         return false;
      59             : 
      60           0 :     for (uint32_t i = start, end = start + count; i < end; ++i, ++vp)
      61           0 :         *vp = element(i);
      62           0 :     return true;
      63             : }
      64             : 
      65             : } /* namespace js */
      66             : 
      67             : #endif /* vm_ArgumentsObject_inl_h */

Generated by: LCOV version 1.13