Bug 1438126 part 1 - Make CodeKind an enum class. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 15 Feb 2018 12:36:59 +0100
changeset 403925 bdeae8c5eeb9f1d5c75e1677dd7825e7adb9e291
parent 403924 4697cdd9969f81a4da170f6b89ecbe549b06f6ca
child 403926 303215766a6fb28fc64da9317bc690af824cd1a6
push id99887
push userjandemooij@gmail.com
push dateThu, 15 Feb 2018 11:37:48 +0000
treeherdermozilla-inbound@515a82d2ec7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1438126
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1438126 part 1 - Make CodeKind an enum class. r=tcampbell
js/src/gdb/tests/test-ExecutableAllocator.cpp
js/src/irregexp/NativeRegExpMacroAssembler.cpp
js/src/jit/BaselineCacheIRCompiler.cpp
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineDebugModeOSR.cpp
js/src/jit/CodeGenerator.cpp
js/src/jit/ExecutableAllocator.cpp
js/src/jit/ExecutableAllocator.h
js/src/jit/Ion.cpp
js/src/jit/IonCacheIRCompiler.cpp
js/src/jit/IonCode.h
js/src/jit/Linker.cpp
js/src/jit/SharedIC.cpp
js/src/jit/arm/Trampoline-arm.cpp
js/src/jit/arm64/Trampoline-arm64.cpp
js/src/jit/mips32/Trampoline-mips32.cpp
js/src/jit/mips64/Trampoline-mips64.cpp
js/src/jit/x64/Trampoline-x64.cpp
js/src/jit/x86/Trampoline-x86.cpp
js/src/jsapi-tests/testJitMacroAssembler.cpp
js/src/jsapi-tests/testJitMoveEmitterCycles-mips32.cpp
js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
js/src/vm/UnboxedObject.cpp
--- a/js/src/gdb/tests/test-ExecutableAllocator.cpp
+++ b/js/src/gdb/tests/test-ExecutableAllocator.cpp
@@ -12,32 +12,32 @@ FRAGMENT(ExecutableAllocator, empty) {
 
     (void) execAlloc;
 }
 
 FRAGMENT(ExecutableAllocator, onepool) {
     using namespace js::jit;
     ExecutablePool* pool = nullptr;
     ExecutableAllocator execAlloc(cx->runtime());
-    execAlloc.alloc(cx, 16 * 1024, &pool, BASELINE_CODE);
+    execAlloc.alloc(cx, 16 * 1024, &pool, CodeKind::Baseline);
 
     breakpoint();
 
     (void) pool;
     (void) execAlloc;
 }
 
 FRAGMENT(ExecutableAllocator, twopools) {
     using namespace js::jit;
     ExecutablePool* init = nullptr;
     ExecutablePool* pool = nullptr;
     ExecutableAllocator execAlloc(cx->runtime());
 
-    execAlloc.alloc(cx, 16 * 1024, &init, BASELINE_CODE);
+    execAlloc.alloc(cx, 16 * 1024, &init, CodeKind::Baseline);
 
     do { // Keep allocating until we get a second pool.
-        execAlloc.alloc(cx, 32 * 1024, &pool, ION_CODE);
+        execAlloc.alloc(cx, 32 * 1024, &pool, CodeKind::Ion);
     } while (pool == init);
 
     breakpoint();
 
     (void) execAlloc;
 }
--- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp
+++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp
@@ -486,17 +486,17 @@ NativeRegExpMacroAssembler::GenerateCode
 
         // Exit with an error result to signal thrown exception.
         masm.movePtr(ImmWord(RegExpRunStatus_Error), temp0);
         masm.jump(&return_temp0);
     }
 
     Linker linker(masm);
     AutoFlushICache afc("RegExp");
-    JitCode* code = linker.newCode<NoGC>(cx, REGEXP_CODE);
+    JitCode* code = linker.newCode<NoGC>(cx, CodeKind::RegExp);
     if (!code) {
         ReportOutOfMemory(cx);
         return RegExpCode();
     }
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "RegExp");
 #endif
--- a/js/src/jit/BaselineCacheIRCompiler.cpp
+++ b/js/src/jit/BaselineCacheIRCompiler.cpp
@@ -193,17 +193,17 @@ BaselineCacheIRCompiler::compile()
     for (size_t i = 0; i < failurePaths.length(); i++) {
         if (!emitFailurePath(i))
             return nullptr;
         EmitStubGuardFailure(masm);
     }
 
     Linker linker(masm);
     AutoFlushICache afc("getStubCode");
-    Rooted<JitCode*> newStubCode(cx_, linker.newCode<NoGC>(cx_, BASELINE_CODE));
+    Rooted<JitCode*> newStubCode(cx_, linker.newCode<NoGC>(cx_, CodeKind::Baseline));
     if (!newStubCode) {
         cx_->recoverFromOutOfMemory();
         return nullptr;
     }
 
     return newStubCode;
 }
 
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -129,17 +129,17 @@ BaselineCompiler::compile()
 
     Linker linker(masm);
     if (masm.oom()) {
         ReportOutOfMemory(cx);
         return Method_Error;
     }
 
     AutoFlushICache afc("Baseline");
-    JitCode* code = linker.newCode<CanGC>(cx, BASELINE_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Baseline);
     if (!code)
         return Method_Error;
 
     Rooted<EnvironmentObject*> templateEnv(cx);
     if (script->functionNonDelazifying()) {
         RootedFunction fun(cx, script->functionNonDelazifying());
 
         if (fun->needsNamedLambdaEnvironment()) {
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -1167,17 +1167,17 @@ JitRuntime::generateBaselineDebugModeOSR
     EmitBaselineDebugModeOSRHandlerTail(masm, temp, /* returnFromCallVM = */ false);
     masm.jump(&end);
     masm.bind(&returnFromCallVM);
     EmitBaselineDebugModeOSRHandlerTail(masm, temp, /* returnFromCallVM = */ true);
     masm.bind(&end);
 
     Linker linker(masm);
     AutoFlushICache afc("BaselineDebugModeOSRHandler");
-    JitCode* code = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<NoGC>(cx, CodeKind::Other);
     if (!code)
         return nullptr;
 
     *noFrameRegPopOffsetOut = noFrameRegPopOffset.offset();
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "BaselineDebugModeOSRHandler");
 #endif
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -2069,17 +2069,17 @@ JitCompartment::generateRegExpMatcherStu
 
     // Use an undefined value to signal to the caller that the OOL stub needs to be called.
     masm.bind(&oolEntry);
     masm.moveValue(UndefinedValue(), result);
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("RegExpMatcherStub");
-    JitCode* code = linker.newCode<CanGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Other);
     if (!code)
         return nullptr;
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "RegExpMatcherStub");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(code, "RegExpMatcherStub");
@@ -2226,17 +2226,17 @@ JitCompartment::generateRegExpSearcherSt
     masm.ret();
 
     masm.bind(&oolEntry);
     masm.move32(Imm32(RegExpSearcherResultFailed), result);
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("RegExpSearcherStub");
-    JitCode* code = linker.newCode<CanGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Other);
     if (!code)
         return nullptr;
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "RegExpSearcherStub");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(code, "RegExpSearcherStub");
@@ -2374,17 +2374,17 @@ JitCompartment::generateRegExpTesterStub
     masm.move32(Imm32(RegExpTesterResultFailed), result);
 
     masm.bind(&done);
     masm.freeStack(sizeof(irregexp::InputOutputData));
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("RegExpTesterStub");
-    JitCode* code = linker.newCode<CanGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Other);
     if (!code)
         return nullptr;
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "RegExpTesterStub");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(code, "RegExpTesterStub");
@@ -8243,17 +8243,17 @@ JitCompartment::generateStringConcatStub
     masm.pop(temp1);
 
     masm.bind(&failure);
     masm.movePtr(ImmPtr(nullptr), output);
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("StringConcatStub");
-    JitCode* code = linker.newCode<CanGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(code, "StringConcatStub");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(code, "StringConcatStub");
 #endif
 
@@ -10061,17 +10061,17 @@ CodeGenerator::link(JSContext* cx, Compi
         js_free(ionScript);
     });
 
     // Also, note that creating the code here during an incremental GC will
     // trace the code and mark all GC things it refers to. This captures any
     // read barriers which were skipped while compiling the script off thread.
     Linker linker(masm);
     AutoFlushICache afc("IonLink");
-    JitCode* code = linker.newCode<NoGC>(cx, ION_CODE, !patchableBackedges_.empty());
+    JitCode* code = linker.newCode<NoGC>(cx, CodeKind::Ion, !patchableBackedges_.empty());
     if (!code)
         return false;
 
     // Encode native to bytecode map if profiling is enabled.
     if (isProfilerInstrumentationEnabled()) {
         // Generate native-to-bytecode main table.
         if (!generateCompactNativeToBytecodeMap(cx, code))
             return false;
--- a/js/src/jit/ExecutableAllocator.cpp
+++ b/js/src/jit/ExecutableAllocator.cpp
@@ -52,29 +52,29 @@ ExecutablePool::release(bool willDestroy
     if (--m_refCount == 0)
         js_delete(this);
 }
 
 void
 ExecutablePool::release(size_t n, CodeKind kind)
 {
     switch (kind) {
-      case ION_CODE:
+      case CodeKind::Ion:
         m_ionCodeBytes -= n;
         MOZ_ASSERT(m_ionCodeBytes < m_allocation.size); // Shouldn't underflow.
         break;
-      case BASELINE_CODE:
+      case CodeKind::Baseline:
         m_baselineCodeBytes -= n;
         MOZ_ASSERT(m_baselineCodeBytes < m_allocation.size);
         break;
-      case REGEXP_CODE:
+      case CodeKind::RegExp:
         m_regexpCodeBytes -= n;
         MOZ_ASSERT(m_regexpCodeBytes < m_allocation.size);
         break;
-      case OTHER_CODE:
+      case CodeKind::Other:
         m_otherCodeBytes -= n;
         MOZ_ASSERT(m_otherCodeBytes < m_allocation.size);
         break;
       default:
         MOZ_CRASH("bad code kind");
     }
 
     release();
@@ -94,21 +94,21 @@ ExecutablePool::addRef()
 void*
 ExecutablePool::alloc(size_t n, CodeKind kind)
 {
     MOZ_ASSERT(n <= available());
     void* result = m_freePtr;
     m_freePtr += n;
 
     switch (kind) {
-      case ION_CODE:      m_ionCodeBytes      += n;        break;
-      case BASELINE_CODE: m_baselineCodeBytes += n;        break;
-      case REGEXP_CODE:   m_regexpCodeBytes   += n;        break;
-      case OTHER_CODE:    m_otherCodeBytes    += n;        break;
-      default:            MOZ_CRASH("bad code kind");
+      case CodeKind::Ion:      m_ionCodeBytes      += n; break;
+      case CodeKind::Baseline: m_baselineCodeBytes += n; break;
+      case CodeKind::RegExp:   m_regexpCodeBytes   += n; break;
+      case CodeKind::Other:    m_otherCodeBytes    += n; break;
+      default: MOZ_CRASH("bad code kind");
     }
 
     return result;
 }
 
 size_t
 ExecutablePool::available() const
 {
--- a/js/src/jit/ExecutableAllocator.h
+++ b/js/src/jit/ExecutableAllocator.h
@@ -78,17 +78,22 @@ extern  "C" void sync_instruction_memory
 
 namespace JS {
     struct CodeSizes;
 } // namespace JS
 
 namespace js {
 namespace jit {
 
-enum CodeKind { ION_CODE = 0, BASELINE_CODE, REGEXP_CODE, OTHER_CODE };
+enum class CodeKind : uint8_t {
+    Ion,
+    Baseline,
+    RegExp,
+    Other
+};
 
 class ExecutableAllocator;
 class JitRuntime;
 
 // These are reference-counted. A new one starts with a count of 1.
 class ExecutablePool
 {
     friend class ExecutableAllocator;
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -334,17 +334,17 @@ JitRuntime::initialize(JSContext* cx, Au
     generateProfilerExitFrameTailStub(masm, &profilerExitTail);
 
     JitSpew(JitSpew_Codegen, "# Emitting exception tail stub");
     void* handler = JS_FUNC_TO_DATA_PTR(void*, jit::HandleException);
     generateExceptionTailStub(masm, handler, &profilerExitTail);
 
     Linker linker(masm);
     AutoFlushICache afc("Trampolines");
-    trampolineCode_ = linker.newCode<NoGC>(cx, OTHER_CODE);
+    trampolineCode_ = linker.newCode<NoGC>(cx, CodeKind::Other);
     if (!trampolineCode_)
         return false;
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(trampolineCode_, "Trampolines");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(trampolineCode_, "Trampolines");
--- a/js/src/jit/IonCacheIRCompiler.cpp
+++ b/js/src/jit/IonCacheIRCompiler.cpp
@@ -596,17 +596,17 @@ IonCacheIRCompiler::compile()
         CodeOffset offset = masm.movWithPatch(ImmWord(-1), scratch);
         masm.jump(Address(scratch, 0));
         if (!nextCodeOffsets_.append(offset))
             return nullptr;
     }
 
     Linker linker(masm);
     AutoFlushICache afc("getStubCode");
-    Rooted<JitCode*> newStubCode(cx_, linker.newCode<NoGC>(cx_, ION_CODE));
+    Rooted<JitCode*> newStubCode(cx_, linker.newCode<NoGC>(cx_, CodeKind::Ion));
     if (!newStubCode) {
         cx_->recoverFromOutOfMemory();
         return nullptr;
     }
 
     rejoinOffset_.fixup(&masm);
     CodeLocationJump rejoinJump(newStubCode, rejoinOffset_);
     PatchJump(rejoinJump, ic_->rejoinLabel());
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -79,17 +79,17 @@ class JitCode : public gc::TenuredCell
       : code_(code),
         pool_(pool),
         bufferSize_(bufferSize),
         insnSize_(0),
         dataSize_(0),
         jumpRelocTableBytes_(0),
         dataRelocTableBytes_(0),
         headerSize_(headerSize),
-        kind_(kind),
+        kind_(uint8_t(kind)),
         invalidated_(false),
         hasBytecodeMap_(false)
     {
         MOZ_ASSERT(CodeKind(kind_) == kind);
         MOZ_ASSERT(headerSize_ == headerSize);
     }
 
     uint32_t dataOffset() const {
--- a/js/src/jit/Linker.cpp
+++ b/js/src/jit/Linker.cpp
@@ -12,17 +12,17 @@
 
 namespace js {
 namespace jit {
 
 template <AllowGC allowGC>
 JitCode*
 Linker::newCode(JSContext* cx, CodeKind kind, bool hasPatchableBackedges /* = false */)
 {
-    MOZ_ASSERT_IF(hasPatchableBackedges, kind == ION_CODE);
+    MOZ_ASSERT_IF(hasPatchableBackedges, kind == CodeKind::Ion);
 
     gc::AutoSuppressGC suppressGC(cx);
     if (masm.oom())
         return fail(cx);
 
     static const size_t ExecutableAllocatorAlignment = sizeof(void*);
     static_assert(CodeAlignment >= ExecutableAllocatorAlignment,
                   "Unexpected alignment requirements");
--- a/js/src/jit/SharedIC.cpp
+++ b/js/src/jit/SharedIC.cpp
@@ -514,17 +514,17 @@ ICStubCompiler::getStubCode()
 #ifdef JS_CODEGEN_ARM
     masm.setSecondScratchReg(BaselineSecondScratchReg);
 #endif
 
     if (!generateStubCode(masm))
         return nullptr;
     Linker linker(masm);
     AutoFlushICache afc("getStubCode");
-    Rooted<JitCode*> newStubCode(cx, linker.newCode<CanGC>(cx, BASELINE_CODE));
+    Rooted<JitCode*> newStubCode(cx, linker.newCode<CanGC>(cx, CodeKind::Baseline));
     if (!newStubCode)
         return nullptr;
 
     // Cache newly compiled stubcode.
     if (!comp->putStubCode(cx, stubKey, newStubCode))
         return nullptr;
 
     // After generating code, run postGenerateStubCode().  We must not fail
@@ -2776,17 +2776,17 @@ GenerateNewObjectWithTemplateCode(JSCont
     masm.tagValue(JSVAL_TYPE_OBJECT, objReg, R0);
 
     EmitReturnFromIC(masm);
     masm.bind(&failure);
     EmitStubGuardFailure(masm);
 
     Linker linker(masm);
     AutoFlushICache afc("GenerateNewObjectWithTemplateCode");
-    return linker.newCode<CanGC>(cx, BASELINE_CODE);
+    return linker.newCode<CanGC>(cx, CodeKind::Baseline);
 }
 
 static bool
 DoNewObject(JSContext* cx, void* payload, ICNewObject_Fallback* stub, MutableHandleValue res)
 {
     SharedStubInfo info(cx, payload, stub->icEntry());
 
     FallbackICSpew(cx, stub, "NewObject");
--- a/js/src/jit/arm/Trampoline-arm.cpp
+++ b/js/src/jit/arm/Trampoline-arm.cpp
@@ -988,17 +988,17 @@ JitRuntime::generateDebugTrapHandler(JSC
         masm.profilerExitFrame();
         masm.bind(&skipProfilingInstrumentation);
     }
 
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("DebugTrapHandler");
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 
     return codeDbg;
 }
 
--- a/js/src/jit/arm64/Trampoline-arm64.cpp
+++ b/js/src/jit/arm64/Trampoline-arm64.cpp
@@ -804,17 +804,17 @@ JitRuntime::generateDebugTrapHandler(JSC
     masm.Mov(masm.GetStackPointer64(), BaselineFrameReg64);
 
     masm.pop(BaselineFrameReg, lr);
     masm.syncStackPtr();
     masm.abiret();
 
     Linker linker(masm);
     AutoFlushICache afc("DebugTrapHandler");
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 
     return codeDbg;
 }
 
--- a/js/src/jit/mips32/Trampoline-mips32.cpp
+++ b/js/src/jit/mips32/Trampoline-mips32.cpp
@@ -972,17 +972,17 @@ JitRuntime::generateDebugTrapHandler(JSC
         masm.profilerExitFrame();
         masm.bind(&skipProfilingInstrumentation);
     }
 
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("DebugTrapHandler");
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 
     return codeDbg;
 }
 
--- a/js/src/jit/mips64/Trampoline-mips64.cpp
+++ b/js/src/jit/mips64/Trampoline-mips64.cpp
@@ -924,17 +924,17 @@ JitRuntime::generateDebugTrapHandler(JSC
         masm.profilerExitFrame();
         masm.bind(&skipProfilingInstrumentation);
     }
 
     masm.ret();
 
     Linker linker(masm);
     AutoFlushICache afc("DebugTrapHandler");
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 
     return codeDbg;
 }
 
--- a/js/src/jit/x64/Trampoline-x64.cpp
+++ b/js/src/jit/x64/Trampoline-x64.cpp
@@ -878,17 +878,17 @@ JitRuntime::generateDebugTrapHandler(JSC
         masm.branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
         masm.profilerExitFrame();
         masm.bind(&skipProfilingInstrumentation);
     }
 
     masm.ret();
 
     Linker linker(masm);
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(codeDbg, "DebugTrapHandler");
 #endif
 
--- a/js/src/jit/x86/Trampoline-x86.cpp
+++ b/js/src/jit/x86/Trampoline-x86.cpp
@@ -899,17 +899,17 @@ JitRuntime::generateDebugTrapHandler(JSC
         masm.branch32(Assembler::Equal, addressOfEnabled, Imm32(0), &skipProfilingInstrumentation);
         masm.profilerExitFrame();
         masm.bind(&skipProfilingInstrumentation);
     }
 
     masm.ret();
 
     Linker linker(masm);
-    JitCode* codeDbg = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* codeDbg = linker.newCode<NoGC>(cx, CodeKind::Other);
 
 #ifdef JS_ION_PERF
     writePerfSpewerJitCodeProfile(codeDbg, "DebugTrapHandler");
 #endif
 #ifdef MOZ_VTUNE
     vtune::MarkStub(codeDbg, "DebugTrapHandler");
 #endif
 
--- a/js/src/jsapi-tests/testJitMacroAssembler.cpp
+++ b/js/src/jsapi-tests/testJitMacroAssembler.cpp
@@ -41,17 +41,17 @@ static bool Execute(JSContext* cx, Macro
     LiveRegisterSet save(regs.asLiveSet());
     masm.PopRegsInMask(save);
     masm.ret(); // Add return statement to be sure.
 
     if (masm.oom())
         return false;
 
     Linker linker(masm);
-    JitCode* code = linker.newCode<CanGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<CanGC>(cx, CodeKind::Other);
     if (!code)
         return false;
     if (!ExecutableAllocator::makeExecutable(code->raw(), code->bufferSize()))
         return false;
 
     EnterTest test = code->as<EnterTest>();
     test();
     return true;
--- a/js/src/jsapi-tests/testJitMoveEmitterCycles-mips32.cpp
+++ b/js/src/jsapi-tests/testJitMoveEmitterCycles-mips32.cpp
@@ -71,17 +71,17 @@ static constexpr js::jit::FloatRegister 
 
 static js::jit::JitCode*
 linkAndAllocate(JSContext* cx, js::jit::MacroAssembler* masm)
 {
     using namespace js;
     using namespace js::jit;
     AutoFlushICache afc("test");
     Linker l(*masm);
-    return l.newCode<CanGC>(cx, ION_CODE);
+    return l.newCode<CanGC>(cx, CodeKind::Ion);
 }
 
 #define TRY(x) if (!(x)) return false;
 
 BEGIN_TEST(testJitMoveEmitterCycles_simple)
 {
     using namespace js;
     using namespace js::jit;
--- a/js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
+++ b/js/src/jsapi-tests/testJitMoveEmitterCycles.cpp
@@ -55,17 +55,17 @@ static constexpr js::jit::FloatRegister 
 
 static js::jit::JitCode*
 linkAndAllocate(JSContext* cx, js::jit::MacroAssembler* masm)
 {
     using namespace js;
     using namespace js::jit;
     AutoFlushICache afc("test");
     Linker l(*masm);
-    return l.newCode<CanGC>(cx, ION_CODE);
+    return l.newCode<CanGC>(cx, CodeKind::Ion);
 }
 
 #define TRY(x) if (!(x)) return false;
 
 BEGIN_TEST(testJitMoveEmitterCycles_simple)
 {
     using namespace js;
     using namespace js::jit;
--- a/js/src/vm/UnboxedObject.cpp
+++ b/js/src/vm/UnboxedObject.cpp
@@ -264,17 +264,17 @@ UnboxedLayout::makeConstructorCode(JSCon
     // Initialize the object so it is safe for GC.
     masm.initUnboxedObjectContents(object, templateObject);
 
     masm.movePtr(ImmWord(CLEAR_CONSTRUCTOR_CODE_TOKEN), object);
     masm.jump(&done);
 
     Linker linker(masm);
     AutoFlushICache afc("UnboxedObject");
-    JitCode* code = linker.newCode<NoGC>(cx, OTHER_CODE);
+    JitCode* code = linker.newCode<NoGC>(cx, CodeKind::Other);
     if (!code)
         return false;
 
     layout.setConstructorCode(code);
     return true;
 }
 
 void