Bug 1639153 - Part 6.2: Establish dependency from tls for x86 callWithABI div/mod...
[gecko.git] / js / src / jit / BaselineFrame-inl.h
blobe91c21e0a5d3fb99eb6c1eb32d14c4bda9d1de3d
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/. */
7 #ifndef jit_BaselineFrame_inl_h
8 #define jit_BaselineFrame_inl_h
10 #include "jit/BaselineFrame.h"
12 #include "vm/EnvironmentObject.h"
13 #include "vm/JSContext.h"
14 #include "vm/Realm.h"
16 #include "vm/EnvironmentObject-inl.h"
17 #include "vm/JSScript-inl.h"
19 namespace js {
20 namespace jit {
22 template <typename SpecificEnvironment>
23 inline void BaselineFrame::pushOnEnvironmentChain(SpecificEnvironment& env) {
24 MOZ_ASSERT(*environmentChain() == env.enclosingEnvironment());
25 envChain_ = &env;
26 if (IsFrameInitialEnvironment(this, env)) {
27 flags_ |= HAS_INITIAL_ENV;
31 template <typename SpecificEnvironment>
32 inline void BaselineFrame::popOffEnvironmentChain() {
33 MOZ_ASSERT(envChain_->is<SpecificEnvironment>());
34 envChain_ = &envChain_->as<SpecificEnvironment>().enclosingEnvironment();
37 inline void BaselineFrame::replaceInnermostEnvironment(EnvironmentObject& env) {
38 MOZ_ASSERT(env.enclosingEnvironment() ==
39 envChain_->as<EnvironmentObject>().enclosingEnvironment());
40 envChain_ = &env;
43 inline bool BaselineFrame::pushLexicalEnvironment(JSContext* cx,
44 Handle<LexicalScope*> scope) {
45 LexicalEnvironmentObject* env =
46 LexicalEnvironmentObject::createForFrame(cx, scope, this);
47 if (!env) {
48 return false;
50 pushOnEnvironmentChain(*env);
52 return true;
55 inline bool BaselineFrame::freshenLexicalEnvironment(JSContext* cx) {
56 Rooted<LexicalEnvironmentObject*> current(
57 cx, &envChain_->as<LexicalEnvironmentObject>());
58 LexicalEnvironmentObject* clone =
59 LexicalEnvironmentObject::clone(cx, current);
60 if (!clone) {
61 return false;
64 replaceInnermostEnvironment(*clone);
65 return true;
68 inline bool BaselineFrame::recreateLexicalEnvironment(JSContext* cx) {
69 Rooted<LexicalEnvironmentObject*> current(
70 cx, &envChain_->as<LexicalEnvironmentObject>());
71 LexicalEnvironmentObject* clone =
72 LexicalEnvironmentObject::recreate(cx, current);
73 if (!clone) {
74 return false;
77 replaceInnermostEnvironment(*clone);
78 return true;
81 inline CallObject& BaselineFrame::callObj() const {
82 MOZ_ASSERT(hasInitialEnvironment());
83 MOZ_ASSERT(callee()->needsCallObject());
85 JSObject* obj = environmentChain();
86 while (!obj->is<CallObject>()) {
87 obj = obj->enclosingEnvironment();
89 return obj->as<CallObject>();
92 inline ICScript* BaselineFrame::icScript() const {
93 if (JitOptions.warpBuilder) {
94 return icScript_;
96 return script()->jitScript()->icScript();
99 inline JSScript* BaselineFrame::invalidationScript() const {
100 if (!icScript()->isInlined()) {
101 return script();
103 return icScript()->inliningRoot()->owningScript();
106 inline void BaselineFrame::unsetIsDebuggee() {
107 MOZ_ASSERT(!script()->isDebuggee());
108 flags_ &= ~DEBUGGEE;
111 } // namespace jit
112 } // namespace js
114 #endif /* jit_BaselineFrame_inl_h */