LCOV - code coverage report
Current view: top level - js/src/vm - StringObject-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 12 15 80.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.0 %
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_StringObject_inl_h
       8             : #define vm_StringObject_inl_h
       9             : 
      10             : #include "vm/StringObject.h"
      11             : 
      12             : #include "jsobjinlines.h"
      13             : 
      14             : #include "vm/Shape-inl.h"
      15             : 
      16             : namespace js {
      17             : 
      18             : /* static */ inline bool
      19          49 : StringObject::init(JSContext* cx, Handle<StringObject*> obj, HandleString str)
      20             : {
      21          49 :     MOZ_ASSERT(obj->numFixedSlots() == 2);
      22             : 
      23          49 :     if (!EmptyShape::ensureInitialCustomShape<StringObject>(cx, obj))
      24           0 :         return false;
      25             : 
      26          49 :     MOZ_ASSERT(obj->lookup(cx, NameToId(cx->names().length))->slot() == LENGTH_SLOT);
      27             : 
      28          49 :     obj->setStringThis(str);
      29             : 
      30          49 :     return true;
      31             : }
      32             : 
      33             : /* static */ inline StringObject*
      34           1 : StringObject::create(JSContext* cx, HandleString str, HandleObject proto, NewObjectKind newKind)
      35             : {
      36           1 :     JSObject* obj = NewObjectWithClassProto(cx, &class_, proto, newKind);
      37           1 :     if (!obj)
      38           0 :         return nullptr;
      39           2 :     Rooted<StringObject*> strobj(cx, &obj->as<StringObject>());
      40           1 :     if (!StringObject::init(cx, strobj, str))
      41           0 :         return nullptr;
      42           1 :     return strobj;
      43             : }
      44             : 
      45             : } // namespace js
      46             : 
      47             : #endif /* vm_StringObject_inl_h */

Generated by: LCOV version 1.13