Skip to content

Commit

Permalink
Bug 1833624 part 3 - Minor Realm and JitRealm changes. r=iain
Browse files Browse the repository at this point in the history
  • Loading branch information
jandem committed May 22, 2023
1 parent 93a1a8f commit 245d4e9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
37 changes: 25 additions & 12 deletions js/src/jit/JitRealm.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ class JitRealm {
return getStubNoBarrier(RegExpMatcher, requiredBarriersOut);
}

[[nodiscard]] bool ensureRegExpMatcherStubExists(JSContext* cx) {
if (stubs_[RegExpMatcher]) {
return true;
[[nodiscard]] JitCode* ensureRegExpMatcherStubExists(JSContext* cx) {
if (JitCode* code = stubs_[RegExpMatcher]) {
return code;
}
stubs_[RegExpMatcher] = generateRegExpMatcherStub(cx);
return stubs_[RegExpMatcher];
Expand All @@ -126,9 +126,9 @@ class JitRealm {
return getStubNoBarrier(RegExpSearcher, requiredBarriersOut);
}

[[nodiscard]] bool ensureRegExpSearcherStubExists(JSContext* cx) {
if (stubs_[RegExpSearcher]) {
return true;
[[nodiscard]] JitCode* ensureRegExpSearcherStubExists(JSContext* cx) {
if (JitCode* code = stubs_[RegExpSearcher]) {
return code;
}
stubs_[RegExpSearcher] = generateRegExpSearcherStub(cx);
return stubs_[RegExpSearcher];
Expand All @@ -138,9 +138,9 @@ class JitRealm {
return getStubNoBarrier(RegExpExecMatch, requiredBarriersOut);
}

[[nodiscard]] bool ensureRegExpExecMatchStubExists(JSContext* cx) {
if (stubs_[RegExpExecMatch]) {
return true;
[[nodiscard]] JitCode* ensureRegExpExecMatchStubExists(JSContext* cx) {
if (JitCode* code = stubs_[RegExpExecMatch]) {
return code;
}
stubs_[RegExpExecMatch] = generateRegExpExecMatchStub(cx);
return stubs_[RegExpExecMatch];
Expand All @@ -150,9 +150,9 @@ class JitRealm {
return getStubNoBarrier(RegExpExecTest, requiredBarriersOut);
}

[[nodiscard]] bool ensureRegExpExecTestStubExists(JSContext* cx) {
if (stubs_[RegExpExecTest]) {
return true;
[[nodiscard]] JitCode* ensureRegExpExecTestStubExists(JSContext* cx) {
if (JitCode* code = stubs_[RegExpExecTest]) {
return code;
}
stubs_[RegExpExecTest] = generateRegExpExecTestStub(cx);
return stubs_[RegExpExecTest];
Expand All @@ -167,6 +167,19 @@ class JitRealm {
void performStubReadBarriers(uint32_t stubsToBarrier) const;

size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;

static constexpr size_t offsetOfRegExpMatcherStub() {
return offsetof(JitRealm, stubs_) + RegExpMatcher * sizeof(uintptr_t);
}
static constexpr size_t offsetOfRegExpSearcherStub() {
return offsetof(JitRealm, stubs_) + RegExpSearcher * sizeof(uintptr_t);
}
static constexpr size_t offsetOfRegExpExecMatchStub() {
return offsetof(JitRealm, stubs_) + RegExpExecMatch * sizeof(uintptr_t);
}
static constexpr size_t offsetOfRegExpExecTestStub() {
return offsetof(JitRealm, stubs_) + RegExpExecTest * sizeof(uintptr_t);
}
};

} // namespace jit
Expand Down
3 changes: 3 additions & 0 deletions js/src/vm/Realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ class JS::Realm : public JS::shadow::Realm {
static constexpr size_t offsetOfRegExps() {
return offsetof(JS::Realm, regExps);
}
static constexpr size_t offsetOfJitRealm() {
return offsetof(JS::Realm, jitRealm_);
}
static constexpr size_t offsetOfDebugModeBits() {
return offsetof(JS::Realm, debugModeBits_);
}
Expand Down

0 comments on commit 245d4e9

Please sign in to comment.