tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TaggedProto.cpp (1235B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * vim: set ts=8 sts=2 et sw=2 tw=80:
      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 #include "vm/TaggedProto.h"
      8 
      9 #include "gc/Barrier.h"
     10 #include "vm/JSObject.h"
     11 
     12 namespace js {
     13 
     14 /* static */ void InternalBarrierMethods<TaggedProto>::preBarrier(
     15    TaggedProto& proto) {
     16  InternalBarrierMethods<JSObject*>::preBarrier(proto.toObjectOrNull());
     17 }
     18 
     19 /* static */ void InternalBarrierMethods<TaggedProto>::postBarrier(
     20    TaggedProto* vp, TaggedProto prev, TaggedProto next) {
     21  JSObject* prevObj = prev.isObject() ? prev.toObject() : nullptr;
     22  JSObject* nextObj = next.isObject() ? next.toObject() : nullptr;
     23  InternalBarrierMethods<JSObject*>::postBarrier(
     24      reinterpret_cast<JSObject**>(vp), prevObj, nextObj);
     25 }
     26 
     27 /* static */ void InternalBarrierMethods<TaggedProto>::readBarrier(
     28    const TaggedProto& proto) {
     29  InternalBarrierMethods<JSObject*>::readBarrier(proto.toObjectOrNull());
     30 }
     31 
     32 void TaggedProto::trace(JSTracer* trc) { TraceRoot(trc, this, "TaggedProto"); }
     33 
     34 }  // namespace js