Debian Codegraph @

js/src/vm/Activation.cpp

raw
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/Activation-inl.h"
8
9 #include "mozilla/Assertions.h" // MOZ_ASSERT
10
11 #include "gc/GC.h" // js::gc::AutoSuppressGC
12 #include "jit/CalleeToken.h" // js::jit::CalleeToken{IsFunction,To{Function,Script}}
13 #include "js/RootingAPI.h" // JS::Rooted
14 #include "js/Value.h" // JS::Value
15 #include "vm/JSContext.h" // JSContext, js::TlsContext
16 #include "vm/Stack.h" // js::InterpreterFrame
17
18 #include "vm/Compartment-inl.h" // JS::Compartment::wrap
19
20 using namespace js;
21
22 using JS::ObjectOrNullValue;
23 using JS::Rooted;
24 using JS::UndefinedValue;
25 using JS::Value;
26
27 void Activation::registerProfiling() {
28 MOZ_ASSERT(isProfiling());
29 cx_->profilingActivation_ = this;
30 }
31
32 void Activation::unregisterProfiling() {
33 MOZ_ASSERT(isProfiling());
34 MOZ_ASSERT(cx_->profilingActivation_ == this);
35 cx_->profilingActivation_ = prevProfiling_;
36 }
37
38 ActivationIterator::ActivationIterator(JSContext* cx)
39 : activation_(cx->activation_) {
40 MOZ_ASSERT(cx == TlsContext.get());
41 }
42
43 ActivationIterator& ActivationIterator::operator++() {
44 MOZ_ASSERT(activation_);
45 activation_ = activation_->prev();
46 return *this;
47 }