Bug 1130708 - Remove js::types namespace, r=jandem.
authorBrian Hackett <bhackett1024@gmail.com>
Sun, 08 Feb 2015 06:01:13 -0700
changeset 255168 ee3bc49e9cf5680bce2d1fdaae81ace16fa64377
parent 255167 7accb67a2e6f7e5021686604b984f8ddd1a63aa4
child 255169 603b98af7463f9435eca3216814e690f544230af
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1130708
milestone38.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 1130708 - Remove js::types namespace, r=jandem.
js/src/asmjs/AsmJSModule.cpp
js/src/builtin/Object.cpp
js/src/builtin/RegExp.cpp
js/src/builtin/TypedObject.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/FoldConstants.cpp
js/src/gc/GCTrace.cpp
js/src/gc/Marking.cpp
js/src/gc/Marking.h
js/src/gc/RootMarking.cpp
js/src/gc/Zone.cpp
js/src/gc/Zone.h
js/src/jit/BaselineCompiler.cpp
js/src/jit/BaselineDebugModeOSR.cpp
js/src/jit/BaselineIC.cpp
js/src/jit/CodeGenerator.cpp
js/src/jit/CodeGenerator.h
js/src/jit/Ion.cpp
js/src/jit/Ion.h
js/src/jit/IonAnalysis.cpp
js/src/jit/IonAnalysis.h
js/src/jit/IonBuilder.cpp
js/src/jit/IonBuilder.h
js/src/jit/IonCaches.cpp
js/src/jit/IonCode.h
js/src/jit/JitFrames.cpp
js/src/jit/Lowering.cpp
js/src/jit/MCallOptimize.cpp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/MacroAssembler.cpp
js/src/jit/MacroAssembler.h
js/src/jit/OptimizationTracking.cpp
js/src/jit/OptimizationTracking.h
js/src/jit/VMFunctions.cpp
js/src/jit/shared/CodeGenerator-shared.cpp
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsbool.cpp
js/src/jscntxt.cpp
js/src/jsdate.cpp
js/src/jsexn.cpp
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jsinfer.cpp
js/src/jsinfer.h
js/src/jsinferinlines.h
js/src/jsiter.cpp
js/src/jsnum.cpp
js/src/jsobj.cpp
js/src/jsobjinlines.h
js/src/json.cpp
js/src/jsscript.h
js/src/jsstr.cpp
js/src/vm/ArgumentsObject.cpp
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ArrayObject-inl.h
js/src/vm/Debugger.cpp
js/src/vm/GeneratorObject.cpp
js/src/vm/GlobalObject.cpp
js/src/vm/Interpreter.cpp
js/src/vm/NativeObject-inl.h
js/src/vm/NativeObject.cpp
js/src/vm/ObjectGroup.cpp
js/src/vm/ObjectGroup.h
js/src/vm/ProxyObject.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/RegExpStatics.cpp
js/src/vm/ScopeObject-inl.h
js/src/vm/ScopeObject.cpp
js/src/vm/Shape.cpp
js/src/vm/SharedTypedArrayObject.cpp
js/src/vm/TypedArrayObject.cpp
js/src/vm/UnboxedObject.cpp
js/src/vm/UnboxedObject.h
--- a/js/src/asmjs/AsmJSModule.cpp
+++ b/js/src/asmjs/AsmJSModule.cpp
@@ -530,23 +530,23 @@ TryEnablingJit(JSContext *cx, AsmJSModul
     // Ensure the argument types are included in the argument TypeSets stored in
     // the TypeScript. This is necessary for Ion, because the FFI exit will
     // use the skip-arg-checks entry point.
     //
     // Note that the TypeScript is never discarded while the script has a
     // BaselineScript, so if those checks hold now they must hold at least until
     // the BaselineScript is discarded and when that happens the FFI exit is
     // patched back.
-    if (!types::TypeScript::ThisTypes(script)->hasType(types::Type::UndefinedType()))
+    if (!TypeScript::ThisTypes(script)->hasType(TypeSet::UndefinedType()))
         return true;
     for (uint32_t i = 0; i < fun->nargs(); i++) {
-        types::StackTypeSet *typeset = types::TypeScript::ArgTypes(script, i);
-        types::Type type = types::Type::DoubleType();
+        StackTypeSet *typeset = TypeScript::ArgTypes(script, i);
+        TypeSet::Type type = TypeSet::DoubleType();
         if (!argv[i].isDouble())
-            type = types::Type::PrimitiveType(argv[i].extractNonDoubleType());
+            type = TypeSet::PrimitiveType(argv[i].extractNonDoubleType());
         if (!typeset->hasType(type))
             return true;
     }
 
     // The exit may have become optimized while executing the FFI.
     if (module.exitIsOptimized(exitIndex))
         return true;
 
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -16,17 +16,16 @@
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
 #include "vm/NativeObject-inl.h"
 #include "vm/Shape-inl.h"
 
 using namespace js;
-using namespace js::types;
 
 using js::frontend::IsIdentifier;
 using mozilla::ArrayLength;
 using mozilla::UniquePtr;
 
 bool
 js::obj_construct(JSContext *cx, unsigned argc, Value *vp)
 {
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -14,17 +14,16 @@
 #include "vm/RegExpStatics.h"
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
 #include "vm/NativeObject-inl.h"
 
 using namespace js;
-using namespace js::types;
 
 using mozilla::ArrayLength;
 using mozilla::Maybe;
 
 bool
 js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches,
                             MutableHandleValue rval)
 {
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -2724,17 +2724,17 @@ js::StoreReference##T::Func(JSContext *c
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());     \
     MOZ_ASSERT(args[1].isInt32());                                              \
     MOZ_ASSERT(args[2].isString() || args[2].isNull());                         \
                                                                                 \
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();               \
     int32_t offset = args[1].toInt32();                                         \
                                                                                 \
     jsid id = args[2].isString()                                                \
-              ? types::IdToTypeId(AtomToId(&args[2].toString()->asAtom()))      \
+              ? IdToTypeId(AtomToId(&args[2].toString()->asAtom()))             \
               : JSID_VOID;                                                      \
                                                                                 \
     /* Should be guaranteed by the typed objects API: */                        \
     MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0);                                   \
                                                                                 \
     T *target = reinterpret_cast<T*>(typedObj.typedMem(offset));                \
     if (!store(cx, target, args[3], &typedObj, id))                             \
         return false;                                                           \
@@ -2790,18 +2790,18 @@ bool
 StoreReferenceHeapValue::store(JSContext *cx, HeapValue *heap, const Value &v,
                                TypedObject *obj, jsid id)
 {
     // Undefined values are not included in type inference information for
     // value properties of typed objects, as these properties are always
     // considered to contain undefined.
     if (!v.isUndefined()) {
         if (cx->isJSContext())
-            types::AddTypePropertyId(cx->asJSContext(), obj, id, v);
-        else if (!types::HasTypePropertyId(obj, id, v))
+            AddTypePropertyId(cx->asJSContext(), obj, id, v);
+        else if (!HasTypePropertyId(obj, id, v))
             return false;
     }
 
     *heap = v;
     return true;
 }
 
 bool
@@ -2810,18 +2810,18 @@ StoreReferenceHeapPtrObject::store(JSCon
 {
     MOZ_ASSERT(v.isObjectOrNull()); // or else Store_object is being misused
 
     // Null pointers are not included in type inference information for
     // object properties of typed objects, as these properties are always
     // considered to contain null.
     if (v.isObject()) {
         if (cx->isJSContext())
-            types::AddTypePropertyId(cx->asJSContext(), obj, id, v);
-        else if (!types::HasTypePropertyId(obj, id, v))
+            AddTypePropertyId(cx->asJSContext(), obj, id, v);
+        else if (!HasTypePropertyId(obj, id, v))
             return false;
     }
 
     *heap = v.toObjectOrNull();
     return true;
 }
 
 bool
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1897,17 +1897,17 @@ BindNameToSlotHelper(ExclusiveContext *c
 
     /*
      * Explicitly disallow accessing var/let bindings in global scope from
      * nested functions. The reason for this limitation is that, since the
      * global script is not included in the static scope chain (1. because it
      * has no object to stand in the static scope chain, 2. to minimize memory
      * bloat where a single live function keeps its whole global script
      * alive.), ScopeCoordinateToTypeSet is not able to find the var/let's
-     * associated types::TypeSet.
+     * associated TypeSet.
      */
     if (skip) {
         BytecodeEmitter *bceSkipped = bce;
         for (unsigned i = 0; i < skip; i++)
             bceSkipped = bceSkipped->parent;
         if (!bceSkipped->sc->isFunctionBox())
             return true;
     }
@@ -3699,17 +3699,17 @@ EmitDestructuringOpsObjectHelper(Exclusi
                     return false;
             } else if (key->isKind(PNK_NAME) || key->isKind(PNK_STRING)) {
                 PropertyName *name = key->pn_atom->asPropertyName();
 
                 // The parser already checked for atoms representing indexes and
                 // used PNK_NUMBER instead, but also watch for ids which TI treats
                 // as indexes for simplification of downstream analysis.
                 jsid id = NameToId(name);
-                if (id != types::IdToTypeId(id)) {
+                if (id != IdToTypeId(id)) {
                     if (!EmitTree(cx, bce, key))                       // ... OBJ OBJ KEY
                         return false;
                 } else {
                     if (!EmitAtomOp(cx, name, JSOP_GETPROP, bce))      // ...OBJ PROP
                         return false;
                     needsGetElem = false;
                 }
             } else {
@@ -6617,17 +6617,17 @@ EmitObject(ExclusiveContext *cx, Bytecod
             if (!EmitNumberOp(cx, key->pn_dval, bce))
                 return false;
             isIndex = true;
         } else if (key->isKind(PNK_NAME) || key->isKind(PNK_STRING)) {
             // The parser already checked for atoms representing indexes and
             // used PNK_NUMBER instead, but also watch for ids which TI treats
             // as indexes for simpliciation of downstream analysis.
             jsid id = NameToId(key->pn_atom->asPropertyName());
-            if (id != types::IdToTypeId(id)) {
+            if (id != IdToTypeId(id)) {
                 if (!EmitTree(cx, bce, key))
                     return false;
                 isIndex = true;
             }
         } else {
             MOZ_ASSERT(key->isKind(PNK_COMPUTED_NAME));
             if (!EmitTree(cx, bce, key->pn_kid))
                 return false;
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -829,17 +829,17 @@ Fold(ExclusiveContext *cx, ParseNode **p
                 // which enables optimization 3 below.
                 JSAtom *atom = ToAtom<NoGC>(cx, DoubleValue(number));
                 if (!atom)
                     return false;
                 name = atom->asPropertyName();
             }
         }
 
-        if (name && NameToId(name) == types::IdToTypeId(NameToId(name))) {
+        if (name && NameToId(name) == IdToTypeId(NameToId(name))) {
             // Optimization 3: We have pn1["foo"] where foo is not an index.
             // Convert to a property access (like pn1.foo) which we optimize
             // better downstream. Don't bother with this for names which TI
             // considers to be indexes, to simplify downstream analysis.
             ParseNode *expr = handler.newPropertyAccess(pn->pn_left, name, pn->pn_pos.end);
             if (!expr)
                 return false;
             ReplaceNode(pnp, expr);
--- a/js/src/gc/GCTrace.cpp
+++ b/js/src/gc/GCTrace.cpp
@@ -12,17 +12,16 @@
 #include <string.h>
 
 #include "gc/GCTraceFormat.h"
 
 #include "js/HashTable.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 
 JS_STATIC_ASSERT(AllocKinds == FINALIZE_LIMIT);
 JS_STATIC_ASSERT(LastObjectAllocKind == FINALIZE_OBJECT_LAST);
 
 static FILE *gcTraceFile = nullptr;
 
 static HashSet<const Class *, DefaultHasher<const Class *>, SystemAllocPolicy> tracedClasses;
 static HashSet<const ObjectGroup *, DefaultHasher<const ObjectGroup *>, SystemAllocPolicy> tracedGroups;
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -782,28 +782,28 @@ void
 gc::MarkValueRoot(JSTracer *trc, Value *v, const char *name)
 {
     JS_ROOT_MARKING_ASSERT(trc);
     trc->setTracingName(name);
     MarkValueInternal(trc, v);
 }
 
 void
-gc::MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name)
+TypeSet::MarkTypeRoot(JSTracer *trc, TypeSet::Type *v, const char *name)
 {
     JS_ROOT_MARKING_ASSERT(trc);
     trc->setTracingName(name);
     if (v->isSingleton()) {
         JSObject *obj = v->singleton();
         MarkInternal(trc, &obj);
-        *v = types::Type::ObjectType(obj);
+        *v = TypeSet::ObjectType(obj);
     } else if (v->isGroup()) {
         ObjectGroup *group = v->group();
         MarkInternal(trc, &group);
-        *v = types::Type::ObjectType(group);
+        *v = TypeSet::ObjectType(group);
     }
 }
 
 void
 gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredBase<Value> *vec, const char *name)
 {
     for (size_t i = 0; i < len; ++i) {
         trc->setTracingIndex(name, i);
@@ -1421,17 +1421,17 @@ gc::MarkCycleCollectorChildren(JSTracer 
     } while (shape);
 }
 
 static void
 ScanObjectGroup(GCMarker *gcmarker, ObjectGroup *group)
 {
     unsigned count = group->getPropertyCount();
     for (unsigned i = 0; i < count; i++) {
-        if (types::Property *prop = group->getProperty(i))
+        if (ObjectGroup::Property *prop = group->getProperty(i))
             MarkId(gcmarker, &prop->id, "ObjectGroup property id");
     }
 
     if (group->proto().isObject())
         PushMarkStack(gcmarker, group->proto().toObject());
 
     if (group->singleton() && !group->lazy())
         PushMarkStack(gcmarker, group->singleton());
@@ -1449,18 +1449,17 @@ ScanObjectGroup(GCMarker *gcmarker, Obje
         PushMarkStack(gcmarker, fun);
 }
 
 static void
 gc::MarkChildren(JSTracer *trc, ObjectGroup *group)
 {
     unsigned count = group->getPropertyCount();
     for (unsigned i = 0; i < count; i++) {
-        types::Property *prop = group->getProperty(i);
-        if (prop)
+        if (ObjectGroup::Property *prop = group->getProperty(i))
             MarkId(trc, &prop->id, "group_property");
     }
 
     if (group->proto().isObject())
         MarkObject(trc, &group->protoRaw(), "group_proto");
 
     if (group->singleton() && !group->lazy())
         MarkObject(trc, &group->singletonRaw(), "group_singleton");
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -32,20 +32,16 @@ class UnownedBaseShape;
 template<class> class HeapPtr;
 
 namespace jit {
 class JitCode;
 struct IonScript;
 struct VMFunction;
 }
 
-namespace types {
-class Type;
-}
-
 namespace gc {
 
 /*** Object Marking ***/
 
 /*
  * These functions expose marking functionality for all of the different GC
  * thing kinds. For each GC thing, there are several variants. As an example,
  * these are the variants generated for JSObject. They are listed from most to
@@ -208,19 +204,16 @@ void
 MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name);
 
 inline void
 MarkValueRootRange(JSTracer *trc, Value *begin, Value *end, const char *name)
 {
     MarkValueRootRange(trc, end - begin, begin, name);
 }
 
-void
-MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name);
-
 bool
 IsValueMarked(Value *v);
 
 bool
 IsValueAboutToBeFinalized(Value *v);
 
 bool
 IsValueAboutToBeFinalizedFromAnyThread(Value *v);
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -107,17 +107,17 @@ MarkExactStackRootsAcrossTypes(T context
         trc, context, "exact-objectgroup");
     MarkExactStackRootList<JSString *, MarkStringRoot>(trc, context, "exact-string");
     MarkExactStackRootList<JS::Symbol *, MarkSymbolRoot>(trc, context, "exact-symbol");
     MarkExactStackRootList<jit::JitCode *, MarkJitCodeRoot>(trc, context, "exact-jitcode");
     MarkExactStackRootList<JSScript *, MarkScriptRoot>(trc, context, "exact-script");
     MarkExactStackRootList<LazyScript *, MarkLazyScriptRoot>(trc, context, "exact-lazy-script");
     MarkExactStackRootList<jsid, MarkIdRoot>(trc, context, "exact-id");
     MarkExactStackRootList<Value, MarkValueRoot>(trc, context, "exact-value");
-    MarkExactStackRootList<types::Type, MarkTypeRoot>(trc, context, "types::Type");
+    MarkExactStackRootList<TypeSet::Type, TypeSet::MarkTypeRoot>(trc, context, "TypeSet::Type");
     MarkExactStackRootList<Bindings, MarkBindingsRoot>(trc, context, "Bindings");
     MarkExactStackRootList<JSPropertyDescriptor, MarkPropertyDescriptorRoot>(
         trc, context, "JSPropertyDescriptor");
     MarkExactStackRootList<PropDesc, MarkPropDescRoot>(trc, context, "PropDesc");
 }
 
 static void
 MarkExactStackRoots(JSRuntime* rt, JSTracer *trc)
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -110,17 +110,17 @@ Zone::onTooMuchMalloc()
 void
 Zone::beginSweepTypes(FreeOp *fop, bool releaseTypes)
 {
     // Periodically release observed types for all scripts. This is safe to
     // do when there are no frames for the zone on the stack.
     if (active)
         releaseTypes = false;
 
-    types::AutoClearTypeInferenceStateOnOOM oom(this);
+    AutoClearTypeInferenceStateOnOOM oom(this);
     types.beginSweep(fop, releaseTypes, oom);
 }
 
 void
 Zone::sweepBreakpoints(FreeOp *fop)
 {
     if (fop->runtime()->debuggerList.isEmpty())
         return;
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -232,17 +232,17 @@ struct Zone : public JS::shadow::Zone,
 
     bool isQueuedForBackgroundSweep() {
         return isOnList();
     }
 
   public:
     js::gc::ArenaLists arenas;
 
-    js::types::TypeZone types;
+    js::TypeZone types;
 
     // The set of compartments in this zone.
     typedef js::Vector<JSCompartment *, 1, js::SystemAllocPolicy> CompartmentVector;
     CompartmentVector compartments;
 
     // This compartment's gray roots.
     typedef js::Vector<js::GrayRoot, 0, js::SystemAllocPolicy> GrayRootVector;
     GrayRootVector gcGrayRoots;
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -85,17 +85,17 @@ BaselineCompiler::compile()
     TraceLoggerEvent scriptEvent(logger, TraceLogger_AnnotateScripts, script);
     AutoTraceLog logScript(logger, scriptEvent);
     AutoTraceLog logCompile(logger, TraceLogger_BaselineCompilation);
 
     if (!script->ensureHasTypes(cx) || !script->ensureHasAnalyzedArgsUsage(cx))
         return Method_Error;
 
     // Pin analysis info during compilation.
-    types::AutoEnterAnalysis autoEnterAnalysis(cx);
+    AutoEnterAnalysis autoEnterAnalysis(cx);
 
     MOZ_ASSERT(!script->hasBaselineScript());
 
     if (!emitPrologue())
         return Method_Error;
 
     MethodStatus status = emitBody();
     if (status != Method_Compiled)
@@ -245,17 +245,17 @@ BaselineCompiler::compile()
         baselineScript->toggleBarriers(true);
 
 #ifdef JS_TRACE_LOGGING
     // Initialize the tracelogger instrumentation.
     baselineScript->initTraceLogger(cx->runtime(), script);
 #endif
 
     uint32_t *bytecodeMap = baselineScript->bytecodeTypeMap();
-    types::FillBytecodeTypeMap(script, bytecodeMap);
+    FillBytecodeTypeMap(script, bytecodeMap);
 
     // The last entry in the last index found, and is used to avoid binary
     // searches for the sought entry when queries are in linear order.
     bytecodeMap[script->nTypeSets()] = 0;
 
     baselineScript->copyYieldEntries(script, yieldOffsets_);
 
     if (compileDebugInstrumentation_)
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -766,17 +766,17 @@ CloneOldBaselineStub(JSContext *cx, Debu
 
     fallbackStub->addNewStub(entry.newStub);
     return true;
 }
 
 static bool
 InvalidateScriptsInZone(JSContext *cx, Zone *zone, const Vector<DebugModeOSREntry> &entries)
 {
-    types::RecompileInfoVector invalid;
+    RecompileInfoVector invalid;
     for (UniqueScriptOSREntryIter iter(entries); !iter.done(); ++iter) {
         JSScript *script = iter.entry().script;
         if (script->compartment()->zone() != zone)
             continue;
 
         if (script->hasIonScript()) {
             if (!invalid.append(script->ionScript()->recompileInfo()))
                 return false;
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -1192,22 +1192,22 @@ DoTypeMonitorFallback(JSContext *cx, Bas
 
     RootedScript script(cx, frame->script());
     jsbytecode *pc = stub->icEntry()->pc(script);
     TypeFallbackICSpew(cx, stub, "TypeMonitor");
 
     uint32_t argument;
     if (stub->monitorsThis()) {
         MOZ_ASSERT(pc == script->code());
-        types::TypeScript::SetThis(cx, script, value);
+        TypeScript::SetThis(cx, script, value);
     } else if (stub->monitorsArgument(&argument)) {
         MOZ_ASSERT(pc == script->code());
-        types::TypeScript::SetArgument(cx, script, argument, value);
+        TypeScript::SetArgument(cx, script, argument, value);
     } else {
-        types::TypeScript::Monitor(cx, script, pc, value);
+        TypeScript::Monitor(cx, script, pc, value);
     }
 
     if (!stub->addMonitorStubForValue(cx, script, value))
         return false;
 
     // Copy input value to res.
     res.set(value);
     return true;
@@ -1319,22 +1319,22 @@ ICUpdatedStub::addUpdateStubForValue(JSC
                                      HandleId id, HandleValue val)
 {
     if (numOptimizedStubs_ >= MAX_OPTIMIZED_STUBS) {
         // TODO: if the TypeSet becomes unknown or has the AnyObject type,
         // replace stubs with a single stub to handle these.
         return true;
     }
 
-    types::EnsureTrackPropertyTypes(cx, obj, id);
+    EnsureTrackPropertyTypes(cx, obj, id);
 
     // Make sure that undefined values are explicitly included in the property
     // types for an object if generating a stub to write an undefined value.
-    if (val.isUndefined() && types::CanHaveEmptyPropertyTypesForOwnProperty(obj))
-        types::AddTypePropertyId(cx, obj, id, val);
+    if (val.isUndefined() && CanHaveEmptyPropertyTypesForOwnProperty(obj))
+        AddTypePropertyId(cx, obj, id, val);
 
     if (val.isPrimitive()) {
         JSValueType type = val.isDouble() ? JSVAL_TYPE_DOUBLE : val.extractNonDoubleType();
 
         // Check for existing TypeUpdate stub.
         ICTypeUpdate_PrimitiveSet *existingStub = nullptr;
         for (ICStubConstIterator iter(firstUpdateStub_); !iter.atEnd(); iter++) {
             if (iter->isTypeUpdate_PrimitiveSet()) {
@@ -1418,47 +1418,47 @@ DoTypeUpdateFallback(JSContext *cx, Base
     RootedObject obj(cx, &objval.toObject());
     RootedId id(cx);
 
     switch(stub->kind()) {
       case ICStub::SetElem_Dense:
       case ICStub::SetElem_DenseAdd: {
         MOZ_ASSERT(obj->isNative());
         id = JSID_VOID;
-        types::AddTypePropertyId(cx, obj, id, value);
+        AddTypePropertyId(cx, obj, id, value);
         break;
       }
       case ICStub::SetProp_Native:
       case ICStub::SetProp_NativeAdd:
       case ICStub::SetProp_Unboxed: {
         MOZ_ASSERT(obj->isNative() || obj->is<UnboxedPlainObject>());
         jsbytecode *pc = stub->getChainFallback()->icEntry()->pc(script);
         if (*pc == JSOP_SETALIASEDVAR || *pc == JSOP_INITALIASEDLEXICAL)
             id = NameToId(ScopeCoordinateName(cx->runtime()->scopeCoordinateNameCache, script, pc));
         else
             id = NameToId(script->getName(pc));
-        types::AddTypePropertyId(cx, obj, id, value);
+        AddTypePropertyId(cx, obj, id, value);
         break;
       }
       case ICStub::SetProp_TypedObject: {
         MOZ_ASSERT(obj->is<TypedObject>());
         jsbytecode *pc = stub->getChainFallback()->icEntry()->pc(script);
         id = NameToId(script->getName(pc));
         if (stub->toSetProp_TypedObject()->isObjectReference()) {
             // Ignore all values being written except plain objects. Null
             // is included implicitly in type information for this property,
             // and non-object non-null values will cause the stub to fail to
             // match shortly and we will end up doing the assignment in the VM.
             if (value.isObject())
-                types::AddTypePropertyId(cx, obj, id, value);
+                AddTypePropertyId(cx, obj, id, value);
         } else {
             // Ignore undefined values, which are included implicitly in type
             // information for this property.
             if (!value.isUndefined())
-                types::AddTypePropertyId(cx, obj, id, value);
+                AddTypePropertyId(cx, obj, id, value);
         }
         break;
       }
       default:
         MOZ_CRASH("Invalid stub");
     }
 
     return stub->addUpdateStubForValue(cx, script, obj, id, value);
@@ -3970,23 +3970,23 @@ DoGetElemFallback(JSContext *cx, Baselin
     RootedValue lhsCopy(cx, lhs);
 
     bool isOptimizedArgs = false;
     if (lhs.isMagic(JS_OPTIMIZED_ARGUMENTS)) {
         // Handle optimized arguments[i] access.
         if (!GetElemOptimizedArguments(cx, frame, &lhsCopy, rhs, res, &isOptimizedArgs))
             return false;
         if (isOptimizedArgs)
-            types::TypeScript::Monitor(cx, frame->script(), pc, res);
+            TypeScript::Monitor(cx, frame->script(), pc, res);
     }
 
     if (!isOptimizedArgs) {
         if (!GetElementOperation(cx, op, &lhsCopy, rhs, res))
             return false;
-        types::TypeScript::Monitor(cx, frame->script(), pc, res);
+        TypeScript::Monitor(cx, frame->script(), pc, res);
     }
 
     // Check if debug mode toggling made the stub invalid.
     if (stub.invalid())
         return true;
 
     // Add a type monitor stub for the resulting value.
     if (!stub->addMonitorStubForValue(cx, frame->script(), res))
@@ -5798,17 +5798,17 @@ TryAttachGlobalNameStub(JSContext *cx, H
         JSObject *proto = current->getProto();
         if (!proto || !proto->is<NativeObject>())
             return true;
         current = &proto->as<NativeObject>();
     }
 
     // Instantiate this global property, for use during Ion compilation.
     if (IsIonEnabled(cx))
-        types::EnsureTrackPropertyTypes(cx, current, id);
+        EnsureTrackPropertyTypes(cx, current, id);
 
     if (shape->hasDefaultGetter() && shape->hasSlot()) {
 
         // TODO: if there's a previous stub discard it, or just update its Shape + slot?
 
         ICStub *monitorStub = stub->fallbackMonitorStub()->firstMonitorStub();
         ICStub *newStub;
         if (current == global) {
@@ -6001,17 +6001,17 @@ DoGetNameFallback(JSContext *cx, Baselin
     if (JSOp(pc[JSOP_GETGNAME_LENGTH]) == JSOP_TYPEOF) {
         if (!GetScopeNameForTypeOf(cx, scopeChain, name, res))
             return false;
     } else {
         if (!GetScopeName(cx, scopeChain, name, res))
             return false;
     }
 
-    types::TypeScript::Monitor(cx, script, pc, res);
+    TypeScript::Monitor(cx, script, pc, res);
 
     // Check if debug mode toggling made the stub invalid.
     if (stub.invalid())
         return true;
 
     // Add a type monitor stub for the resulting value.
     if (!stub->addMonitorStubForValue(cx, script, res))
         return false;
@@ -6190,17 +6190,17 @@ DoGetIntrinsicFallback(JSContext *cx, Ba
 
     if (!GetIntrinsicOperation(cx, pc, res))
         return false;
 
     // An intrinsic operation will always produce the same result, so only
     // needs to be monitored once. Attach a stub to load the resulting constant
     // directly.
 
-    types::TypeScript::Monitor(cx, script, pc, res);
+    TypeScript::Monitor(cx, script, pc, res);
 
     // Check if debug mode toggling made the stub invalid.
     if (stub.invalid())
         return true;
 
     JitSpew(JitSpew_BaselineIC, "  Generating GetIntrinsic optimized stub");
     ICGetIntrinsic_Constant::Compiler compiler(cx, res);
     ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
@@ -6378,17 +6378,17 @@ UpdateExistingGenerationalDOMProxyStub(I
 }
 
 static bool
 HasUnanalyzedNewScript(JSObject *obj)
 {
     if (obj->isSingleton())
         return false;
 
-    types::TypeNewScript *newScript = obj->group()->newScript();
+    TypeNewScript *newScript = obj->group()->newScript();
     if (newScript && !newScript->analyzed())
         return true;
 
     return false;
 }
 
 static void
 StripPreliminaryObjectStubs(JSContext *cx, ICFallbackStub *stub)
@@ -6446,17 +6446,17 @@ TryAttachNativeGetPropStub(JSContext *cx
     ICStub *monitorStub = stub->fallbackMonitorStub()->firstMonitorStub();
     if (!isDOMProxy && IsCacheableGetPropReadSlot(obj, holder, shape)) {
         bool isFixedSlot;
         uint32_t offset;
         GetFixedOrDynamicSlotOffset(&holder->as<NativeObject>(), shape->slot(), &isFixedSlot, &offset);
 
         // Instantiate this property for singleton holders, for use during Ion compilation.
         if (IsIonEnabled(cx))
-            types::EnsureTrackPropertyTypes(cx, holder, NameToId(name));
+            EnsureTrackPropertyTypes(cx, holder, NameToId(name));
 
         ICStub::Kind kind;
         if (obj == holder)
             kind = ICStub::GetProp_Native;
         else if (obj->isNative())
             kind = ICStub::GetProp_NativePrototype;
         else if (obj->is<UnboxedPlainObject>())
             kind = ICStub::GetProp_UnboxedPrototype;
@@ -6736,17 +6736,17 @@ TryAttachPrimitiveGetPropStub(JSContext 
         proto = GlobalObject::getOrCreateBooleanPrototype(cx, global);
     }
     if (!proto)
         return false;
 
     // Instantiate this property, for use during Ion compilation.
     RootedId id(cx, NameToId(name));
     if (IsIonEnabled(cx))
-        types::EnsureTrackPropertyTypes(cx, proto, id);
+        EnsureTrackPropertyTypes(cx, proto, id);
 
     // For now, only look for properties directly set on the prototype.
     RootedShape shape(cx, proto->lookup(cx, id));
     if (!shape || !shape->hasSlot() || !shape->hasDefaultGetter())
         return true;
 
     bool isFixedSlot;
     uint32_t offset;
@@ -6864,17 +6864,17 @@ DoGetPropFallback(JSContext *cx, Baselin
 
     // After the  Genericstub was added, we should never reach the Fallbackstub again.
     MOZ_ASSERT(!stub->hasStub(ICStub::GetProp_Generic));
 
     RootedPropertyName name(cx, frame->script()->getName(pc));
     if (!ComputeGetPropResult(cx, frame, op, name, val, res))
         return false;
 
-    types::TypeScript::Monitor(cx, frame->script(), pc, res);
+    TypeScript::Monitor(cx, frame->script(), pc, res);
 
     // Check if debug mode toggling made the stub invalid.
     if (stub.invalid())
         return true;
 
     // Add a type monitor stub for the resulting value.
     if (!stub->addMonitorStubForValue(cx, frame->script(), res))
         return false;
@@ -8049,18 +8049,18 @@ TryAttachSetValuePropStub(JSContext *cx,
         return true;
     }
 
     if (IsCacheableSetPropWriteSlot(obj, oldShape, holder, shape)) {
         // For some property writes, such as the initial overwrite of global
         // properties, TI will not mark the property as having been
         // overwritten. Don't attach a stub in this case, so that we don't
         // execute another write to the property without TI seeing that write.
-        types::EnsureTrackPropertyTypes(cx, obj, id);
-        if (!types::PropertyHasBeenMarkedNonConstant(obj, id)) {
+        EnsureTrackPropertyTypes(cx, obj, id);
+        if (!PropertyHasBeenMarkedNonConstant(obj, id)) {
             *attached = true;
             return true;
         }
 
         bool isFixedSlot;
         uint32_t offset;
         GetFixedOrDynamicSlotOffset(&obj->as<NativeObject>(), shape->slot(), &isFixedSlot, &offset);
 
@@ -9322,17 +9322,17 @@ TryAttachCallStub(JSContext *cx, ICCall_
             // Add new generalized stub.
             stub->addNewStub(newStub);
             return true;
         }
 
         // Keep track of the function's |prototype| property in type
         // information, for use during Ion compilation.
         if (IsIonEnabled(cx))
-            types::EnsureTrackPropertyTypes(cx, fun, NameToId(cx->names().prototype));
+            EnsureTrackPropertyTypes(cx, fun, NameToId(cx->names().prototype));
 
         // Remember the template object associated with any script being called
         // as a constructor, for later use during Ion compilation.
         RootedObject templateObject(cx);
         if (constructing) {
             JSObject *thisObject = CreateThisForFunction(cx, fun, MaybeSingletonObject);
             if (!thisObject)
                 return false;
@@ -9340,17 +9340,17 @@ TryAttachCallStub(JSContext *cx, ICCall_
             if (thisObject->is<PlainObject>() || thisObject->is<UnboxedPlainObject>()) {
                 templateObject = thisObject;
 
                 // If we are calling a constructor for which the new script
                 // properties analysis has not been performed yet, don't attach a
                 // stub. After the analysis is performed, CreateThisForFunction may
                 // start returning objects with a different type, and the Ion
                 // compiler might get confused.
-                types::TypeNewScript *newScript = templateObject->group()->newScript();
+                TypeNewScript *newScript = templateObject->group()->newScript();
                 if (newScript && !newScript->analyzed()) {
                     // Clear the object just created from the preliminary objects
                     // on the TypeNewScript, as it will not be used or filled in by
                     // running code.
                     newScript->unregisterNewObject(&templateObject->as<PlainObject>());
                     return true;
                 }
             }
@@ -9568,17 +9568,17 @@ DoCallFallback(JSContext *cx, BaselineFr
                    op == JSOP_FUNCALL ||
                    op == JSOP_FUNAPPLY ||
                    op == JSOP_EVAL ||
                    op == JSOP_STRICTEVAL);
         if (!Invoke(cx, thisv, callee, argc, args, res))
             return false;
     }
 
-    types::TypeScript::Monitor(cx, script, pc, res);
+    TypeScript::Monitor(cx, script, pc, res);
 
     // Check if debug mode toggling made the stub invalid.
     if (stub.invalid())
         return true;
 
     // Attach a new TypeMonitor stub for this value.
     ICTypeMonitor_Fallback *typeMonFbStub = stub->fallbackMonitorStub();
     if (!typeMonFbStub->addMonitorStubForValue(cx, script, res))
@@ -11229,17 +11229,17 @@ DoInstanceOfFallback(JSContext *cx, Base
 
     if (!obj->is<JSFunction>()) {
         stub->noteUnoptimizableAccess();
         return true;
     }
 
     // For functions, keep track of the |prototype| property in type information,
     // for use during Ion compilation.
-    types::EnsureTrackPropertyTypes(cx, obj, NameToId(cx->names().prototype));
+    EnsureTrackPropertyTypes(cx, obj, NameToId(cx->names().prototype));
 
     if (stub->numOptimizedStubs() >= ICInstanceOf_Fallback::MAX_OPTIMIZED_STUBS)
         return true;
 
     RootedFunction fun(cx, &obj->as<JSFunction>());
     bool attached = false;
     if (!TryAttachInstanceOfStub(cx, frame, stub, fun, &attached))
         return false;
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -3390,17 +3390,17 @@ CodeGenerator::generateArgumentsChecks(b
     Register temp = GeneralRegisterSet(EntryTempMask).getAny();
 
     CompileInfo &info = gen->info();
 
     Label miss;
     for (uint32_t i = info.startArgSlot(); i < info.endArgSlot(); i++) {
         // All initial parameters are guaranteed to be MParameters.
         MParameter *param = rp->getOperand(i)->toParameter();
-        const types::TypeSet *types = param->resultTypeSet();
+        const TypeSet *types = param->resultTypeSet();
         if (!types || types->unknown())
             continue;
 
         // Calculate the offset on the stack of the argument.
         // (i - info.startArgSlot())    - Compute index of arg within arg vector.
         // ... * sizeof(Value)          - Scale by value size.
         // ArgToStackOffset(...)        - Compute displacement within arg vector.
         int32_t offset = ArgToStackOffset((i - info.startArgSlot()) * sizeof(Value));
@@ -7210,21 +7210,21 @@ CodeGenerator::generate()
     dumpNativeToBytecodeEntries();
 
     return !masm.oom();
 }
 
 struct AutoDiscardIonCode
 {
     JSContext *cx;
-    types::RecompileInfo *recompileInfo;
+    RecompileInfo *recompileInfo;
     IonScript *ionScript;
     bool keep;
 
-    AutoDiscardIonCode(JSContext *cx, types::RecompileInfo *recompileInfo)
+    AutoDiscardIonCode(JSContext *cx, RecompileInfo *recompileInfo)
       : cx(cx), recompileInfo(recompileInfo), ionScript(nullptr), keep(false) {}
 
     ~AutoDiscardIonCode() {
         if (keep)
             return;
 
         // Use js_free instead of IonScript::Destroy: the cache list and
         // backedge list are still uninitialized.
@@ -7235,17 +7235,17 @@ struct AutoDiscardIonCode
     }
 
     void keepIonCode() {
         keep = true;
     }
 };
 
 bool
-CodeGenerator::link(JSContext *cx, types::CompilerConstraintList *constraints)
+CodeGenerator::link(JSContext *cx, CompilerConstraintList *constraints)
 {
     RootedScript script(cx, gen->info().script());
     OptimizationLevel optimizationLevel = gen->optimizationInfo().level();
 
     // We finished the new IonScript. Invalidate the current active IonScript,
     // so we can replace it with this new (probably higher optimized) version.
     if (script->hasIonScript()) {
         MOZ_ASSERT(script->ionScript()->isRecompiling());
@@ -7256,18 +7256,18 @@ CodeGenerator::link(JSContext *cx, types
     }
 
     if (scriptCounts_ && !script->hasScriptCounts() && !script->initScriptCounts(cx))
         return false;
 
     // Check to make sure we didn't have a mid-build invalidation. If so, we
     // will trickle to jit::Compile() and return Method_Skipped.
     uint32_t warmUpCount = script->getWarmUpCount();
-    types::RecompileInfo recompileInfo;
-    if (!types::FinishCompilation(cx, script, constraints, &recompileInfo))
+    RecompileInfo recompileInfo;
+    if (!FinishCompilation(cx, script, constraints, &recompileInfo))
         return true;
 
     // IonMonkey could have inferred better type information during
     // compilation. Since adding the new information to the actual type
     // information can reset the usecount, increase it back to what it was
     // before.
     if (warmUpCount > script->getWarmUpCount())
         script->incWarmUpCounter(warmUpCount - script->getWarmUpCount());
--- a/js/src/jit/CodeGenerator.h
+++ b/js/src/jit/CodeGenerator.h
@@ -51,17 +51,17 @@ class CodeGenerator : public CodeGenerat
 
   public:
     CodeGenerator(MIRGenerator *gen, LIRGraph *graph, MacroAssembler *masm = nullptr);
     ~CodeGenerator();
 
   public:
     bool generate();
     bool generateAsmJS(AsmJSFunctionLabels *labels);
-    bool link(JSContext *cx, types::CompilerConstraintList *constraints);
+    bool link(JSContext *cx, CompilerConstraintList *constraints);
 
     void visitLabel(LLabel *lir);
     void visitNop(LNop *lir);
     void visitMop(LMop *lir);
     void visitOsiPoint(LOsiPoint *lir);
     void visitGoto(LGoto *lir);
     void visitTableSwitch(LTableSwitch *ins);
     void visitTableSwitchV(LTableSwitchV *ins);
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -466,17 +466,17 @@ jit::LazyLinkTopActivation(JSContext *cx
     // Second frame is the Ion frame.
     ++it;
     MOZ_ASSERT(it.type() == JitFrame_IonJS);
 
     // Get the pending builder from the Ion frame.
     IonBuilder *builder = it.script()->ionScript()->pendingBuilder();
     it.script()->setPendingIonBuilder(cx, nullptr);
 
-    types::AutoEnterAnalysis enterTypes(cx);
+    AutoEnterAnalysis enterTypes(cx);
     RootedScript script(cx, builder->script());
 
     // Remove from pending.
     builder->remove();
 
     if (CodeGenerator *codegen = builder->backgroundCodegen()) {
         js::TraceLoggerThread *logger = TraceLoggerForMainThread(cx->runtime());
         TraceLoggerEvent event(logger, TraceLogger_AnnotateScripts, script);
@@ -744,17 +744,17 @@ IonScript::IonScript()
     invalidationCount_(0),
     recompileInfo_(),
     osrPcMismatchCounter_(0),
     pendingBuilder_(nullptr)
 {
 }
 
 IonScript *
-IonScript::New(JSContext *cx, types::RecompileInfo recompileInfo,
+IonScript::New(JSContext *cx, RecompileInfo recompileInfo,
                uint32_t frameSlots, uint32_t argumentSlots, uint32_t frameSize,
                size_t snapshotsListSize, size_t snapshotsRVATableSize,
                size_t recoversSize, size_t bailoutEntries,
                size_t constants, size_t safepointIndices,
                size_t osiIndices, size_t cacheEntries,
                size_t runtimeSize,  size_t safepointsSize,
                size_t backedgeEntries, OptimizationLevel optimizationLevel)
 {
@@ -1595,17 +1595,17 @@ CompileBackEnd(MIRGenerator *mir)
 
 void
 AttachFinishedCompilations(JSContext *cx)
 {
     JitCompartment *ion = cx->compartment()->jitCompartment();
     if (!ion)
         return;
 
-    types::AutoEnterAnalysis enterTypes(cx);
+    AutoEnterAnalysis enterTypes(cx);
     AutoLockHelperThreadState lock;
 
     GlobalHelperThreadState::IonBuilderVector &finished = HelperThreadState().ionFinishedList();
 
     TraceLoggerThread *logger = TraceLoggerForMainThread(cx->runtime());
 
     // Incorporate any off thread compilations for the compartment which have
     // finished, failed or have been cancelled.
@@ -1753,17 +1753,17 @@ OffThreadCompilationAvailable(JSContext 
 }
 
 static void
 TrackAllProperties(JSContext *cx, JSObject *obj)
 {
     MOZ_ASSERT(obj->isSingleton());
 
     for (Shape::Range<NoGC> range(obj->lastProperty()); !range.empty(); range.popFront())
-        types::EnsureTrackPropertyTypes(cx, obj, range.front().propid());
+        EnsureTrackPropertyTypes(cx, obj, range.front().propid());
 }
 
 static void
 TrackPropertiesForSingletonScopes(JSContext *cx, JSScript *script, BaselineFrame *baselineFrame)
 {
     // Ensure that all properties of singleton call objects which the script
     // could access are tracked. These are generally accessed through
     // ALIASEDVAR operations in baseline and will not be tracked even if they
@@ -1834,17 +1834,17 @@ IonCompile(JSContext *cx, JSScript *scri
     ScopedJSDeletePtr<LifoAlloc> autoDelete(alloc);
 
     TempAllocator *temp = alloc->new_<TempAllocator>(alloc);
     if (!temp)
         return AbortReason_Alloc;
 
     JitContext jctx(cx, temp);
 
-    types::AutoEnterAnalysis enter(cx);
+    AutoEnterAnalysis enter(cx);
 
     if (!cx->compartment()->ensureJitCompartmentExists(cx))
         return AbortReason_Alloc;
 
     if (!cx->compartment()->jitCompartment()->ensureIonStubsExist(cx))
         return AbortReason_Alloc;
 
     MIRGraph *graph = alloc->new_<MIRGraph>(temp);
@@ -1867,17 +1867,17 @@ IonCompile(JSContext *cx, JSScript *scri
 
     BaselineFrameInspector *baselineFrameInspector = nullptr;
     if (baselineFrame) {
         baselineFrameInspector = NewBaselineFrameInspector(temp, baselineFrame, info);
         if (!baselineFrameInspector)
             return AbortReason_Alloc;
     }
 
-    types::CompilerConstraintList *constraints = types::NewCompilerConstraintList(*temp);
+    CompilerConstraintList *constraints = NewCompilerConstraintList(*temp);
     if (!constraints)
         return AbortReason_Alloc;
 
     const OptimizationInfo *optimizationInfo = js_IonOptimizations.get(optimizationLevel);
     const JitCompileOptions options(cx);
 
     IonBuilder *builder = alloc->new_<IonBuilder>((JSContext *) nullptr,
                                                   CompileCompartment::get(cx->compartment()),
@@ -2640,27 +2640,27 @@ jit::InvalidateAll(FreeOp *fop, Zone *zo
             JitSpew(JitSpew_IonInvalidate, "Invalidating all frames for GC");
             InvalidateActivation(fop, iter, true);
         }
     }
 }
 
 
 void
-jit::Invalidate(types::TypeZone &types, FreeOp *fop,
-                const types::RecompileInfoVector &invalid, bool resetUses,
+jit::Invalidate(TypeZone &types, FreeOp *fop,
+                const RecompileInfoVector &invalid, bool resetUses,
                 bool cancelOffThread)
 {
     JitSpew(JitSpew_IonInvalidate, "Start invalidation.");
 
     // Add an invalidation reference to all invalidated IonScripts to indicate
     // to the traversal which frames have been invalidated.
     size_t numInvalidations = 0;
     for (size_t i = 0; i < invalid.length(); i++) {
-        const types::CompilerOutput *co = invalid[i].compilerOutput(types);
+        const CompilerOutput *co = invalid[i].compilerOutput(types);
         if (!co)
             continue;
         MOZ_ASSERT(co->isValid());
 
         if (cancelOffThread)
             CancelOffThreadIonCompile(co->script()->compartment(), co->script());
 
         if (!co->ion())
@@ -2683,17 +2683,17 @@ jit::Invalidate(types::TypeZone &types, 
 
     for (JitActivationIterator iter(fop->runtime()); !iter.done(); ++iter)
         InvalidateActivation(fop, iter, false);
 
     // Drop the references added above. If a script was never active, its
     // IonScript will be immediately destroyed. Otherwise, it will be held live
     // until its last invalidated frame is destroyed.
     for (size_t i = 0; i < invalid.length(); i++) {
-        types::CompilerOutput *co = invalid[i].compilerOutput(types);
+        CompilerOutput *co = invalid[i].compilerOutput(types);
         if (!co)
             continue;
         MOZ_ASSERT(co->isValid());
 
         JSScript *script = co->script();
         IonScript *ionScript = co->ion();
         if (!ionScript)
             continue;
@@ -2711,28 +2711,28 @@ jit::Invalidate(types::TypeZone &types, 
     }
 
     // Make sure we didn't leak references by invalidating the same IonScript
     // multiple times in the above loop.
     MOZ_ASSERT(!numInvalidations);
 }
 
 void
-jit::Invalidate(JSContext *cx, const types::RecompileInfoVector &invalid, bool resetUses,
+jit::Invalidate(JSContext *cx, const RecompileInfoVector &invalid, bool resetUses,
                 bool cancelOffThread)
 {
     jit::Invalidate(cx->zone()->types, cx->runtime()->defaultFreeOp(), invalid, resetUses,
                     cancelOffThread);
 }
 
 bool
 jit::IonScript::invalidate(JSContext *cx, bool resetUses, const char *reason)
 {
     JitSpew(JitSpew_IonInvalidate, " Invalidate IonScript %p: %s", this, reason);
-    types::RecompileInfoVector list;
+    RecompileInfoVector list;
     if (!list.append(recompileInfo()))
         return false;
     Invalidate(cx, list, resetUses, true);
     return true;
 }
 
 bool
 jit::Invalidate(JSContext *cx, JSScript *script, bool resetUses, bool cancelOffThread)
@@ -2755,33 +2755,33 @@ jit::Invalidate(JSContext *cx, JSScript 
             return false;
 
         // Construct the descriptive string.
         JS_snprintf(buf, len, "Invalidate %s:%u", filename, (unsigned int)script->lineno());
         cx->runtime()->spsProfiler.markEvent(buf);
         js_free(buf);
     }
 
-    types::RecompileInfoVector scripts;
+    RecompileInfoVector scripts;
     MOZ_ASSERT(script->hasIonScript());
     if (!scripts.append(script->ionScript()->recompileInfo()))
         return false;
 
     Invalidate(cx, scripts, resetUses, cancelOffThread);
     return true;
 }
 
 static void
 FinishInvalidationOf(FreeOp *fop, JSScript *script, IonScript *ionScript)
 {
-    types::TypeZone &types = script->zone()->types;
+    TypeZone &types = script->zone()->types;
 
     // Note: If the script is about to be swept, the compiler output may have
     // already been destroyed.
-    if (types::CompilerOutput *output = ionScript->recompileInfo().compilerOutput(types))
+    if (CompilerOutput *output = ionScript->recompileInfo().compilerOutput(types))
         output->invalidate();
 
     // If this script has Ion code on the stack, invalidated() will return
     // true. In this case we have to wait until destroying it.
     if (!ionScript->invalidated())
         jit::IonScript::Destroy(fop, ionScript);
 }
 
--- a/js/src/jit/Ion.h
+++ b/js/src/jit/Ion.h
@@ -117,20 +117,20 @@ struct EnterJitData;
 bool SetEnterJitData(JSContext *cx, EnterJitData &data, RunState &state, AutoValueVector &vals);
 
 JitExecStatus IonCannon(JSContext *cx, RunState &state);
 
 // Used to enter Ion from C++ natives like Array.map. Called from FastInvokeGuard.
 JitExecStatus FastInvoke(JSContext *cx, HandleFunction fun, CallArgs &args);
 
 // Walk the stack and invalidate active Ion frames for the invalid scripts.
-void Invalidate(types::TypeZone &types, FreeOp *fop,
-                const types::RecompileInfoVector &invalid, bool resetUses = true,
+void Invalidate(TypeZone &types, FreeOp *fop,
+                const RecompileInfoVector &invalid, bool resetUses = true,
                 bool cancelOffThread = true);
-void Invalidate(JSContext *cx, const types::RecompileInfoVector &invalid, bool resetUses = true,
+void Invalidate(JSContext *cx, const RecompileInfoVector &invalid, bool resetUses = true,
                 bool cancelOffThread = true);
 bool Invalidate(JSContext *cx, JSScript *script, bool resetUses = true,
                 bool cancelOffThread = true);
 
 void ToggleBarriers(JS::Zone *zone, bool needs);
 
 class IonBuilder;
 class MIRGenerator;
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -2479,28 +2479,28 @@ TryEliminateTypeBarrierFromTest(MTypeBar
     barrier->replaceAllUsesWith(barrier->input());
 }
 
 static bool
 TryEliminateTypeBarrier(MTypeBarrier *barrier, bool *eliminated)
 {
     MOZ_ASSERT(!*eliminated);
 
-    const types::TemporaryTypeSet *barrierTypes = barrier->resultTypeSet();
-    const types::TemporaryTypeSet *inputTypes = barrier->input()->resultTypeSet();
+    const TemporaryTypeSet *barrierTypes = barrier->resultTypeSet();
+    const TemporaryTypeSet *inputTypes = barrier->input()->resultTypeSet();
 
     // Disregard the possible unbox added before the Typebarrier.
     if (barrier->input()->isUnbox() && barrier->input()->toUnbox()->mode() != MUnbox::Fallible)
         inputTypes = barrier->input()->toUnbox()->input()->resultTypeSet();
 
     if (!barrierTypes || !inputTypes)
         return true;
 
-    bool filtersNull = barrierTypes->filtersType(inputTypes, types::Type::NullType());
-    bool filtersUndefined = barrierTypes->filtersType(inputTypes, types::Type::UndefinedType());
+    bool filtersNull = barrierTypes->filtersType(inputTypes, TypeSet::NullType());
+    bool filtersUndefined = barrierTypes->filtersType(inputTypes, TypeSet::UndefinedType());
 
     if (!filtersNull && !filtersUndefined)
         return true;
 
     MBasicBlock *block = barrier->block();
     while (true) {
         BranchDirection direction;
         MTest *test = block->immediateDominatorBranch(&direction);
@@ -2878,17 +2878,17 @@ jit::ConvertLinearInequality(TempAllocat
 
     return compare;
 }
 
 static bool
 AnalyzePoppedThis(JSContext *cx, ObjectGroup *group,
                   MDefinition *thisValue, MInstruction *ins, bool definitelyExecuted,
                   HandlePlainObject baseobj,
-                  Vector<types::TypeNewScript::Initializer> *initializerList,
+                  Vector<TypeNewScript::Initializer> *initializerList,
                   Vector<PropertyName *> *accessedProperties,
                   bool *phandled)
 {
     // Determine the effect that a use of the |this| value when calling |new|
     // on a script has on the properties definitely held by the new object.
 
     if (ins->isCallSetProperty()) {
         MCallSetProperty *setprop = ins->toCallSetProperty();
@@ -2921,17 +2921,17 @@ AnalyzePoppedThis(JSContext *cx, ObjectG
         if (GetGCKindSlots(gc::GetGCObjectKind(baseobj->slotSpan() + 1)) <= baseobj->slotSpan())
             return true;
 
         // Assignments to new properties must always execute.
         if (!definitelyExecuted)
             return true;
 
         RootedId id(cx, NameToId(setprop->name()));
-        if (!types::AddClearDefiniteGetterSetterForPrototypeChain(cx, group, id)) {
+        if (!AddClearDefiniteGetterSetterForPrototypeChain(cx, group, id)) {
             // The prototype chain already contains a getter/setter for this
             // property, or type information is too imprecise.
             return true;
         }
 
         // Add the property to the object, being careful not to update type information.
         DebugOnly<unsigned> slotSpan = baseobj->slotSpan();
         MOZ_ASSERT(!baseobj->containsPure(id));
@@ -2947,25 +2947,25 @@ AnalyzePoppedThis(JSContext *cx, ObjectG
         {
             if (!callerResumePoints.append(rp))
                 return false;
         }
 
         for (int i = callerResumePoints.length() - 1; i >= 0; i--) {
             MResumePoint *rp = callerResumePoints[i];
             JSScript *script = rp->block()->info().script();
-            types::TypeNewScript::Initializer entry(types::TypeNewScript::Initializer::SETPROP_FRAME,
-                                                    script->pcToOffset(rp->pc()));
+            TypeNewScript::Initializer entry(TypeNewScript::Initializer::SETPROP_FRAME,
+                                             script->pcToOffset(rp->pc()));
             if (!initializerList->append(entry))
                 return false;
         }
 
         JSScript *script = ins->block()->info().script();
-        types::TypeNewScript::Initializer entry(types::TypeNewScript::Initializer::SETPROP,
-                                                script->pcToOffset(setprop->resumePoint()->pc()));
+        TypeNewScript::Initializer entry(TypeNewScript::Initializer::SETPROP,
+                                         script->pcToOffset(setprop->resumePoint()->pc()));
         if (!initializerList->append(entry))
             return false;
 
         *phandled = true;
         return true;
     }
 
     if (ins->isCallGetProperty()) {
@@ -2981,17 +2981,17 @@ AnalyzePoppedThis(JSContext *cx, ObjectG
          *   is not later added as one. Since the definite properties are
          *   added to the object at the point of its creation, reading a
          *   definite property before it is assigned could incorrectly hit.
          */
         RootedId id(cx, NameToId(get->name()));
         if (!baseobj->lookup(cx, id) && !accessedProperties->append(get->name()))
             return false;
 
-        if (!types::AddClearDefiniteGetterSetterForPrototypeChain(cx, group, id)) {
+        if (!AddClearDefiniteGetterSetterForPrototypeChain(cx, group, id)) {
             // The |this| value can escape if any property reads it does go
             // through a getter.
             return true;
         }
 
         *phandled = true;
         return true;
     }
@@ -3009,17 +3009,17 @@ CmpInstructions(const void *a, const voi
 {
     return (*static_cast<MInstruction * const *>(a))->id() -
            (*static_cast<MInstruction * const *>(b))->id();
 }
 
 bool
 jit::AnalyzeNewScriptDefiniteProperties(JSContext *cx, JSFunction *fun,
                                         ObjectGroup *group, HandlePlainObject baseobj,
-                                        Vector<types::TypeNewScript::Initializer> *initializerList)
+                                        Vector<TypeNewScript::Initializer> *initializerList)
 {
     MOZ_ASSERT(cx->zone()->types.activeAnalysis);
 
     // When invoking 'new' on the specified script, try to find some properties
     // which will definitely be added to the created object before it has a
     // chance to escape and be accessed elsewhere.
 
     RootedScript script(cx, fun->getOrCreateScript(cx));
@@ -3045,32 +3045,32 @@ jit::AnalyzeNewScriptDefiniteProperties(
     if (!script->hasBaselineScript()) {
         MethodStatus status = BaselineCompile(cx, script);
         if (status == Method_Error)
             return false;
         if (status != Method_Compiled)
             return true;
     }
 
-    types::TypeScript::SetThis(cx, script, types::Type::ObjectType(group));
+    TypeScript::SetThis(cx, script, TypeSet::ObjectType(group));
 
     MIRGraph graph(&temp);
     InlineScriptTree *inlineScriptTree = InlineScriptTree::New(&temp, nullptr, nullptr, script);
     if (!inlineScriptTree)
         return false;
 
     CompileInfo info(script, fun,
                      /* osrPc = */ nullptr, /* constructing = */ false,
                      Analysis_DefiniteProperties,
                      script->needsArgsObj(),
                      inlineScriptTree);
 
     const OptimizationInfo *optimizationInfo = js_IonOptimizations.get(Optimization_Normal);
 
-    types::CompilerConstraintList *constraints = types::NewCompilerConstraintList(temp);
+    CompilerConstraintList *constraints = NewCompilerConstraintList(temp);
     if (!constraints) {
         js_ReportOutOfMemory(cx);
         return false;
     }
 
     BaselineInspector inspector(script);
     const JitCompileOptions options(cx);
 
@@ -3078,17 +3078,17 @@ jit::AnalyzeNewScriptDefiniteProperties(
                        &inspector, &info, optimizationInfo, /* baselineFrame = */ nullptr);
 
     if (!builder.build()) {
         if (builder.abortReason() == AbortReason_Alloc)
             return false;
         return true;
     }
 
-    types::FinishDefinitePropertiesAnalysis(cx, constraints);
+    FinishDefinitePropertiesAnalysis(cx, constraints);
 
     if (!SplitCriticalEdges(graph))
         return false;
 
     if (!RenumberBlocks(graph))
         return false;
 
     if (!BuildDominatorTree(graph))
@@ -3178,17 +3178,17 @@ jit::AnalyzeNewScriptDefiniteProperties(
         for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) {
             // Inlining decisions made after the last new property was added to
             // the object don't need to be frozen.
             if (block->id() > lastAddedBlock)
                 break;
             if (MResumePoint *rp = block->callerResumePoint()) {
                 if (block->numPredecessors() == 1 && block->getPredecessor(0) == rp->block()) {
                     JSScript *script = rp->block()->info().script();
-                    if (!types::AddClearDefiniteFunctionUsesInScript(cx, group, script, block->info().script()))
+                    if (!AddClearDefiniteFunctionUsesInScript(cx, group, script, block->info().script()))
                         return false;
                 }
             }
         }
     }
 
     return true;
 }
@@ -3229,17 +3229,17 @@ ArgumentsUseCanBeLazy(JSContext *cx, JSS
 
     return false;
 }
 
 bool
 jit::AnalyzeArgumentsUsage(JSContext *cx, JSScript *scriptArg)
 {
     RootedScript script(cx, scriptArg);
-    types::AutoEnterAnalysis enter(cx);
+    AutoEnterAnalysis enter(cx);
 
     MOZ_ASSERT(!script->analyzedArgsUsage());
 
     // Treat the script as needing an arguments object until we determine it
     // does not need one. This both allows us to easily see where the arguments
     // object can escape through assignments to the function's named arguments,
     // and also simplifies handling of early returns.
     script->setNeedsArgsObj(true);
@@ -3288,17 +3288,17 @@ jit::AnalyzeArgumentsUsage(JSContext *cx
     CompileInfo info(script, script->functionNonDelazifying(),
                      /* osrPc = */ nullptr, /* constructing = */ false,
                      Analysis_ArgumentsUsage,
                      /* needsArgsObj = */ true,
                      inlineScriptTree);
 
     const OptimizationInfo *optimizationInfo = js_IonOptimizations.get(Optimization_Normal);
 
-    types::CompilerConstraintList *constraints = types::NewCompilerConstraintList(temp);
+    CompilerConstraintList *constraints = NewCompilerConstraintList(temp);
     if (!constraints)
         return false;
 
     BaselineInspector inspector(script);
     const JitCompileOptions options(cx);
 
     IonBuilder builder(nullptr, CompileCompartment::get(cx->compartment()), options, &temp, &graph, constraints,
                        &inspector, &info, optimizationInfo, /* baselineFrame = */ nullptr);
--- a/js/src/jit/IonAnalysis.h
+++ b/js/src/jit/IonAnalysis.h
@@ -166,17 +166,17 @@ ConvertLinearSum(TempAllocator &alloc, M
 // Convert the test 'sum >= 0' to a comparison, adding any necessary
 // instructions to the end of block.
 MCompare *
 ConvertLinearInequality(TempAllocator &alloc, MBasicBlock *block, const LinearSum &sum);
 
 bool
 AnalyzeNewScriptDefiniteProperties(JSContext *cx, JSFunction *fun,
                                    ObjectGroup *group, HandlePlainObject baseobj,
-                                   Vector<types::TypeNewScript::Initializer> *initializerList);
+                                   Vector<TypeNewScript::Initializer> *initializerList);
 
 bool
 AnalyzeArgumentsUsage(JSContext *cx, JSScript *script);
 
 bool
 DeadIfUnused(const MDefinition *def);
 
 bool
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -40,24 +40,24 @@ using mozilla::Maybe;
 
 using JS::TrackedStrategy;
 using JS::TrackedOutcome;
 using JS::TrackedTypeSite;
 
 class jit::BaselineFrameInspector
 {
   public:
-    types::Type thisType;
+    TypeSet::Type thisType;
     JSObject *singletonScopeChain;
 
-    Vector<types::Type, 4, JitAllocPolicy> argTypes;
-    Vector<types::Type, 4, JitAllocPolicy> varTypes;
+    Vector<TypeSet::Type, 4, JitAllocPolicy> argTypes;
+    Vector<TypeSet::Type, 4, JitAllocPolicy> varTypes;
 
     explicit BaselineFrameInspector(TempAllocator *temp)
-      : thisType(types::Type::UndefinedType()),
+      : thisType(TypeSet::UndefinedType()),
         singletonScopeChain(nullptr),
         argTypes(*temp),
         varTypes(*temp)
     {}
 };
 
 BaselineFrameInspector *
 jit::NewBaselineFrameInspector(TempAllocator *temp, BaselineFrame *frame, CompileInfo *info)
@@ -67,58 +67,60 @@ jit::NewBaselineFrameInspector(TempAlloc
     BaselineFrameInspector *inspector = temp->lifoAlloc()->new_<BaselineFrameInspector>(temp);
     if (!inspector)
         return nullptr;
 
     // Note: copying the actual values into a temporary structure for use
     // during compilation could capture nursery pointers, so the values' types
     // are recorded instead.
 
-    inspector->thisType = types::GetMaybeUntrackedValueType(frame->thisValue());
+    inspector->thisType = TypeSet::GetMaybeUntrackedValueType(frame->thisValue());
 
     if (frame->scopeChain()->isSingleton())
         inspector->singletonScopeChain = frame->scopeChain();
 
     JSScript *script = frame->script();
 
     if (script->functionNonDelazifying()) {
         if (!inspector->argTypes.reserve(frame->numFormalArgs()))
             return nullptr;
         for (size_t i = 0; i < frame->numFormalArgs(); i++) {
             if (script->formalIsAliased(i)) {
-                inspector->argTypes.infallibleAppend(types::Type::UndefinedType());
+                inspector->argTypes.infallibleAppend(TypeSet::UndefinedType());
             } else if (!script->argsObjAliasesFormals()) {
-                types::Type type = types::GetMaybeUntrackedValueType(frame->unaliasedFormal(i));
+                TypeSet::Type type =
+                    TypeSet::GetMaybeUntrackedValueType(frame->unaliasedFormal(i));
                 inspector->argTypes.infallibleAppend(type);
             } else if (frame->hasArgsObj()) {
-                types::Type type = types::GetMaybeUntrackedValueType(frame->argsObj().arg(i));
+                TypeSet::Type type =
+                    TypeSet::GetMaybeUntrackedValueType(frame->argsObj().arg(i));
                 inspector->argTypes.infallibleAppend(type);
             } else {
-                inspector->argTypes.infallibleAppend(types::Type::UndefinedType());
+                inspector->argTypes.infallibleAppend(TypeSet::UndefinedType());
             }
         }
     }
 
     if (!inspector->varTypes.reserve(frame->script()->nfixed()))
         return nullptr;
     for (size_t i = 0; i < frame->script()->nfixed(); i++) {
         if (info->isSlotAliasedAtOsr(i + info->firstLocalSlot())) {
-            inspector->varTypes.infallibleAppend(types::Type::UndefinedType());
+            inspector->varTypes.infallibleAppend(TypeSet::UndefinedType());
         } else {
-            types::Type type = types::GetMaybeUntrackedValueType(frame->unaliasedLocal(i));
+            TypeSet::Type type = TypeSet::GetMaybeUntrackedValueType(frame->unaliasedLocal(i));
             inspector->varTypes.infallibleAppend(type);
         }
     }
 
     return inspector;
 }
 
 IonBuilder::IonBuilder(JSContext *analysisContext, CompileCompartment *comp,
                        const JitCompileOptions &options, TempAllocator *temp,
-                       MIRGraph *graph, types::CompilerConstraintList *constraints,
+                       MIRGraph *graph, CompilerConstraintList *constraints,
                        BaselineInspector *inspector, CompileInfo *info,
                        const OptimizationInfo *optimizationInfo,
                        BaselineFrameInspector *baselineFrame, size_t inliningDepth,
                        uint32_t loopDepth)
   : MIRGenerator(comp, options, temp, graph, info, optimizationInfo),
     backgroundCodegen_(nullptr),
     actionableAbortScript_(nullptr),
     actionableAbortPc_(nullptr),
@@ -318,30 +320,30 @@ IonBuilder::CFGState::TableSwitch(jsbyte
     state.tableswitch.exitpc = exitpc;
     state.tableswitch.breaks = nullptr;
     state.tableswitch.ins = ins;
     state.tableswitch.currentBlock = 0;
     return state;
 }
 
 JSFunction *
-IonBuilder::getSingleCallTarget(types::TemporaryTypeSet *calleeTypes)
+IonBuilder::getSingleCallTarget(TemporaryTypeSet *calleeTypes)
 {
     if (!calleeTypes)
         return nullptr;
 
     JSObject *obj = calleeTypes->maybeSingleton();
     if (!obj || !obj->is<JSFunction>())
         return nullptr;
 
     return &obj->as<JSFunction>();
 }
 
 bool
-IonBuilder::getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constructing,
+IonBuilder::getPolyCallTargets(TemporaryTypeSet *calleeTypes, bool constructing,
                                ObjectVector &targets, uint32_t maxTargets)
 {
     MOZ_ASSERT(targets.empty());
 
     if (!calleeTypes)
         return true;
 
     if (calleeTypes->baseFlags() != 0)
@@ -496,17 +498,17 @@ IonBuilder::canInlineTarget(JSFunction *
         return DontInline(inlineScript, "Script that needs an arguments object");
     }
 
     if (inlineScript->isDebuggee()) {
         trackOptimizationOutcome(TrackedOutcome::CantInlineDebuggee);
         return DontInline(inlineScript, "Script is debuggee");
     }
 
-    types::TypeSetObjectKey *targetKey = types::TypeSetObjectKey::get(target);
+    TypeSet::ObjectKey *targetKey = TypeSet::ObjectKey::get(target);
     if (targetKey->unknownProperties()) {
         trackOptimizationOutcome(TrackedOutcome::CantInlineUnknownProps);
         return DontInline(inlineScript, "Target type has unknown properties");
     }
 
     return InliningDecision_Inline;
 }
 
@@ -590,17 +592,17 @@ IonBuilder::analyzeNewLoopTypes(MBasicBl
             continue;
 
         MPhi *phi = entry->getSlot(slot)->toPhi();
 
         if (*last == JSOP_POS)
             last = earlier;
 
         if (js_CodeSpec[*last].format & JOF_TYPESET) {
-            types::TemporaryTypeSet *typeSet = bytecodeTypes(last);
+            TemporaryTypeSet *typeSet = bytecodeTypes(last);
             if (!typeSet->empty()) {
                 MIRType type = typeSet->getKnownMIRType();
                 if (!phi->addBackedgeType(type, typeSet))
                     return false;
             }
         } else if (*last == JSOP_GETLOCAL || *last == JSOP_GETARG) {
             uint32_t slot = (*last == JSOP_GETLOCAL)
                             ? info().localSlot(GET_LOCALNO(last))
@@ -712,21 +714,18 @@ IonBuilder::pushLoop(CFGState::State ini
     state.loop.initialStopAt = stopAt;
     state.loop.loopHead = loopHead;
     return cfgStack_.append(state);
 }
 
 bool
 IonBuilder::init()
 {
-    if (!types::TypeScript::FreezeTypeSets(constraints(), script(),
-                                           &thisTypes, &argTypes, &typeArray))
-    {
-        return false;
-    }
+    if (!TypeScript::FreezeTypeSets(constraints(), script(), &thisTypes, &argTypes, &typeArray))
+        return false;
 
     if (inlineCallInfo_) {
         // If we're inlining, the actual this/argument types are not necessarily
         // a subset of the script's observed types. |argTypes| is never accessed
         // for inlined scripts, so we just null it.
         thisTypes = inlineCallInfo_->thisArg()->resultTypeSet();
         argTypes = nullptr;
     }
@@ -737,17 +736,17 @@ IonBuilder::init()
     // The baseline script normally has the bytecode type map, but compute
     // it ourselves if we do not have a baseline script.
     if (script()->hasBaselineScript()) {
         bytecodeTypeMap = script()->baselineScript()->bytecodeTypeMap();
     } else {
         bytecodeTypeMap = alloc_->lifoAlloc()->newArrayUninitialized<uint32_t>(script()->nTypeSets());
         if (!bytecodeTypeMap)
             return false;
-        types::FillBytecodeTypeMap(script(), bytecodeTypeMap);
+        FillBytecodeTypeMap(script(), bytecodeTypeMap);
     }
 
     return true;
 }
 
 bool
 IonBuilder::build()
 {
@@ -1027,17 +1026,17 @@ IonBuilder::buildInline(IonBuilder *call
     return true;
 }
 
 void
 IonBuilder::rewriteParameter(uint32_t slotIdx, MDefinition *param, int32_t argIndex)
 {
     MOZ_ASSERT(param->isParameter() || param->isGetArgumentsObjectArg());
 
-    types::TemporaryTypeSet *types = param->resultTypeSet();
+    TemporaryTypeSet *types = param->resultTypeSet();
     MDefinition *actual = ensureDefiniteType(param, types->getKnownMIRType());
     if (actual == param)
         return;
 
     // Careful! We leave the original MParameter in the entry resume point. The
     // arguments still need to be checked unless proven otherwise at the call
     // site, and these checks can bailout. We can end up:
     //   v0 = Parameter(0)
@@ -1079,17 +1078,17 @@ IonBuilder::initParameters()
     if (thisTypes->empty() && baselineFrame_)
         thisTypes->addType(baselineFrame_->thisType, alloc_->lifoAlloc());
 
     MParameter *param = MParameter::New(alloc(), MParameter::THIS_SLOT, thisTypes);
     current->add(param);
     current->initSlot(info().thisSlot(), param);
 
     for (uint32_t i = 0; i < info().nargs(); i++) {
-        types::TemporaryTypeSet *types = &argTypes[i];
+        TemporaryTypeSet *types = &argTypes[i];
         if (types->empty() && baselineFrame_ &&
             !script_->baselineScript()->modifiesArguments())
         {
             types->addType(baselineFrame_->argTypes[i], alloc_->lifoAlloc());
         }
 
         param = MParameter::New(alloc(), i, types);
         current->add(param);
@@ -1181,17 +1180,17 @@ IonBuilder::initArgumentsObject()
     MCreateArgumentsObject *argsObj = MCreateArgumentsObject::New(alloc(), current->scopeChain());
     current->add(argsObj);
     current->setArgumentsObject(argsObj);
     return true;
 }
 
 bool
 IonBuilder::addOsrValueTypeBarrier(uint32_t slot, MInstruction **def_,
-                                   MIRType type, types::TemporaryTypeSet *typeSet)
+                                   MIRType type, TemporaryTypeSet *typeSet)
 {
     MInstruction *&def = *def_;
     MBasicBlock *osrBlock = def->block();
 
     // Clear bogus type information added in newOsrPreheader().
     def->setResultType(MIRType_Value);
     def->setResultTypeSet(nullptr);
 
@@ -1201,19 +1200,19 @@ IonBuilder::addOsrValueTypeBarrier(uint3
         osrBlock->rewriteSlot(slot, barrier);
         def = barrier;
     } else if (type == MIRType_Null ||
                type == MIRType_Undefined ||
                type == MIRType_MagicOptimizedArguments)
     {
         // No unbox instruction will be added below, so check the type by
         // adding a type barrier for a singleton type set.
-        types::Type ntype = types::Type::PrimitiveType(ValueTypeFromMIRType(type));
+        TypeSet::Type ntype = TypeSet::PrimitiveType(ValueTypeFromMIRType(type));
         LifoAlloc *lifoAlloc = alloc().lifoAlloc();
-        typeSet = lifoAlloc->new_<types::TemporaryTypeSet>(lifoAlloc, ntype);
+        typeSet = lifoAlloc->new_<TemporaryTypeSet>(lifoAlloc, ntype);
         if (!typeSet)
             return false;
         MInstruction *barrier = MTypeBarrier::New(alloc(), def, typeSet);
         osrBlock->insertBefore(osrBlock->lastIns(), barrier);
         osrBlock->rewriteSlot(slot, barrier);
         def = barrier;
     }
 
@@ -1310,17 +1309,17 @@ IonBuilder::maybeAddOsrTypeBarriers()
         if (info().isSlotAliasedAtOsr(slot))
             continue;
 
         MInstruction *def = osrBlock->getSlot(slot)->toInstruction();
         MPhi *preheaderPhi = preheader->getSlot(slot)->toPhi();
         MPhi *headerPhi = headerRp->getOperand(slot)->toPhi();
 
         MIRType type = headerPhi->type();
-        types::TemporaryTypeSet *typeSet = headerPhi->resultTypeSet();
+        TemporaryTypeSet *typeSet = headerPhi->resultTypeSet();
 
         if (!addOsrValueTypeBarrier(slot, &def, type, typeSet))
             return false;
 
         preheaderPhi->replaceOperand(OSR_PHI_POSITION, def);
         preheaderPhi->setResultType(type);
         preheaderPhi->setResultTypeSet(typeSet);
     }
@@ -3279,33 +3278,33 @@ IonBuilder::tableSwitch(JSOp op, jssrcno
     if (!cfgStack_.append(state))
         return ControlStatus_Error;
 
     pc = current->pc();
     return ControlStatus_Jumped;
 }
 
 bool
-IonBuilder::replaceTypeSet(MDefinition *subject, types::TemporaryTypeSet *type, MTest *test)
+IonBuilder::replaceTypeSet(MDefinition *subject, TemporaryTypeSet *type, MTest *test)
 {
     if (type->unknown())
         return true;
 
     MInstruction *replace = nullptr;
     MDefinition *ins;
 
     for (uint32_t i = 0; i < current->stackDepth(); i++) {
         ins = current->getSlot(i);
 
         // Instead of creating a new MFilterTypeSet, try to update the old one.
         if (ins->isFilterTypeSet() && ins->getOperand(0) == subject &&
             ins->dependency() == test)
         {
-            types::TemporaryTypeSet *intersect =
-                types::TypeSet::intersectSets(ins->resultTypeSet(), type, alloc_->lifoAlloc());
+            TemporaryTypeSet *intersect =
+                TypeSet::intersectSets(ins->resultTypeSet(), type, alloc_->lifoAlloc());
             if (!intersect)
                 return false;
 
             ins->toFilterTypeSet()->setResultType(intersect->getKnownMIRType());
             ins->toFilterTypeSet()->setResultTypeSet(intersect);
 
             if (ins->type() == MIRType_Undefined)
                 current->setSlot(i, constant(UndefinedValue()));
@@ -3441,38 +3440,38 @@ IonBuilder::improveTypesAtCompare(MCompa
         !subject->mightBeType(MIRType_Null))
     {
         return true;
     }
 
     if (!altersUndefined && !altersNull)
         return true;
 
-    types::TemporaryTypeSet *type;
+    TemporaryTypeSet *type;
 
     // Decide if we need to filter the type or set it.
     if ((op == JSOP_STRICTEQ || op == JSOP_EQ) ^ trueBranch) {
         // Filter undefined/null
         type = subject->resultTypeSet()->filter(alloc_->lifoAlloc(), altersUndefined,
                                                                      altersNull);
     } else {
         // Set undefined/null.
         uint32_t flags = 0;
         if (altersUndefined) {
-            flags |= types::TYPE_FLAG_UNDEFINED;
+            flags |= TYPE_FLAG_UNDEFINED;
             // If TypeSet emulates undefined, then we cannot filter the objects.
             if (subject->resultTypeSet()->maybeEmulatesUndefined(constraints()))
-                flags |= types::TYPE_FLAG_ANYOBJECT;
+                flags |= TYPE_FLAG_ANYOBJECT;
         }
 
         if (altersNull)
-            flags |= types::TYPE_FLAG_NULL;
-
-        types::TemporaryTypeSet base(flags, static_cast<types::TypeSetObjectKey**>(nullptr));
-        type = types::TypeSet::intersectSets(&base, subject->resultTypeSet(), alloc_->lifoAlloc());
+            flags |= TYPE_FLAG_NULL;
+
+        TemporaryTypeSet base(flags, static_cast<TypeSet::ObjectKey**>(nullptr));
+        type = TypeSet::intersectSets(&base, subject->resultTypeSet(), alloc_->lifoAlloc());
     }
 
     if (!type)
         return false;
 
     return replaceTypeSet(subject, type, test);
 }
 
@@ -3486,23 +3485,23 @@ IonBuilder::improveTypesAtTest(MDefiniti
     // default behavior must return.  The default behavior assumes that a true
     // test means the incoming ins is not null or undefined and that a false
     // tests means it's one of null, undefined, false, 0, "", and objects
     // emulating undefined
     switch (ins->op()) {
       case MDefinition::Op_Not:
         return improveTypesAtTest(ins->toNot()->getOperand(0), !trueBranch, test);
       case MDefinition::Op_IsObject: {
-        types::TemporaryTypeSet *oldType = ins->getOperand(0)->resultTypeSet();
+        TemporaryTypeSet *oldType = ins->getOperand(0)->resultTypeSet();
         if (!oldType)
             return true;
         if (oldType->unknown() || !oldType->mightBeMIRType(MIRType_Object))
             return true;
 
-        types::TemporaryTypeSet *type = nullptr;
+        TemporaryTypeSet *type = nullptr;
         if (trueBranch)
             type = oldType->cloneObjectsOnly(alloc_->lifoAlloc());
         else
             type = oldType->cloneWithoutObjects(alloc_->lifoAlloc());
 
         if (!type)
             return false;
 
@@ -3559,49 +3558,49 @@ IonBuilder::improveTypesAtTest(MDefiniti
     // By default MTest tests ToBoolean(input). As a result in the true branch we can filter
     // undefined and null. In false branch we can only encounter undefined, null, false, 0, ""
     // and objects that emulate undefined.
 
     // If ins does not have a typeset we return as we cannot optimize.
     if (!ins->resultTypeSet() || ins->resultTypeSet()->unknown())
         return true;
 
-    types::TemporaryTypeSet *oldType = ins->resultTypeSet();
-    types::TemporaryTypeSet *type;
+    TemporaryTypeSet *oldType = ins->resultTypeSet();
+    TemporaryTypeSet *type;
 
     // Decide either to set or filter.
     if (trueBranch) {
         // Filter undefined/null.
         if (!ins->mightBeType(MIRType_Undefined) &&
             !ins->mightBeType(MIRType_Null))
         {
             return true;
         }
         type = oldType->filter(alloc_->lifoAlloc(), true, true);
     } else {
         // According to the standards, we cannot filter out: Strings,
         // Int32, Double, Booleans, Objects (if they emulate undefined)
-        uint32_t flags = types::TYPE_FLAG_PRIMITIVE;
+        uint32_t flags = TYPE_FLAG_PRIMITIVE;
 
         // If the typeset does emulate undefined, then we cannot filter out
         // objects.
         if (oldType->maybeEmulatesUndefined(constraints()))
-            flags |= types::TYPE_FLAG_ANYOBJECT;
+            flags |= TYPE_FLAG_ANYOBJECT;
 
         // Only intersect the typesets if it will generate a more narrow
         // typeset. The first part takes care of primitives and AnyObject,
         // while the second line specific (type)objects.
-        if (!oldType->hasAnyFlag(~flags & types::TYPE_FLAG_BASE_MASK) &&
+        if (!oldType->hasAnyFlag(~flags & TYPE_FLAG_BASE_MASK) &&
             (oldType->maybeEmulatesUndefined(constraints()) || !oldType->maybeObject()))
         {
             return true;
         }
 
-        types::TemporaryTypeSet base(flags, static_cast<types::TypeSetObjectKey**>(nullptr));
-        type = types::TypeSet::intersectSets(&base, oldType, alloc_->lifoAlloc());
+        TemporaryTypeSet base(flags, static_cast<TypeSet::ObjectKey**>(nullptr));
+        type = TypeSet::intersectSets(&base, oldType, alloc_->lifoAlloc());
     }
 
     return replaceTypeSet(ins, type, test);
 }
 
 bool
 IonBuilder::jsop_label()
 {
@@ -4446,19 +4445,19 @@ IonBuilder::inlineScriptedCall(CallInfo 
 
     JSScript *calleeScript = target->nonLazyScript();
     BaselineInspector inspector(calleeScript);
 
     // Improve type information of |this| when not set.
     if (callInfo.constructing() &&
         !callInfo.thisArg()->resultTypeSet())
     {
-        types::StackTypeSet *types = types::TypeScript::ThisTypes(calleeScript);
+        StackTypeSet *types = TypeScript::ThisTypes(calleeScript);
         if (types && !types->unknown()) {
-            types::TemporaryTypeSet *clonedTypes = types->clone(alloc_->lifoAlloc());
+            TemporaryTypeSet *clonedTypes = types->clone(alloc_->lifoAlloc());
             if (!clonedTypes)
                 return oom();
             MTypeBarrier *barrier = MTypeBarrier::New(alloc(), callInfo.thisArg(), clonedTypes);
             current->add(barrier);
             if (barrier->type() == MIRType_Undefined)
                 callInfo.setThis(constant(UndefinedValue()));
             else if (barrier->type() == MIRType_Null)
                 callInfo.setThis(constant(NullValue()));
@@ -4579,17 +4578,17 @@ IonBuilder::patchInlinedReturn(CallInfo 
 
     return rdef;
 }
 
 MDefinition *
 IonBuilder::specializeInlinedReturn(MDefinition *rdef, MBasicBlock *exit)
 {
     // Remove types from the return definition that weren't observed.
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     // The observed typeset doesn't contain extra information.
     if (types->empty() || types->unknown())
         return rdef;
 
     // Decide if specializing is needed using the result typeset if available,
     // else use the result type.
 
@@ -4753,17 +4752,17 @@ IonBuilder::makeInliningDecision(JSObjec
             trackOptimizationOutcome(TrackedOutcome::CantInlineNotHot);
             JitSpew(JitSpew_Inlining, "Cannot inline %s:%u: callee is insufficiently hot.",
                     targetScript->filename(), targetScript->lineno());
             return InliningDecision_WarmUpCountTooLow;
         }
     }
 
     // TI calls ObjectStateChange to trigger invalidation of the caller.
-    types::TypeSetObjectKey *targetKey = types::TypeSetObjectKey::get(target);
+    TypeSet::ObjectKey *targetKey = TypeSet::ObjectKey::get(target);
     targetKey->watchStateChangeForInlinedCall(constraints());
 
     return InliningDecision_Inline;
 }
 
 bool
 IonBuilder::selectInliningTargets(const ObjectVector &targets, CallInfo &callInfo, BoolVector &choiceSet,
                                   uint32_t *numInlineable)
@@ -5229,17 +5228,17 @@ IonBuilder::inlineCalls(CallInfo &callIn
         if (choiceSet[i])
             count++;
     }
     retPhi->reserveLength(count);
 
     // During inlining the 'this' value is assigned a type set which is
     // specialized to the groups which can generate that inlining target.
     // After inlining the original type set is restored.
-    types::TemporaryTypeSet *cacheObjectTypeSet =
+    TemporaryTypeSet *cacheObjectTypeSet =
         maybeCache ? maybeCache->object()->resultTypeSet() : nullptr;
 
     // Inline each of the inlineable targets.
     MOZ_ASSERT(targets.length() == originals.length());
     for (uint32_t i = 0; i < targets.length(); i++) {
         // Target must be inlineable.
         if (!choiceSet[i])
             continue;
@@ -5286,17 +5285,17 @@ IonBuilder::inlineCalls(CallInfo &callIn
         CallInfo inlineInfo(alloc(), callInfo.constructing());
         if (!inlineInfo.init(callInfo))
             return false;
         inlineInfo.popFormals(inlineBlock);
         inlineInfo.setFun(funcDef);
 
         if (maybeCache) {
             MOZ_ASSERT(callInfo.thisArg() == maybeCache->object());
-            types::TemporaryTypeSet *targetThisTypes =
+            TemporaryTypeSet *targetThisTypes =
                 maybeCache->propTable()->buildTypeSetForFunction(original);
             if (!targetThisTypes)
                 return false;
             maybeCache->object()->setResultTypeSet(targetThisTypes);
         }
 
         // Inline the call into the inlineBlock.
         if (!setCurrentAndSpecializePhis(inlineBlock))
@@ -5511,22 +5510,22 @@ IonBuilder::createThisScripted(MDefiniti
     current->add(createThis);
 
     return createThis;
 }
 
 JSObject *
 IonBuilder::getSingletonPrototype(JSFunction *target)
 {
-    types::TypeSetObjectKey *targetKey = types::TypeSetObjectKey::get(target);
+    TypeSet::ObjectKey *targetKey = TypeSet::ObjectKey::get(target);
     if (targetKey->unknownProperties())
         return nullptr;
 
     jsid protoid = NameToId(names().prototype);
-    types::HeapTypeSetKey protoProperty = targetKey->property(protoid);
+    HeapTypeSetKey protoProperty = targetKey->property(protoid);
 
     return protoProperty.singleton(constraints());
 }
 
 MDefinition *
 IonBuilder::createThisScriptedSingleton(JSFunction *target, MDefinition *callee)
 {
     // Get the singleton prototype (if exists)
@@ -5537,22 +5536,22 @@ IonBuilder::createThisScriptedSingleton(
     JSObject *templateObject = inspector->getTemplateObject(pc);
     if (!templateObject)
         return nullptr;
     if (!templateObject->is<PlainObject>() && !templateObject->is<UnboxedPlainObject>())
         return nullptr;
     if (templateObject->getProto() != proto)
         return nullptr;
 
-    types::TypeSetObjectKey *templateObjectKey = types::TypeSetObjectKey::get(templateObject->group());
+    TypeSet::ObjectKey *templateObjectKey = TypeSet::ObjectKey::get(templateObject->group());
     if (templateObjectKey->hasFlags(constraints(), OBJECT_FLAG_NEW_SCRIPT_CLEARED))
         return nullptr;
 
-    types::StackTypeSet *thisTypes = types::TypeScript::ThisTypes(target->nonLazyScript());
-    if (!thisTypes || !thisTypes->hasType(types::Type::ObjectType(templateObject)))
+    StackTypeSet *thisTypes = TypeScript::ThisTypes(target->nonLazyScript());
+    if (!thisTypes || !thisTypes->hasType(TypeSet::ObjectType(templateObject)))
         return nullptr;
 
     // Generate an inline path to create a new |this| object with
     // the given singleton prototype.
     MConstant *templateConst = MConstant::NewConstraintlessObject(alloc(), templateObject);
     MCreateThisWithTemplate *createThis =
         MCreateThisWithTemplate::New(alloc(), constraints(), templateConst,
                                      templateObject->group()->initialHeap(constraints()));
@@ -5599,28 +5598,28 @@ IonBuilder::jsop_funcall(uint32_t argc)
     // argc:   argN
     // argc+1: JSFunction*, the 'f' in |f.call()|, in |this| position.
     // argc+2: The native 'call' function.
 
     int calleeDepth = -((int)argc + 2);
     int funcDepth = -((int)argc + 1);
 
     // If |Function.prototype.call| may be overridden, don't optimize callsite.
-    types::TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
+    TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
     JSFunction *native = getSingleCallTarget(calleeTypes);
     if (!native || !native->isNative() || native->native() != &js_fun_call) {
         CallInfo callInfo(alloc(), false);
         if (!callInfo.init(current, argc))
             return false;
         return makeCall(native, callInfo, false);
     }
     current->peek(calleeDepth)->setImplicitlyUsedUnchecked();
 
     // Extract call target.
-    types::TemporaryTypeSet *funTypes = current->peek(funcDepth)->resultTypeSet();
+    TemporaryTypeSet *funTypes = current->peek(funcDepth)->resultTypeSet();
     JSFunction *target = getSingleCallTarget(funTypes);
 
     // Shimmy the slots down to remove the native 'call' function.
     current->shimmySlots(funcDepth - 1);
 
     bool zeroArguments = (argc == 0);
 
     // If no |this| argument was provided, explicitly pass Undefined.
@@ -5656,17 +5655,17 @@ IonBuilder::jsop_funcall(uint32_t argc)
     return makeCall(target, callInfo, false);
 }
 
 bool
 IonBuilder::jsop_funapply(uint32_t argc)
 {
     int calleeDepth = -((int)argc + 2);
 
-    types::TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
+    TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
     JSFunction *native = getSingleCallTarget(calleeTypes);
     if (argc != 2 || info().analysisMode() == Analysis_ArgumentsUsage) {
         CallInfo callInfo(alloc(), false);
         if (!callInfo.init(current, argc))
             return false;
         return makeCall(native, callInfo, false);
     }
 
@@ -5706,17 +5705,17 @@ IonBuilder::jsop_funapplyarguments(uint3
     // 1:      Vp
     // 2:      This
     // argc+1: JSFunction*, the 'f' in |f.call()|, in |this| position.
     // argc+2: The native 'apply' function.
 
     int funcDepth = -((int)argc + 1);
 
     // Extract call target.
-    types::TemporaryTypeSet *funTypes = current->peek(funcDepth)->resultTypeSet();
+    TemporaryTypeSet *funTypes = current->peek(funcDepth)->resultTypeSet();
     JSFunction *target = getSingleCallTarget(funTypes);
 
     // When this script isn't inlined, use MApplyArgs,
     // to copy the arguments from the stack and call the function
     if (inliningDepth_ == 0 && info().analysisMode() != Analysis_DefiniteProperties) {
         // The array argument corresponds to the arguments object. As the JIT
         // is implicitly reading the arguments object in the next instruction,
         // we need to prevent the deletion of the arguments object from resume
@@ -5737,17 +5736,17 @@ IonBuilder::jsop_funapplyarguments(uint3
         current->add(numArgs);
 
         MApplyArgs *apply = MApplyArgs::New(alloc(), target, argFunc, numArgs, argThis);
         current->add(apply);
         current->push(apply);
         if (!resumeAfter(apply))
             return false;
 
-        types::TemporaryTypeSet *types = bytecodeTypes(pc);
+        TemporaryTypeSet *types = bytecodeTypes(pc);
         return pushTypeBarrier(apply, types, BarrierKind::TypeSet);
     }
 
     // When inlining we have the arguments the function gets called with
     // and can optimize even more, by just calling the functions with the args.
     // We also try this path when doing the definite properties analysis, as we
     // can inline the apply() target and don't care about the actual arguments
     // that were passed in.
@@ -5794,33 +5793,33 @@ IonBuilder::jsop_funapplyarguments(uint3
 
 bool
 IonBuilder::jsop_call(uint32_t argc, bool constructing)
 {
     startTrackingOptimizations();
 
     // If this call has never executed, try to seed the observed type set
     // based on how the call result is used.
-    types::TemporaryTypeSet *observed = bytecodeTypes(pc);
+    TemporaryTypeSet *observed = bytecodeTypes(pc);
     if (observed->empty()) {
         if (BytecodeFlowsToBitop(pc)) {
-            observed->addType(types::Type::Int32Type(), alloc_->lifoAlloc());
+            observed->addType(TypeSet::Int32Type(), alloc_->lifoAlloc());
         } else if (*GetNextPc(pc) == JSOP_POS) {
             // Note: this is lame, overspecialized on the code patterns used
             // by asm.js and should be replaced by a more general mechanism.
             // See bug 870847.
-            observed->addType(types::Type::DoubleType(), alloc_->lifoAlloc());
+            observed->addType(TypeSet::DoubleType(), alloc_->lifoAlloc());
         }
     }
 
     int calleeDepth = -((int)argc + 2);
 
     // Acquire known call target if existent.
     ObjectVector originals(alloc());
-    types::TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
+    TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
     if (calleeTypes && !getPolyCallTargets(calleeTypes, constructing, originals, 4))
         return false;
 
     // If any call targets need to be cloned, look for existing clones to use.
     // Keep track of the originals as we need to case on them for poly inline.
     bool hasClones = false;
     ObjectVector targets(alloc());
     if (!targets.reserve(originals.length()))
@@ -5884,18 +5883,17 @@ IonBuilder::makeCallsiteClone(JSFunction
     // should have checked already that at least some targets are marked as
     // should-clone-at-callsite.
     MCallsiteCloneCache *clone = MCallsiteCloneCache::New(alloc(), fun, pc);
     current->add(clone);
     return clone;
 }
 
 bool
-IonBuilder::testShouldDOMCall(types::TypeSet *inTypes,
-                              JSFunction *func, JSJitInfo::OpType opType)
+IonBuilder::testShouldDOMCall(TypeSet *inTypes, JSFunction *func, JSJitInfo::OpType opType)
 {
     if (IsInsideNursery(func))
         return false;
 
     if (!func->isNative() || !func->jitInfo())
         return false;
 
     // If all the DOM objects flowing through are legal with this
@@ -5904,32 +5902,32 @@ IonBuilder::testShouldDOMCall(types::Typ
     DOMInstanceClassHasProtoAtDepth instanceChecker =
         compartment->runtime()->DOMcallbacks()->instanceClassMatchesProto;
 
     const JSJitInfo *jinfo = func->jitInfo();
     if (jinfo->type() != opType)
         return false;
 
     for (unsigned i = 0; i < inTypes->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = inTypes->getObject(i);
+        TypeSet::ObjectKey *key = inTypes->getObject(i);
         if (!key)
             continue;
 
         if (!key->hasStableClassAndProto(constraints()))
             return false;
 
         if (!instanceChecker(key->clasp(), jinfo->protoID, jinfo->depth))
             return false;
     }
 
     return true;
 }
 
 static bool
-ArgumentTypesMatch(MDefinition *def, types::StackTypeSet *calleeTypes)
+ArgumentTypesMatch(MDefinition *def, StackTypeSet *calleeTypes)
 {
     if (!calleeTypes)
         return false;
 
     if (def->resultTypeSet()) {
         MOZ_ASSERT(def->type() == MIRType_Value || def->mightBeType(def->type()));
         return def->resultTypeSet()->isSubset(calleeTypes);
     }
@@ -5949,25 +5947,25 @@ IonBuilder::testNeedsArgumentCheck(JSFun
     // If we have a known target, check if the caller arg types are a subset of callee.
     // Since typeset accumulates and can't decrease that means we don't need to check
     // the arguments anymore.
     if (!target->hasScript())
         return true;
 
     JSScript *targetScript = target->nonLazyScript();
 
-    if (!ArgumentTypesMatch(callInfo.thisArg(), types::TypeScript::ThisTypes(targetScript)))
+    if (!ArgumentTypesMatch(callInfo.thisArg(), TypeScript::ThisTypes(targetScript)))
         return true;
     uint32_t expected_args = Min<uint32_t>(callInfo.argc(), target->nargs());
     for (size_t i = 0; i < expected_args; i++) {
-        if (!ArgumentTypesMatch(callInfo.getArg(i), types::TypeScript::ArgTypes(targetScript, i)))
+        if (!ArgumentTypesMatch(callInfo.getArg(i), TypeScript::ArgTypes(targetScript, i)))
             return true;
     }
     for (size_t i = callInfo.argc(); i < target->nargs(); i++) {
-        if (!types::TypeScript::ArgTypes(targetScript, i)->mightBeMIRType(MIRType_Undefined))
+        if (!TypeScript::ArgTypes(targetScript, i)->mightBeMIRType(MIRType_Undefined))
             return true;
     }
 
     return false;
 }
 
 MCall *
 IonBuilder::makeCallHelper(JSFunction *target, CallInfo &callInfo, bool cloneAtCallsite)
@@ -5982,17 +5980,17 @@ IonBuilder::makeCallHelper(JSFunction *t
     if (target && !target->isNative())
         targetArgs = Max<uint32_t>(target->nargs(), callInfo.argc());
 
     bool isDOMCall = false;
     if (target && !callInfo.constructing()) {
         // We know we have a single call target.  Check whether the "this" types
         // are DOM types and our function a DOM function, and if so flag the
         // MCall accordingly.
-        types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+        TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
         if (thisTypes &&
             thisTypes->getKnownMIRType() == MIRType_Object &&
             thisTypes->isDOMClass(constraints()) &&
             testShouldDOMCall(thisTypes, target, JSJitInfo::Method))
         {
             isDOMCall = true;
         }
     }
@@ -6046,17 +6044,17 @@ IonBuilder::makeCallHelper(JSFunction *t
 
     call->initFunction(callInfo.fun());
 
     current->add(call);
     return call;
 }
 
 static bool
-DOMCallNeedsBarrier(const JSJitInfo* jitinfo, types::TemporaryTypeSet *types)
+DOMCallNeedsBarrier(const JSJitInfo* jitinfo, TemporaryTypeSet *types)
 {
     // If the return type of our DOM native is in "types" already, we don't
     // actually need a barrier.
     if (jitinfo->returnType() == JSVAL_TYPE_UNKNOWN)
         return true;
 
     // JSVAL_TYPE_OBJECT doesn't tell us much; we still have to barrier on the
     // actual type of the object.
@@ -6078,29 +6076,29 @@ IonBuilder::makeCall(JSFunction *target,
     MCall *call = makeCallHelper(target, callInfo, cloneAtCallsite);
     if (!call)
         return false;
 
     current->push(call);
     if (call->isEffectful() && !resumeAfter(call))
         return false;
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     if (call->isCallDOMNative())
         return pushDOMTypeBarrier(call, types, call->getSingleTarget());
 
     return pushTypeBarrier(call, types, BarrierKind::TypeSet);
 }
 
 bool
 IonBuilder::jsop_eval(uint32_t argc)
 {
     int calleeDepth = -((int)argc + 2);
-    types::TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
+    TemporaryTypeSet *calleeTypes = current->peek(calleeDepth)->resultTypeSet();
 
     // Emit a normal call if the eval has never executed. This keeps us from
     // disabling compilation for the script when testing with --ion-eager.
     if (calleeTypes && calleeTypes->empty())
         return jsop_call(argc, /* constructing = */ false);
 
     JSFunction *singleton = getSingleCallTarget(calleeTypes);
     if (!singleton)
@@ -6133,17 +6131,17 @@ IonBuilder::jsop_eval(uint32_t argc)
 
         MDefinition *scopeChain = current->scopeChain();
         MDefinition *string = callInfo.getArg(0);
 
         // Direct eval acts as identity on non-string types according to
         // ES5 15.1.2.1 step 1.
         if (!string->mightBeType(MIRType_String)) {
             current->push(string);
-            types::TemporaryTypeSet *types = bytecodeTypes(pc);
+            TemporaryTypeSet *types = bytecodeTypes(pc);
             return pushTypeBarrier(string, types, BarrierKind::TypeSet);
         }
 
         current->pushSlot(info().thisSlot());
         MDefinition *thisValue = current->pop();
 
         // Try to pattern match 'eval(v + "()")'. In this case v is likely a
         // name on the scope chain and the eval is performing a call on that
@@ -6172,17 +6170,17 @@ IonBuilder::jsop_eval(uint32_t argc)
 
         MInstruction *filterArguments = MFilterArgumentsOrEval::New(alloc(), string);
         current->add(filterArguments);
 
         MInstruction *ins = MCallDirectEval::New(alloc(), scopeChain, string, thisValue, pc);
         current->add(ins);
         current->push(ins);
 
-        types::TemporaryTypeSet *types = bytecodeTypes(pc);
+        TemporaryTypeSet *types = bytecodeTypes(pc);
         return resumeAfter(ins) && pushTypeBarrier(ins, types, BarrierKind::TypeSet);
     }
 
     return jsop_call(argc, /* constructing = */ false);
 }
 
 bool
 IonBuilder::jsop_compare(JSOp op)
@@ -6232,20 +6230,20 @@ IonBuilder::jsop_newarray(uint32_t count
     current->add(templateConst);
 
     MNewArray *ins = MNewArray::New(alloc(), constraints(), count, templateConst,
                                     templateObject->group()->initialHeap(constraints()),
                                     NewArray_FullyAllocating);
     current->add(ins);
     current->push(ins);
 
-    types::TemporaryTypeSet::DoubleConversion conversion =
+    TemporaryTypeSet::DoubleConversion conversion =
         ins->resultTypeSet()->convertDoubleElements(constraints());
 
-    if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles)
+    if (conversion == TemporaryTypeSet::AlwaysConvertToDoubles)
         templateObject->as<ArrayObject>().setShouldConvertDoubleElements();
     else
         templateObject->as<ArrayObject>().clearShouldConvertDoubleElements();
     return true;
 }
 
 bool
 IonBuilder::jsop_newarray_copyonwrite()
@@ -6319,22 +6317,22 @@ IonBuilder::jsop_initelem_array()
 
     // Make sure that arrays have the type being written to them by the
     // intializer, and that arrays are marked as non-packed when writing holes
     // to them during initialization.
     bool needStub = false;
     if (obj->isUnknownValue()) {
         needStub = true;
     } else {
-        types::TypeSetObjectKey *initializer = obj->resultTypeSet()->getObject(0);
+        TypeSet::ObjectKey *initializer = obj->resultTypeSet()->getObject(0);
         if (value->type() == MIRType_MagicHole) {
             if (!initializer->hasFlags(constraints(), OBJECT_FLAG_NON_PACKED))
                 needStub = true;
         } else if (!initializer->unknownProperties()) {
-            types::HeapTypeSetKey elemTypes = initializer->property(JSID_VOID);
+            HeapTypeSetKey elemTypes = initializer->property(JSID_VOID);
             if (!TypeSetIncludes(elemTypes.maybeTypes(), value->type(), value->resultTypeSet())) {
                 elemTypes.freeze(constraints());
                 needStub = true;
             }
         }
     }
 
     if (NeedsPostBarrier(info(), value))
@@ -6723,30 +6721,30 @@ IonBuilder::newPendingLoopHeader(MBasicB
             // Don't bother with expression stack values. The stack should be
             // empty except for let variables (not Ion-compiled) or iterators.
             if (i >= info().firstStackSlot())
                 continue;
 
             MPhi *phi = block->getSlot(i)->toPhi();
 
             // Get the type from the baseline frame.
-            types::Type existingType = types::Type::UndefinedType();
+            TypeSet::Type existingType = TypeSet::UndefinedType();
             uint32_t arg = i - info().firstArgSlot();
             uint32_t var = i - info().firstLocalSlot();
             if (info().funMaybeLazy() && i == info().thisSlot())
                 existingType = baselineFrame_->thisType;
             else if (arg < info().nargs())
                 existingType = baselineFrame_->argTypes[arg];
             else
                 existingType = baselineFrame_->varTypes[var];
 
             // Extract typeset from value.
             LifoAlloc *lifoAlloc = alloc().lifoAlloc();
-            types::TemporaryTypeSet *typeSet =
-                lifoAlloc->new_<types::TemporaryTypeSet>(lifoAlloc, existingType);
+            TemporaryTypeSet *typeSet =
+                lifoAlloc->new_<TemporaryTypeSet>(lifoAlloc, existingType);
             if (!typeSet)
                 return nullptr;
             MIRType type = typeSet->getKnownMIRType();
             if (!phi->addBackedgeType(type, typeSet))
                 return nullptr;
         }
     }
 
@@ -6901,24 +6899,24 @@ IonBuilder::testSingletonProperty(JSObje
     // read on accesses to the object. If the property is later deleted or
     // reconfigured as a getter/setter then the type information for the
     // property will change and trigger invalidation.
 
     while (obj) {
         if (!ClassHasEffectlessLookup(obj->getClass(), name))
             return nullptr;
 
-        types::TypeSetObjectKey *objKey = types::TypeSetObjectKey::get(obj);
+        TypeSet::ObjectKey *objKey = TypeSet::ObjectKey::get(obj);
         if (analysisContext)
             objKey->ensureTrackedProperty(analysisContext, NameToId(name));
 
         if (objKey->unknownProperties())
             return nullptr;
 
-        types::HeapTypeSetKey property = objKey->property(NameToId(name));
+        HeapTypeSetKey property = objKey->property(NameToId(name));
         if (property.isOwnProperty(constraints())) {
             if (obj->isSingleton())
                 return property.singleton(constraints());
             return nullptr;
         }
 
         if (ClassHasResolveHook(compartment, obj->getClass(), name))
             return nullptr;
@@ -6935,17 +6933,17 @@ IonBuilder::testSingletonPropertyTypes(M
 {
     // As for TestSingletonProperty, but the input is any value in a type set
     // rather than a specific object. If testObject is set then the constant
     // result can only be used after ensuring the input is an object.
 
     *testObject = false;
     *testString = false;
 
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
     if (types && types->unknownObject())
         return false;
 
     JSObject *objectSingleton = types ? types->maybeSingleton() : nullptr;
     if (objectSingleton)
         return testSingletonProperty(objectSingleton, name) == singleton;
 
     JSProtoKey key;
@@ -6967,41 +6965,41 @@ IonBuilder::testSingletonPropertyTypes(M
         key = JSProto_Boolean;
         break;
 
       case MIRType_Object:
       case MIRType_Value: {
         if (!types)
             return false;
 
-        if (types->hasType(types::Type::StringType())) {
+        if (types->hasType(TypeSet::StringType())) {
             key = JSProto_String;
             *testString = true;
             break;
         }
 
         if (!types->maybeObject())
             return false;
 
         // For property accesses which may be on many objects, we just need to
         // find a prototype common to all the objects; if that prototype
         // has the singleton property, the access will not be on a missing property.
         for (unsigned i = 0; i < types->getObjectCount(); i++) {
-            types::TypeSetObjectKey *key = types->getObject(i);
+            TypeSet::ObjectKey *key = types->getObject(i);
             if (!key)
                 continue;
             if (analysisContext)
                 key->ensureTrackedProperty(analysisContext, NameToId(name));
 
             const Class *clasp = key->clasp();
             if (!ClassHasEffectlessLookup(clasp, name) || ClassHasResolveHook(compartment, clasp, name))
                 return false;
             if (key->unknownProperties())
                 return false;
-            types::HeapTypeSetKey property = key->property(NameToId(name));
+            HeapTypeSetKey property = key->property(NameToId(name));
             if (property.isOwnProperty(constraints()))
                 return false;
 
             if (JSObject *proto = key->proto().toObjectOrNull()) {
                 // Test this type.
                 if (testSingletonProperty(proto, name) != singleton)
                     return false;
             } else {
@@ -7020,17 +7018,17 @@ IonBuilder::testSingletonPropertyTypes(M
     JSObject *proto = GetBuiltinPrototypePure(&script()->global(), key);
     if (proto)
         return testSingletonProperty(proto, name) == singleton;
 
     return false;
 }
 
 bool
-IonBuilder::pushTypeBarrier(MDefinition *def, types::TemporaryTypeSet *observed, BarrierKind kind)
+IonBuilder::pushTypeBarrier(MDefinition *def, TemporaryTypeSet *observed, BarrierKind kind)
 {
     MOZ_ASSERT(def == current->peek(-1));
 
     MDefinition *replace = addTypeBarrier(current->pop(), observed, kind);
     if (!replace)
         return false;
 
     current->push(replace);
@@ -7040,17 +7038,17 @@ IonBuilder::pushTypeBarrier(MDefinition 
 // Given an observed type set, annotates the IR as much as possible:
 // (1) If no type information is provided, the given value is returned.
 // (2) If a single type definitely exists, and no type barrier is needed,
 //     then an infallible unbox instruction is returned.
 // (3) If a type barrier is needed, but has an unknown type set, the given
 //     value is returned.
 // (4) Lastly, a type barrier instruction is added and returned.
 MDefinition *
-IonBuilder::addTypeBarrier(MDefinition *def, types::TemporaryTypeSet *observed, BarrierKind kind,
+IonBuilder::addTypeBarrier(MDefinition *def, TemporaryTypeSet *observed, BarrierKind kind,
                            MTypeBarrier **pbarrier)
 {
     // Barriers are never needed for instructions whose result will not be used.
     if (BytecodeIsPopped(pc))
         return def;
 
     // If the instruction has no side effects, we'll resume the entire operation.
     // The actual type barrier will occur in the interpreter. If the
@@ -7076,17 +7074,17 @@ IonBuilder::addTypeBarrier(MDefinition *
         return constant(UndefinedValue());
     if (barrier->type() == MIRType_Null)
         return constant(NullValue());
 
     return barrier;
 }
 
 bool
-IonBuilder::pushDOMTypeBarrier(MInstruction *ins, types::TemporaryTypeSet *observed, JSFunction* func)
+IonBuilder::pushDOMTypeBarrier(MInstruction *ins, TemporaryTypeSet *observed, JSFunction* func)
 {
     MOZ_ASSERT(func && func->isNative() && func->jitInfo());
 
     const JSJitInfo *jitinfo = func->jitInfo();
     bool barrier = DOMCallNeedsBarrier(jitinfo, observed);
     // Need to be a bit careful: if jitinfo->returnType is JSVAL_TYPE_DOUBLE but
     // types->getKnownMIRType() is MIRType_Int32, then don't unconditionally
     // unbox as a double.  Instead, go ahead and barrier on having an int type,
@@ -7138,17 +7136,17 @@ IonBuilder::ensureDefiniteType(MDefiniti
       }
     }
 
     current->add(replace);
     return replace;
 }
 
 MDefinition *
-IonBuilder::ensureDefiniteTypeSet(MDefinition *def, types::TemporaryTypeSet *types)
+IonBuilder::ensureDefiniteTypeSet(MDefinition *def, TemporaryTypeSet *types)
 {
     // We cannot arbitrarily add a typeset to a definition. It can be shared
     // in another path. So we always need to create a new MIR.
 
     // Use ensureDefiniteType to do unboxing. If that happened the type can
     // be added on the newly created unbox operation.
     MDefinition *replace = ensureDefiniteType(def, types->getKnownMIRType());
     if (replace != def) {
@@ -7207,37 +7205,37 @@ IonBuilder::getStaticName(JSObject *stat
     // When not loading a known value on the global with a lexical check,
     // always emit the lexical check. This could be optimized, but is
     // currently not for simplicity's sake.
     if (lexicalCheck) {
         *psucceeded = false;
         return true;
     }
 
-    types::TypeSetObjectKey *staticKey = types::TypeSetObjectKey::get(staticObject);
+    TypeSet::ObjectKey *staticKey = TypeSet::ObjectKey::get(staticObject);
     if (analysisContext)
         staticKey->ensureTrackedProperty(analysisContext, NameToId(name));
 
     if (staticKey->unknownProperties()) {
         *psucceeded = false;
         return true;
     }
 
-    types::HeapTypeSetKey property = staticKey->property(id);
+    HeapTypeSetKey property = staticKey->property(id);
     if (!property.maybeTypes() ||
         !property.maybeTypes()->definiteProperty() ||
         property.nonData(constraints()))
     {
         // The property has been reconfigured as non-configurable, non-enumerable
         // or non-writable.
         *psucceeded = false;
         return true;
     }
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(), staticKey,
                                                        name, types, /* updateObserved = */ true);
 
     JSObject *singleton = types->maybeSingleton();
 
     MIRType knownType = types->getKnownMIRType();
     if (barrier == BarrierKind::NoBarrier) {
         // Try to inline properties holding a known constant object.
@@ -7265,32 +7263,32 @@ IonBuilder::getStaticName(JSObject *stat
         rvalType = MIRType_Value;
 
     return loadSlot(obj, property.maybeTypes()->definiteSlot(), NumFixedSlots(staticObject),
                     rvalType, barrier, types);
 }
 
 // Whether 'types' includes all possible values represented by input/inputTypes.
 bool
-jit::TypeSetIncludes(types::TypeSet *types, MIRType input, types::TypeSet *inputTypes)
+jit::TypeSetIncludes(TypeSet *types, MIRType input, TypeSet *inputTypes)
 {
     if (!types)
         return inputTypes && inputTypes->empty();
 
     switch (input) {
       case MIRType_Undefined:
       case MIRType_Null:
       case MIRType_Boolean:
       case MIRType_Int32:
       case MIRType_Double:
       case MIRType_Float32:
       case MIRType_String:
       case MIRType_Symbol:
       case MIRType_MagicOptimizedArguments:
-        return types->hasType(types::Type::PrimitiveType(ValueTypeFromMIRType(input)));
+        return types->hasType(TypeSet::PrimitiveType(ValueTypeFromMIRType(input)));
 
       case MIRType_Object:
         return types->unknownObject() || (inputTypes && inputTypes->isSubset(types));
 
       case MIRType_Value:
         return types->unknown() || (inputTypes && inputTypes->isSubset(types));
 
       default:
@@ -7311,21 +7309,21 @@ bool
 IonBuilder::setStaticName(JSObject *staticObject, PropertyName *name)
 {
     jsid id = NameToId(name);
 
     MOZ_ASSERT(staticObject->is<GlobalObject>() || staticObject->is<CallObject>());
 
     MDefinition *value = current->peek(-1);
 
-    types::TypeSetObjectKey *staticKey = types::TypeSetObjectKey::get(staticObject);
+    TypeSet::ObjectKey *staticKey = TypeSet::ObjectKey::get(staticObject);
     if (staticKey->unknownProperties())
         return jsop_setprop(name);
 
-    types::HeapTypeSetKey property = staticKey->property(id);
+    HeapTypeSetKey property = staticKey->property(id);
     if (!property.maybeTypes() ||
         !property.maybeTypes()->definiteProperty() ||
         property.nonData(constraints()) ||
         property.nonWritable(constraints()))
     {
         // The property has been reconfigured as non-configurable, non-enumerable
         // or non-writable.
         return jsop_setprop(name);
@@ -7360,17 +7358,17 @@ IonBuilder::jsop_getgname(PropertyName *
 {
     JSObject *obj = &script()->global();
     bool succeeded;
     if (!getStaticName(obj, name, &succeeded))
         return false;
     if (succeeded)
         return true;
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     MDefinition *globalObj = constant(ObjectValue(*obj));
     if (!getPropTryCommonGetter(&succeeded, globalObj, name, types))
         return false;
     if (succeeded)
         return true;
 
     return jsop_getname(name);
 }
@@ -7394,24 +7392,24 @@ IonBuilder::jsop_getname(PropertyName *n
         ins = MGetNameCache::New(alloc(), object, name, MGetNameCache::NAME);
 
     current->add(ins);
     current->push(ins);
 
     if (!resumeAfter(ins))
         return false;
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     return pushTypeBarrier(ins, types, BarrierKind::TypeSet);
 }
 
 bool
 IonBuilder::jsop_intrinsic(PropertyName *name)
 {
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     // If we haven't executed this opcode yet, we need to get the intrinsic
     // value and monitor the result.
     if (types->empty()) {
         MCallGetIntrinsicValue *ins = MCallGetIntrinsicValue::New(alloc(), name);
 
         current->add(ins);
         current->push(ins);
@@ -7420,17 +7418,17 @@ IonBuilder::jsop_intrinsic(PropertyName 
             return false;
 
         return pushTypeBarrier(ins, types, BarrierKind::TypeSet);
     }
 
     // Bake in the intrinsic. Make sure that TI agrees with us on the type.
     Value vp;
     JS_ALWAYS_TRUE(script()->global().maybeGetIntrinsicValue(name, &vp));
-    MOZ_ASSERT(types->hasType(types::GetValueType(vp)));
+    MOZ_ASSERT(types->hasType(TypeSet::GetValueType(vp)));
 
     pushConstant(vp);
     return true;
 }
 
 bool
 IonBuilder::jsop_bindname(PropertyName *name)
 {
@@ -7441,17 +7439,17 @@ IonBuilder::jsop_bindname(PropertyName *
 
     current->add(ins);
     current->push(ins);
 
     return resumeAfter(ins);
 }
 
 static MIRType
-GetElemKnownType(bool needsHoleCheck, types::TemporaryTypeSet *types)
+GetElemKnownType(bool needsHoleCheck, TemporaryTypeSet *types)
 {
     MIRType knownType = types->getKnownMIRType();
 
     // Null and undefined have no payload so they can't be specialized.
     // Since folding null/undefined while building SSA is not safe (see the
     // comment in IsPhiObservable), we just add an untyped load instruction
     // and rely on pushTypeBarrier and DCE to replace it with a null/undefined
     // constant.
@@ -7483,17 +7481,17 @@ IonBuilder::jsop_getelem()
         MInstruction *ins = MCallGetElement::New(alloc(), obj, index);
 
         current->add(ins);
         current->push(ins);
 
         if (!resumeAfter(ins))
             return false;
 
-        types::TemporaryTypeSet *types = bytecodeTypes(pc);
+        TemporaryTypeSet *types = bytecodeTypes(pc);
         return pushTypeBarrier(ins, types, BarrierKind::TypeSet);
     }
 
     bool emitted = false;
 
     trackOptimizationAttempt(TrackedStrategy::GetElem_TypedObject);
     if (!getElemTryTypedObject(&emitted, obj, index) || emitted)
         return emitted;
@@ -7533,17 +7531,17 @@ IonBuilder::jsop_getelem()
     MInstruction *ins = MCallGetElement::New(alloc(), obj, index);
 
     current->add(ins);
     current->push(ins);
 
     if (!resumeAfter(ins))
         return false;
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     return pushTypeBarrier(ins, types, BarrierKind::TypeSet);
 }
 
 bool
 IonBuilder::getElemTryTypedObject(bool *emitted, MDefinition *obj, MDefinition *index)
 {
     MOZ_ASSERT(*emitted == false);
 
@@ -7619,17 +7617,17 @@ IonBuilder::checkTypedObjectIndexInBound
     // Value to int32 using truncation.
     int32_t lenOfAll;
     MDefinition *length;
     if (objPrediction.hasKnownArrayLength(&lenOfAll)) {
         length = constantInt(lenOfAll);
 
         // If we are not loading the length from the object itself, only
         // optimize if the array buffer can't have been neutered.
-        types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+        TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
         if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED)) {
             trackOptimizationOutcome(TrackedOutcome::TypedObjectNeutered);
             return false;
         }
     } else {
         trackOptimizationOutcome(TrackedOutcome::TypedObjectArrayRange);
         return false;
     }
@@ -7705,18 +7703,18 @@ IonBuilder::pushScalarLoadFromTypedObjec
                                                                adjustment);
     current->add(load);
     current->push(load);
 
     // If we are reading in-bounds elements, we can use knowledge about
     // the array type to determine the result type, even if the opcode has
     // never executed. The known pushed type is only used to distinguish
     // uint32 reads that may produce either doubles or integers.
-    types::TemporaryTypeSet *resultTypes = bytecodeTypes(pc);
-    bool allowDouble = resultTypes->hasType(types::Type::DoubleType());
+    TemporaryTypeSet *resultTypes = bytecodeTypes(pc);
+    bool allowDouble = resultTypes->hasType(TypeSet::DoubleType());
 
     // Note: knownType is not necessarily in resultTypes; e.g. if we
     // have only observed integers coming out of float array.
     MIRType knownType = MIRTypeForTypedArrayRead(elemType, allowDouble);
 
     // Note: we can ignore the type barrier here, we know the type must
     // be valid and unbarriered. Also, need not set resultTypeSet,
     // because knownType is scalar and a resultTypeSet would provide
@@ -7733,49 +7731,49 @@ IonBuilder::pushReferenceLoadFromTypedOb
                                              PropertyName *name)
 {
     // Find location within the owner object.
     MDefinition *elements, *scaledOffset;
     int32_t adjustment;
     size_t alignment = ReferenceTypeDescr::alignment(type);
     loadTypedObjectElements(typedObj, byteOffset, alignment, &elements, &scaledOffset, &adjustment);
 
-    types::TemporaryTypeSet *observedTypes = bytecodeTypes(pc);
+    TemporaryTypeSet *observedTypes = bytecodeTypes(pc);
 
     MInstruction *load = nullptr;  // initialize to silence GCC warning
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(),
                                                        typedObj, name, observedTypes);
 
     switch (type) {
       case ReferenceTypeDescr::TYPE_ANY: {
         // Make sure the barrier reflects the possibility of reading undefined.
         bool bailOnUndefined = barrier == BarrierKind::NoBarrier &&
-                               !observedTypes->hasType(types::Type::UndefinedType());
+                               !observedTypes->hasType(TypeSet::UndefinedType());
         if (bailOnUndefined)
             barrier = BarrierKind::TypeTagOnly;
         load = MLoadElement::New(alloc(), elements, scaledOffset, false, false, adjustment);
         break;
       }
       case ReferenceTypeDescr::TYPE_OBJECT: {
         // Make sure the barrier reflects the possibility of reading null. When
         // there is no other barrier needed we include the null bailout with
         // MLoadUnboxedObjectOrNull, which avoids the need to box the result
         // for a type barrier instruction.
         MLoadUnboxedObjectOrNull::NullBehavior nullBehavior;
-        if (barrier == BarrierKind::NoBarrier && !observedTypes->hasType(types::Type::NullType()))
+        if (barrier == BarrierKind::NoBarrier && !observedTypes->hasType(TypeSet::NullType()))
             nullBehavior = MLoadUnboxedObjectOrNull::BailOnNull;
         else
             nullBehavior = MLoadUnboxedObjectOrNull::HandleNull;
         load = MLoadUnboxedObjectOrNull::New(alloc(), elements, scaledOffset, nullBehavior,
                                              adjustment);
         break;
       }
       case ReferenceTypeDescr::TYPE_STRING: {
         load = MLoadUnboxedString::New(alloc(), elements, scaledOffset, adjustment);
-        observedTypes->addType(types::Type::StringType(), alloc().lifoAlloc());
+        observedTypes->addType(TypeSet::StringType(), alloc().lifoAlloc());
         break;
       }
     }
 
     current->add(load);
     current->push(load);
 
     return pushTypeBarrier(load, observedTypes, barrier);
@@ -7829,28 +7827,28 @@ IonBuilder::pushDerivedTypedObject(bool 
     current->add(derivedTypedObj);
     current->push(derivedTypedObj);
 
     // Determine (if possible) the class/proto that `derivedTypedObj` will
     // have. For derived typed objects, the opacity will be the same as the
     // incoming object from which the derived typed object is, well, derived.
     // The prototype will be determined based on the type descriptor (and is
     // immutable).
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     const Class *expectedClass = nullptr;
     if (const Class *objClass = objTypes ? objTypes->getKnownClass(constraints()) : nullptr) {
         MOZ_ASSERT(IsTypedObjectClass(objClass));
         expectedClass = GetOutlineTypedObjectClass(IsOpaqueTypedObjectClass(objClass));
     }
     const TypedProto *expectedProto = derivedPrediction.getKnownPrototype();
     MOZ_ASSERT_IF(expectedClass, IsTypedObjectClass(expectedClass));
 
     // Determine (if possible) the class/proto that the observed type set
     // describes.
-    types::TemporaryTypeSet *observedTypes = bytecodeTypes(pc);
+    TemporaryTypeSet *observedTypes = bytecodeTypes(pc);
     const Class *observedClass = observedTypes->getKnownClass(constraints());
     JSObject *observedProto = observedTypes->getCommonPrototype(constraints());
 
     // If expectedClass/expectedProto are both non-null (and hence known), we
     // can predict precisely what object group derivedTypedObj will have.
     // Therefore, if we observe that this group is already contained in the set
     // of observedTypes, we can skip the barrier.
     //
@@ -7938,17 +7936,17 @@ IonBuilder::getStaticTypedArrayObject(MD
     }
 
     JSObject *tarrObj = obj->resultTypeSet()->maybeSingleton();
     if (!tarrObj) {
         trackOptimizationOutcome(TrackedOutcome::NotSingleton);
         return nullptr;
     }
 
-    types::TypeSetObjectKey *tarrKey = types::TypeSetObjectKey::get(tarrObj);
+    TypeSet::ObjectKey *tarrKey = TypeSet::ObjectKey::get(tarrObj);
     if (tarrKey->unknownProperties()) {
         trackOptimizationOutcome(TrackedOutcome::UnknownProperties);
         return nullptr;
     }
 
     return tarrObj;
 }
 
@@ -7970,17 +7968,17 @@ IonBuilder::getElemTryTypedStatic(bool *
 
     MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType);
     if (!ptr)
         return true;
 
     // Emit LoadTypedArrayElementStatic.
 
     if (tarrObj->is<TypedArrayObject>()) {
-        types::TypeSetObjectKey *tarrKey = types::TypeSetObjectKey::get(tarrObj);
+        TypeSet::ObjectKey *tarrKey = TypeSet::ObjectKey::get(tarrObj);
         tarrKey->watchStateChangeForTypedArrayData(constraints());
     }
 
     obj->setImplicitlyUsedUnchecked();
     index->setImplicitlyUsedUnchecked();
 
     MLoadTypedArrayElementStatic *load = MLoadTypedArrayElementStatic::New(alloc(), tarrObj, ptr);
     current->add(load);
@@ -8033,17 +8031,17 @@ IonBuilder::getElemTryString(bool *emitt
 
     if (obj->type() != MIRType_String || !IsNumberType(index->type())) {
         trackOptimizationOutcome(TrackedOutcome::AccessNotString);
         return true;
     }
 
     // If the index is expected to be out-of-bounds, don't optimize to avoid
     // frequent bailouts.
-    if (bytecodeTypes(pc)->hasType(types::Type::UndefinedType())) {
+    if (bytecodeTypes(pc)->hasType(TypeSet::UndefinedType())) {
         trackOptimizationOutcome(TrackedOutcome::OutOfBounds);
         return true;
     }
 
     // Emit fast path for string[index].
     MInstruction *idInt32 = MToInt32::New(alloc(), index);
     current->add(idInt32);
     index = idInt32;
@@ -8095,17 +8093,17 @@ IonBuilder::getElemTryArguments(bool *em
     // Bailouts if we read more than the number of actual arguments.
     index = addBoundsCheck(index, length);
 
     // Load the argument from the actual arguments.
     MGetFrameArgument *load = MGetFrameArgument::New(alloc(), index, analysis_.hasSetArg());
     current->add(load);
     current->push(load);
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     if (!pushTypeBarrier(load, types, BarrierKind::TypeSet))
         return false;
 
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
@@ -8177,17 +8175,17 @@ IonBuilder::getElemTryCache(bool *emitte
     bool nonNativeGetElement = inspector->hasSeenNonNativeGetElement(pc);
     if (index->mightBeType(MIRType_Int32) && nonNativeGetElement) {
         trackOptimizationOutcome(TrackedOutcome::NonNativeReceiver);
         return true;
     }
 
     // Emit GetElementCache.
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(), obj,
                                                        nullptr, types);
 
     // Always add a barrier if the index might be a string or symbol, so that
     // the cache can attach stubs for particular properties.
     if (index->mightBeType(MIRType_String) || index->mightBeType(MIRType_Symbol))
         barrier = BarrierKind::TypeSet;
 
@@ -8214,17 +8212,17 @@ IonBuilder::getElemTryCache(bool *emitte
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::jsop_getelem_dense(MDefinition *obj, MDefinition *index)
 {
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     MOZ_ASSERT(index->type() == MIRType_Int32 || index->type() == MIRType_Double);
     if (JSOp(*pc) == JSOP_CALLELEM) {
         // Indexed call on an element of an array. Populate the observed types
         // with any objects that could be in the array, to avoid extraneous
         // type barriers.
         AddObjectsForPropertyRead(obj, nullptr, types);
     }
@@ -8232,17 +8230,17 @@ IonBuilder::jsop_getelem_dense(MDefiniti
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(), obj,
                                                        nullptr, types);
     bool needsHoleCheck = !ElementAccessIsPacked(constraints(), obj);
 
     // Reads which are on holes in the object do not have to bail out if
     // undefined values have been observed at this access site and the access
     // cannot hit another indexed property on the object or its prototypes.
     bool readOutOfBounds =
-        types->hasType(types::Type::UndefinedType()) &&
+        types->hasType(TypeSet::UndefinedType()) &&
         !ElementAccessHasExtraIndexedProperty(constraints(), obj);
 
     MIRType knownType = MIRType_Value;
     if (barrier == BarrierKind::NoBarrier)
         knownType = GetElemKnownType(needsHoleCheck, types);
 
     // Ensure index is an integer.
     MInstruction *idInt32 = MToInt32::New(alloc(), index);
@@ -8256,25 +8254,25 @@ IonBuilder::jsop_getelem_dense(MDefiniti
     // Note: to help GVN, use the original MElements instruction and not
     // MConvertElementsToDoubles as operand. This is fine because converting
     // elements to double does not change the initialized length.
     MInitializedLength *initLength = MInitializedLength::New(alloc(), elements);
     current->add(initLength);
 
     // If we can load the element as a definite double, make sure to check that
     // the array has been converted to homogenous doubles first.
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     bool loadDouble =
         barrier == BarrierKind::NoBarrier &&
         loopDepth_ &&
         !readOutOfBounds &&
         !needsHoleCheck &&
         knownType == MIRType_Double &&
         objTypes &&
-        objTypes->convertDoubleElements(constraints()) == types::TemporaryTypeSet::AlwaysConvertToDoubles;
+        objTypes->convertDoubleElements(constraints()) == TemporaryTypeSet::AlwaysConvertToDoubles;
     if (loadDouble)
         elements = addConvertElementsToDoubles(elements);
 
     MInstruction *load;
 
     if (!readOutOfBounds) {
         // This load should not return undefined, so likely we're reading
         // in-bounds elements, and the array is packed or its holes are not
@@ -8321,17 +8319,17 @@ IonBuilder::addTypedArrayLengthAndData(M
     if (tarr) {
         void *data = AnyTypedArrayViewData(tarr);
         // Bug 979449 - Optimistically embed the elements and use TI to
         //              invalidate if we move them.
         bool isTenured = !tarr->runtimeFromMainThread()->gc.nursery.isInside(data);
         if (isTenured && tarr->isSingleton()) {
             // The 'data' pointer of TypedArrayObject can change in rare circumstances
             // (ArrayBufferObject::changeContents).
-            types::TypeSetObjectKey *tarrKey = types::TypeSetObjectKey::get(tarr);
+            TypeSet::ObjectKey *tarrKey = TypeSet::ObjectKey::get(tarr);
             if (!tarrKey->unknownProperties()) {
                 if (tarr->is<TypedArrayObject>())
                     tarrKey->watchStateChangeForTypedArrayData(constraints());
 
                 obj->setImplicitlyUsedUnchecked();
 
                 int32_t len = AssertedCast<int32_t>(AnyTypedArrayLength(tarr));
                 *length = MConstant::New(alloc(), Int32Value(len));
@@ -8424,24 +8422,24 @@ MIRTypeForTypedArrayRead(Scalar::Type ar
     }
     MOZ_CRASH("Unknown typed array type");
 }
 
 bool
 IonBuilder::jsop_getelem_typed(MDefinition *obj, MDefinition *index,
                                Scalar::Type arrayType)
 {
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
-
-    bool maybeUndefined = types->hasType(types::Type::UndefinedType());
+    TemporaryTypeSet *types = bytecodeTypes(pc);
+
+    bool maybeUndefined = types->hasType(TypeSet::UndefinedType());
 
     // Reading from an Uint32Array will result in a double for values
     // that don't fit in an int32. We have to bailout if this happens
     // and the instruction is not known to return a double.
-    bool allowDouble = types->hasType(types::Type::DoubleType());
+    bool allowDouble = types->hasType(TypeSet::DoubleType());
 
     // Ensure id is an integer.
     MInstruction *idInt32 = MToInt32::New(alloc(), index);
     current->add(idInt32);
     index = idInt32;
 
     if (!maybeUndefined) {
         // Assume the index is in range, so that we can hoist the length,
@@ -8476,17 +8474,17 @@ IonBuilder::jsop_getelem_typed(MDefiniti
         switch (arrayType) {
           case Scalar::Int8:
           case Scalar::Uint8:
           case Scalar::Uint8Clamped:
           case Scalar::Int16:
           case Scalar::Uint16:
           case Scalar::Int32:
           case Scalar::Uint32:
-            if (types->hasType(types::Type::Int32Type()))
+            if (types->hasType(TypeSet::Int32Type()))
                 barrier = BarrierKind::NoBarrier;
             break;
           case Scalar::Float32:
           case Scalar::Float64:
             if (allowDouble)
                 barrier = BarrierKind::NoBarrier;
             break;
           default:
@@ -8681,17 +8679,17 @@ IonBuilder::setElemTryTypedStatic(bool *
     Scalar::Type viewType = AnyTypedArrayType(tarrObj);
     MDefinition *ptr = convertShiftToMaskForStaticTypedArray(index, viewType);
     if (!ptr)
         return true;
 
     // Emit StoreTypedArrayElementStatic.
 
     if (tarrObj->is<TypedArrayObject>()) {
-        types::TypeSetObjectKey *tarrKey = types::TypeSetObjectKey::get(tarrObj);
+        TypeSet::ObjectKey *tarrKey = TypeSet::ObjectKey::get(tarrObj);
         tarrKey->watchStateChangeForTypedArrayData(constraints());
     }
 
     object->setImplicitlyUsedUnchecked();
     index->setImplicitlyUsedUnchecked();
 
     // Clamp value to [0, 255] for Uint8ClampedArray.
     MDefinition *toWrite = value;
@@ -8751,21 +8749,21 @@ IonBuilder::setElemTryDense(bool *emitte
         return true;
     }
 
     if (!object->resultTypeSet()) {
         trackOptimizationOutcome(TrackedOutcome::NoTypeInfo);
         return true;
     }
 
-    types::TemporaryTypeSet::DoubleConversion conversion =
+    TemporaryTypeSet::DoubleConversion conversion =
         object->resultTypeSet()->convertDoubleElements(constraints());
 
     // If AmbiguousDoubleConversion, only handle int32 values for now.
-    if (conversion == types::TemporaryTypeSet::AmbiguousDoubleConversion &&
+    if (conversion == TemporaryTypeSet::AmbiguousDoubleConversion &&
         value->type() != MIRType_Int32)
     {
         trackOptimizationOutcome(TrackedOutcome::ArrayDoubleConversion);
         return true;
     }
 
     // Don't generate a fast path if there have been bounds check failures
     // and this access might be on a sparse property.
@@ -8853,17 +8851,17 @@ IonBuilder::setElemTryCache(bool *emitte
         return false;
 
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
 bool
-IonBuilder::jsop_setelem_dense(types::TemporaryTypeSet::DoubleConversion conversion,
+IonBuilder::jsop_setelem_dense(TemporaryTypeSet::DoubleConversion conversion,
                                SetElemSafety safety,
                                MDefinition *obj, MDefinition *id, MDefinition *value)
 {
     MIRType elementType = DenseNativeElementType(constraints(), obj);
     bool packed = ElementAccessIsPacked(constraints(), obj);
 
     // Writes which are on holes in the object do not have to bail out if they
     // cannot hit another indexed property on the object or its prototypes.
@@ -8882,33 +8880,33 @@ IonBuilder::jsop_setelem_dense(types::Te
 
     // Get the elements vector.
     MElements *elements = MElements::New(alloc(), obj);
     current->add(elements);
 
     // Ensure the value is a double, if double conversion might be needed.
     MDefinition *newValue = value;
     switch (conversion) {
-      case types::TemporaryTypeSet::AlwaysConvertToDoubles:
-      case types::TemporaryTypeSet::MaybeConvertToDoubles: {
+      case TemporaryTypeSet::AlwaysConvertToDoubles:
+      case TemporaryTypeSet::MaybeConvertToDoubles: {
         MInstruction *valueDouble = MToDouble::New(alloc(), value);
         current->add(valueDouble);
         newValue = valueDouble;
         break;
       }
 
-      case types::TemporaryTypeSet::AmbiguousDoubleConversion: {
+      case TemporaryTypeSet::AmbiguousDoubleConversion: {
         MOZ_ASSERT(value->type() == MIRType_Int32);
         MInstruction *maybeDouble = MMaybeToDoubleElement::New(alloc(), elements, value);
         current->add(maybeDouble);
         newValue = maybeDouble;
         break;
       }
 
-      case types::TemporaryTypeSet::DontConvertToDoubles:
+      case TemporaryTypeSet::DontConvertToDoubles:
         break;
 
       default:
         MOZ_CRASH("Unknown double conversion");
     }
 
     bool writeHole = false;
     if (safety == SetElem_Normal) {
@@ -9050,17 +9048,17 @@ IonBuilder::jsop_length()
 
     PropertyName *name = info().getAtom(pc)->asPropertyName();
     return jsop_getprop(name);
 }
 
 bool
 IonBuilder::jsop_length_fastPath()
 {
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     if (types->getKnownMIRType() != MIRType_Int32)
         return false;
 
     MDefinition *obj = current->peek(-1);
 
     if (obj->mightBeType(MIRType_String)) {
         if (obj->mightBeType(MIRType_Object))
@@ -9068,17 +9066,17 @@ IonBuilder::jsop_length_fastPath()
         current->pop();
         MStringLength *ins = MStringLength::New(alloc(), obj);
         current->add(ins);
         current->push(ins);
         return true;
     }
 
     if (obj->mightBeType(MIRType_Object)) {
-        types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+        TemporaryTypeSet *objTypes = obj->resultTypeSet();
 
         // Compute the length for array objects.
         if (objTypes &&
             objTypes->getKnownClass(constraints()) == &ArrayObject::class_ &&
             !objTypes->hasObjectFlags(constraints(), OBJECT_FLAG_LENGTH_OVERFLOW))
         {
             current->pop();
             MElements *elements = MElements::New(alloc(), obj);
@@ -9089,17 +9087,17 @@ IonBuilder::jsop_length_fastPath()
             current->add(length);
             current->push(length);
             return true;
         }
 
         // Compute the length for array typed objects.
         TypedObjectPrediction prediction = typedObjectPrediction(obj);
         if (!prediction.isUseless()) {
-            types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+            TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
             if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
                 return false;
 
             MInstruction *length;
             int32_t sizedLength;
             if (prediction.hasKnownArrayLength(&sizedLength)) {
                 obj->setImplicitlyUsedUnchecked();
                 length = MConstant::New(alloc(), Int32Value(sizedLength));
@@ -9198,17 +9196,17 @@ IonBuilder::jsop_rest()
     MSetInitializedLength *initLength = MSetInitializedLength::New(alloc(), elements, index);
     current->add(initLength);
 
     current->push(array);
     return true;
 }
 
 uint32_t
-IonBuilder::getDefiniteSlot(types::TemporaryTypeSet *types, PropertyName *name)
+IonBuilder::getDefiniteSlot(TemporaryTypeSet *types, PropertyName *name)
 {
     if (!types || types->unknownObject()) {
         trackOptimizationOutcome(TrackedOutcome::NoTypeInfo);
         return UINT32_MAX;
     }
 
     // Watch for types which the new script properties analysis has not been
     // performed on yet. Normally this is done after a small number of the
@@ -9217,47 +9215,47 @@ IonBuilder::getDefiniteSlot(types::Tempo
     // analysis can have side effects so abort the builder and retry later.
     //
     // We always check this, so that even if we aren't able to find a common
     // slot we ensure that the new script analysis is performed on all accessed
     // objects. Later, this will let us elide baseline IC stubs for preliminary
     // objects, which often have a different number of fixed slots from
     // subsequent objects.
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         if (ObjectGroup *group = key->maybeGroup()) {
             if (group->newScript() && !group->newScript()->analyzed()) {
                 addAbortedNewScriptPropertiesGroup(group);
                 trackOptimizationOutcome(TrackedOutcome::NoAnalysisInfo);
                 return UINT32_MAX;
             }
         }
     }
 
     uint32_t slot = UINT32_MAX;
 
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties()) {
             trackOptimizationOutcome(TrackedOutcome::UnknownProperties);
             return UINT32_MAX;
         }
 
         if (key->isSingleton()) {
             trackOptimizationOutcome(TrackedOutcome::Singleton);
             return UINT32_MAX;
         }
 
-        types::HeapTypeSetKey property = key->property(NameToId(name));
+        HeapTypeSetKey property = key->property(NameToId(name));
         if (!property.maybeTypes() ||
             !property.maybeTypes()->definiteProperty() ||
             property.nonData(constraints()))
         {
             trackOptimizationOutcome(TrackedOutcome::NotFixedSlot);
             return UINT32_MAX;
         }
 
@@ -9269,27 +9267,27 @@ IonBuilder::getDefiniteSlot(types::Tempo
             return UINT32_MAX;
         }
     }
 
     return slot;
 }
 
 uint32_t
-IonBuilder::getUnboxedOffset(types::TemporaryTypeSet *types, PropertyName *name, JSValueType *punboxedType)
+IonBuilder::getUnboxedOffset(TemporaryTypeSet *types, PropertyName *name, JSValueType *punboxedType)
 {
     if (!types || types->unknownObject()) {
         trackOptimizationOutcome(TrackedOutcome::NoTypeInfo);
         return UINT32_MAX;
     }
 
     uint32_t offset = UINT32_MAX;
 
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties()) {
             trackOptimizationOutcome(TrackedOutcome::UnknownProperties);
             return UINT32_MAX;
         }
 
@@ -9341,34 +9339,34 @@ IonBuilder::jsop_not()
     MNot *ins = MNot::New(alloc(), value);
     current->add(ins);
     current->push(ins);
     ins->cacheOperandMightEmulateUndefined(constraints());
     return true;
 }
 
 bool
-IonBuilder::objectsHaveCommonPrototype(types::TemporaryTypeSet *types, PropertyName *name,
+IonBuilder::objectsHaveCommonPrototype(TemporaryTypeSet *types, PropertyName *name,
                                        bool isGetter, JSObject *foundProto, bool *guardGlobal)
 {
     // With foundProto a prototype with a getter or setter for name, return
     // whether looking up name on any object in |types| will go through
     // foundProto, i.e. all the objects have foundProto on their prototype
     // chain and do not have a property for name before reaching foundProto.
 
     // No sense looking if we don't know what's going on.
     if (!types || types->unknownObject())
         return false;
     *guardGlobal = false;
 
     for (unsigned i = 0; i < types->getObjectCount(); i++) {
         if (types->getSingleton(i) == foundProto)
             continue;
 
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         while (key) {
             if (key->unknownProperties())
                 return false;
 
             const Class *clasp = key->clasp();
@@ -9387,74 +9385,74 @@ IonBuilder::objectsHaveCommonPrototype(t
             if (isGetter && clasp->ops.getProperty && !IsAnyTypedArrayClass(clasp))
                 return false;
             if (!isGetter && clasp->ops.setProperty)
                 return false;
 
             // Test for isOwnProperty() without freezing. If we end up
             // optimizing, freezePropertiesForCommonPropFunc will freeze the
             // property type sets later on.
-            types::HeapTypeSetKey property = key->property(NameToId(name));
-            if (types::TypeSet *types = property.maybeTypes()) {
+            HeapTypeSetKey property = key->property(NameToId(name));
+            if (TypeSet *types = property.maybeTypes()) {
                 if (!types->empty() || types->nonDataProperty())
                     return false;
             }
             if (singleton) {
-                if (types::CanHaveEmptyPropertyTypesForOwnProperty(singleton)) {
+                if (CanHaveEmptyPropertyTypesForOwnProperty(singleton)) {
                     MOZ_ASSERT(singleton->is<GlobalObject>());
                     *guardGlobal = true;
                 }
             }
 
             JSObject *proto = key->proto().toObjectOrNull();
             if (proto == foundProto)
                 break;
             if (!proto) {
                 // The foundProto being searched for did not show up on the
                 // object's prototype chain.
                 return false;
             }
-            key = types::TypeSetObjectKey::get(proto);
+            key = TypeSet::ObjectKey::get(proto);
         }
     }
 
     return true;
 }
 
 void
-IonBuilder::freezePropertiesForCommonPrototype(types::TemporaryTypeSet *types, PropertyName *name,
+IonBuilder::freezePropertiesForCommonPrototype(TemporaryTypeSet *types, PropertyName *name,
                                                JSObject *foundProto,
                                                bool allowEmptyTypesforGlobal/* = false*/)
 {
     for (unsigned i = 0; i < types->getObjectCount(); i++) {
         // If we found a Singleton object's own-property, there's nothing to
         // freeze.
         if (types->getSingleton(i) == foundProto)
             continue;
 
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         while (true) {
-            types::HeapTypeSetKey property = key->property(NameToId(name));
+            HeapTypeSetKey property = key->property(NameToId(name));
             JS_ALWAYS_TRUE(!property.isOwnProperty(constraints(), allowEmptyTypesforGlobal));
 
             // Don't mark the proto. It will be held down by the shape
             // guard. This allows us to use properties found on prototypes
             // with properties unknown to TI.
             if (key->proto() == TaggedProto(foundProto))
                 break;
-            key = types::TypeSetObjectKey::get(key->proto().toObjectOrNull());
-        }
-    }
-}
-
-bool
-IonBuilder::testCommonGetterSetter(types::TemporaryTypeSet *types, PropertyName *name,
+            key = TypeSet::ObjectKey::get(key->proto().toObjectOrNull());
+        }
+    }
+}
+
+bool
+IonBuilder::testCommonGetterSetter(TemporaryTypeSet *types, PropertyName *name,
                                    bool isGetter, JSObject *foundProto, Shape *lastProperty,
                                    MDefinition **guard,
                                    Shape *globalShape/* = nullptr*/,
                                    MDefinition **globalGuard/* = nullptr */)
 {
     MOZ_ASSERT_IF(globalShape, globalGuard);
     bool guardGlobal;
 
@@ -9500,18 +9498,18 @@ IonBuilder::replaceMaybeFallbackFunction
 {
     // Discard the last prior resume point of the previous MGetPropertyCache.
     WrapMGetPropertyCache rai(maybeFallbackFunctionGetter_);
     maybeFallbackFunctionGetter_ = cache;
 }
 
 bool
 IonBuilder::annotateGetPropertyCache(MDefinition *obj, MGetPropertyCache *getPropCache,
-                                     types::TemporaryTypeSet *objTypes,
-                                     types::TemporaryTypeSet *pushedTypes)
+                                     TemporaryTypeSet *objTypes,
+                                     TemporaryTypeSet *pushedTypes)
 {
     PropertyName *name = getPropCache->name();
 
     // Ensure every pushed value is a singleton.
     if (pushedTypes->unknownObject() || pushedTypes->baseFlags() != 0)
         return true;
 
     for (unsigned i = 0; i < pushedTypes->getObjectCount(); i++) {
@@ -9532,34 +9530,34 @@ IonBuilder::annotateGetPropertyCache(MDe
         return false;
 
     // Ensure that the relevant property typeset for each group is
     // is a single-object typeset containing a JSFunction
     for (unsigned int i = 0; i < objCount; i++) {
         ObjectGroup *group = objTypes->getGroup(i);
         if (!group)
             continue;
-        types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(group);
+        TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(group);
         if (key->unknownProperties() || !key->proto().isObject())
             continue;
 
         const Class *clasp = key->clasp();
         if (!ClassHasEffectlessLookup(clasp, name) || ClassHasResolveHook(compartment, clasp, name))
             continue;
 
-        types::HeapTypeSetKey ownTypes = key->property(NameToId(name));
+        HeapTypeSetKey ownTypes = key->property(NameToId(name));
         if (ownTypes.isOwnProperty(constraints()))
             continue;
 
         JSObject *singleton = testSingletonProperty(key->proto().toObject(), name);
         if (!singleton || !singleton->is<JSFunction>())
             continue;
 
         // Don't add cases corresponding to non-observed pushes
-        if (!pushedTypes->hasType(types::Type::ObjectType(singleton)))
+        if (!pushedTypes->hasType(TypeSet::ObjectType(singleton)))
             continue;
 
         if (!inlinePropTable->addEntry(alloc(), group, &singleton->as<JSFunction>()))
             return false;
     }
 
     if (inlinePropTable->numEntries() == 0) {
         getPropCache->clearInlinePropertyTable();
@@ -9602,17 +9600,17 @@ IonBuilder::invalidatedIdempotentCache()
         builder = builder->callerBuilder_;
     } while (builder);
 
     return false;
 }
 
 bool
 IonBuilder::loadSlot(MDefinition *obj, size_t slot, size_t nfixed, MIRType rvalType,
-                     BarrierKind barrier, types::TemporaryTypeSet *types)
+                     BarrierKind barrier, TemporaryTypeSet *types)
 {
     if (slot < nfixed) {
         MLoadFixedSlot *load = MLoadFixedSlot::New(alloc(), obj, slot);
         current->add(load);
         current->push(load);
 
         load->setResultType(rvalType);
         return pushTypeBarrier(load, types, barrier);
@@ -9626,17 +9624,17 @@ IonBuilder::loadSlot(MDefinition *obj, s
     current->push(load);
 
     load->setResultType(rvalType);
     return pushTypeBarrier(load, types, barrier);
 }
 
 bool
 IonBuilder::loadSlot(MDefinition *obj, Shape *shape, MIRType rvalType,
-                     BarrierKind barrier, types::TemporaryTypeSet *types)
+                     BarrierKind barrier, TemporaryTypeSet *types)
 {
     return loadSlot(obj, shape->slot(), shape->numFixedSlots(), rvalType, barrier, types);
 }
 
 bool
 IonBuilder::storeSlot(MDefinition *obj, size_t slot, size_t nfixed,
                       MDefinition *value, bool needsBarrier,
                       MIRType slotType /* = MIRType_None */)
@@ -9673,17 +9671,17 @@ IonBuilder::storeSlot(MDefinition *obj, 
 
 bool
 IonBuilder::jsop_getprop(PropertyName *name)
 {
     bool emitted = false;
     startTrackingOptimizations();
 
     MDefinition *obj = current->pop();
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
 
     trackTypeInfo(TrackedTypeSite::Receiver, obj->type(), obj->resultTypeSet());
 
     if (!info().isAnalysis()) {
         // The calls below can abort compilation, so we only try this if we're
         // not analyzing.
         // Try to optimize arguments.length.
         trackOptimizationAttempt(TrackedStrategy::GetProp_ArgumentsLength);
@@ -9802,48 +9800,48 @@ IonBuilder::checkIsDefinitelyOptimizedAr
     }
 
     *isOptimizedArgs = true;
     return true;
 }
 
 bool
 IonBuilder::getPropTryInferredConstant(bool *emitted, MDefinition *obj, PropertyName *name,
-                                       types::TemporaryTypeSet *types)
+                                       TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     // Need a result typeset to optimize.
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     if (!objTypes) {
         trackOptimizationOutcome(TrackedOutcome::NoTypeInfo);
         return true;
     }
 
     JSObject *singleton = objTypes->maybeSingleton();
     if (!singleton) {
         trackOptimizationOutcome(TrackedOutcome::NotSingleton);
         return true;
     }
 
-    types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(singleton);
+    TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(singleton);
     if (key->unknownProperties()) {
         trackOptimizationOutcome(TrackedOutcome::UnknownProperties);
         return true;
     }
 
-    types::HeapTypeSetKey property = key->property(NameToId(name));
+    HeapTypeSetKey property = key->property(NameToId(name));
 
     Value constantValue = UndefinedValue();
     if (property.constant(constraints(), &constantValue)) {
         spew("Optimized constant property");
         obj->setImplicitlyUsedUnchecked();
         if (!pushConstant(constantValue))
             return false;
-        types->addType(types::GetValueType(constantValue), alloc_->lifoAlloc());
+        types->addType(TypeSet::GetValueType(constantValue), alloc_->lifoAlloc());
         trackOptimizationSuccess();
         *emitted = true;
     }
 
     return true;
 }
 
 bool
@@ -9898,17 +9896,17 @@ IonBuilder::getPropTryArgumentsCallee(bo
 
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::getPropTryConstant(bool *emitted, MDefinition *obj, PropertyName *name,
-                               types::TemporaryTypeSet *types)
+                               TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     JSObject *singleton = types ? types->maybeSingleton() : nullptr;
     if (!singleton) {
         trackOptimizationOutcome(TrackedOutcome::NotSingleton);
         return true;
     }
@@ -9978,17 +9976,17 @@ bool
 IonBuilder::getPropTryScalarPropOfTypedObject(bool *emitted, MDefinition *typedObj,
                                               int32_t fieldOffset,
                                               TypedObjectPrediction fieldPrediction)
 {
     // Must always be loading the same scalar type
     Scalar::Type fieldType = fieldPrediction.scalarType();
 
     // Don't optimize if the typed object might be neutered.
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
         return true;
 
     trackOptimizationSuccess();
     *emitted = true;
 
     LinearSum byteOffset(alloc());
     if (!byteOffset.add(fieldOffset))
@@ -10000,17 +9998,17 @@ IonBuilder::getPropTryScalarPropOfTypedO
 bool
 IonBuilder::getPropTryReferencePropOfTypedObject(bool *emitted, MDefinition *typedObj,
                                                  int32_t fieldOffset,
                                                  TypedObjectPrediction fieldPrediction,
                                                  PropertyName *name)
 {
     ReferenceTypeDescr::Type fieldType = fieldPrediction.referenceType();
 
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
         return true;
 
     trackOptimizationSuccess();
     *emitted = true;
 
     LinearSum byteOffset(alloc());
     if (!byteOffset.add(fieldOffset))
@@ -10022,17 +10020,17 @@ IonBuilder::getPropTryReferencePropOfTyp
 bool
 IonBuilder::getPropTryComplexPropOfTypedObject(bool *emitted,
                                                MDefinition *typedObj,
                                                int32_t fieldOffset,
                                                TypedObjectPrediction fieldPrediction,
                                                size_t fieldIndex)
 {
     // Don't optimize if the typed object might be neutered.
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
         return true;
 
     // OK, perform the optimization
 
     // Identify the type object for the field.
     MDefinition *type = loadTypedObjectType(typedObj);
     MDefinition *fieldTypeObj = typeObjectForFieldFromStructType(type, fieldIndex);
@@ -10042,17 +10040,17 @@ IonBuilder::getPropTryComplexPropOfTyped
         setForceAbort();
 
     return pushDerivedTypedObject(emitted, typedObj, byteOffset,
                                   fieldPrediction, fieldTypeObj);
 }
 
 bool
 IonBuilder::getPropTryDefiniteSlot(bool *emitted, MDefinition *obj, PropertyName *name,
-                                   BarrierKind barrier, types::TemporaryTypeSet *types)
+                                   BarrierKind barrier, TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     uint32_t slot = getDefiniteSlot(obj->resultTypeSet(), name);
     if (slot == UINT32_MAX)
         return true;
 
     if (obj->type() != MIRType_Object) {
@@ -10082,17 +10080,17 @@ IonBuilder::getPropTryDefiniteSlot(bool 
 
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
 MInstruction *
 IonBuilder::loadUnboxedProperty(MDefinition *obj, size_t offset, JSValueType unboxedType,
-                                BarrierKind barrier, types::TemporaryTypeSet *types)
+                                BarrierKind barrier, TemporaryTypeSet *types)
 {
     size_t scaledOffsetConstant = offset / UnboxedTypeSize(unboxedType);
     MInstruction *scaledOffset = MConstant::New(alloc(), Int32Value(scaledOffsetConstant));
     current->add(scaledOffset);
 
     MInstruction *load;
     switch (unboxedType) {
       case JSVAL_TYPE_BOOLEAN:
@@ -10119,17 +10117,17 @@ IonBuilder::loadUnboxedProperty(MDefinit
 
       case JSVAL_TYPE_STRING:
         load = MLoadUnboxedString::New(alloc(), obj, scaledOffset,
                                        UnboxedPlainObject::offsetOfData());
         break;
 
       case JSVAL_TYPE_OBJECT: {
         MLoadUnboxedObjectOrNull::NullBehavior nullBehavior;
-        if (types->hasType(types::Type::NullType()) || barrier != BarrierKind::NoBarrier)
+        if (types->hasType(TypeSet::NullType()) || barrier != BarrierKind::NoBarrier)
             nullBehavior = MLoadUnboxedObjectOrNull::HandleNull;
         else
             nullBehavior = MLoadUnboxedObjectOrNull::NullNotPossible;
         load = MLoadUnboxedObjectOrNull::New(alloc(), obj, scaledOffset, nullBehavior,
                                              UnboxedPlainObject::offsetOfData());
         break;
       }
 
@@ -10138,17 +10136,17 @@ IonBuilder::loadUnboxedProperty(MDefinit
     }
 
     current->add(load);
     return load;
 }
 
 bool
 IonBuilder::getPropTryUnboxed(bool *emitted, MDefinition *obj, PropertyName *name,
-                              BarrierKind barrier, types::TemporaryTypeSet *types)
+                              BarrierKind barrier, TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     JSValueType unboxedType;
     uint32_t offset = getUnboxedOffset(obj->resultTypeSet(), name, &unboxedType);
     if (offset == UINT32_MAX)
         return true;
 
@@ -10188,33 +10186,33 @@ IonBuilder::addShapeGuardsForGetterSette
     MDefinition *holderDef = constantMaybeNursery(holder);
     addShapeGuard(holderDef, holderShape, Bailout_ShapeGuard);
 
     return addShapeGuardPolymorphic(obj, receiverShapes);
 }
 
 bool
 IonBuilder::getPropTryCommonGetter(bool *emitted, MDefinition *obj, PropertyName *name,
-                                   types::TemporaryTypeSet *types)
+                                   TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     Shape *lastProperty = nullptr;
     JSFunction *commonGetter = nullptr;
     Shape *globalShape = nullptr;
     JSObject *foundProto = nullptr;
     bool isOwnProperty = false;
     BaselineInspector::ShapeVector receiverShapes(alloc());
     if (!inspector->commonGetPropFunction(pc, &foundProto, &lastProperty, &commonGetter,
                                           &globalShape, &isOwnProperty, receiverShapes))
     {
         return true;
     }
 
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     MDefinition *guard = nullptr;
     MDefinition *globalGuard = nullptr;
     bool canUseTIForGetter =
         testCommonGetterSetter(objTypes, name, /* isGetter = */ true,
                                foundProto, lastProperty, &guard, globalShape,
                                &globalGuard);
     if (!canUseTIForGetter) {
         // If type information is bad, we can still optimize the getter if we
@@ -10378,17 +10376,17 @@ GetPropertyShapes(jsid id, const Baselin
         }
     }
 
     return true;
 }
 
 bool
 IonBuilder::getPropTryInlineAccess(bool *emitted, MDefinition *obj, PropertyName *name,
-                                   BarrierKind barrier, types::TemporaryTypeSet *types)
+                                   BarrierKind barrier, TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     if (obj->type() != MIRType_Object) {
         trackOptimizationOutcome(TrackedOutcome::NotObject);
         return true;
     }
 
@@ -10491,24 +10489,24 @@ IonBuilder::getPropTryInlineAccess(bool 
 
     trackOptimizationOutcome(TrackedOutcome::Polymorphic);
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::getPropTryCache(bool *emitted, MDefinition *obj, PropertyName *name,
-                            BarrierKind barrier, types::TemporaryTypeSet *types)
+                            BarrierKind barrier, TemporaryTypeSet *types)
 {
     MOZ_ASSERT(*emitted == false);
 
     // The input value must either be an object, or we should have strong suspicions
     // that it can be safely unboxed to an object.
     if (obj->type() != MIRType_Object) {
-        types::TemporaryTypeSet *types = obj->resultTypeSet();
+        TemporaryTypeSet *types = obj->resultTypeSet();
         if (!types || !types->objectOrSentinel()) {
             trackOptimizationOutcome(TrackedOutcome::NoTypeInfo);
             return true;
         }
     }
 
     // Since getters have no guaranteed return values, we must barrier in order to be
     // able to attach stubs for them.
@@ -10579,42 +10577,42 @@ IonBuilder::tryInnerizeWindow(MDefinitio
     // example) to go directly to the inner window, the global.
     //
     // Callers should be careful not to pass the inner object to getters or
     // setters that require outerization.
 
     if (obj->type() != MIRType_Object)
         return obj;
 
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
     if (!types)
         return obj;
 
     JSObject *singleton = types->maybeSingleton();
     if (!singleton)
         return obj;
 
     JSObject *inner = GetInnerObject(singleton);
     if (inner == singleton || inner != &script()->global())
         return obj;
 
     // When we navigate, the outer object is brain transplanted and we'll mark
     // its ObjectGroup as having unknown properties. The type constraint we add
     // here will invalidate JIT code when this happens.
-    types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(singleton);
+    TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(singleton);
     if (key->hasFlags(constraints(), OBJECT_FLAG_UNKNOWN_PROPERTIES))
         return obj;
 
     obj->setImplicitlyUsedUnchecked();
     return constant(ObjectValue(script()->global()));
 }
 
 bool
 IonBuilder::getPropTryInnerize(bool *emitted, MDefinition *obj, PropertyName *name,
-                               types::TemporaryTypeSet *types)
+                               TemporaryTypeSet *types)
 {
     // See the comment in tryInnerizeWindow for how this works.
 
     MOZ_ASSERT(*emitted == false);
 
     MDefinition *inner = tryInnerizeWindow(obj);
     if (inner == obj)
         return true;
@@ -10669,17 +10667,17 @@ IonBuilder::jsop_setprop(PropertyName *n
     if (!setPropTryCommonSetter(&emitted, obj, name, value) || emitted)
         return emitted;
 
     // Try to emit stores to known binary data blocks
     trackOptimizationAttempt(TrackedStrategy::SetProp_TypedObject);
     if (!setPropTryTypedObject(&emitted, obj, name, value) || emitted)
         return emitted;
 
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     bool barrier = PropertyWriteNeedsTypeBarrier(alloc(), constraints(), current, &obj, name, &value,
                                                  /* canModify = */ true);
 
     // Try to emit stores to unboxed objects.
     trackOptimizationAttempt(TrackedStrategy::SetProp_Unboxed);
     if (!setPropTryUnboxed(&emitted, obj, name, value, barrier, objTypes) || emitted)
         return emitted;
 
@@ -10715,17 +10713,17 @@ IonBuilder::setPropTryCommonSetter(bool 
     BaselineInspector::ShapeVector receiverShapes(alloc());
     if (!inspector->commonSetPropFunction(pc, &foundProto, &lastProperty, &commonSetter, &isOwnProperty,
                                           receiverShapes))
     {
         trackOptimizationOutcome(TrackedOutcome::NoProtoFound);
         return true;
     }
 
-    types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
+    TemporaryTypeSet *objTypes = obj->resultTypeSet();
     MDefinition *guard = nullptr;
     bool canUseTIForSetter =
         testCommonGetterSetter(objTypes, name, /* isGetter = */ false,
                                foundProto, lastProperty, &guard);
     if (!canUseTIForSetter) {
         // If type information is bad, we can still optimize the setter if we
         // shape guard.
         obj = addShapeGuardsForGetterSetter(obj, foundProto, lastProperty, receiverShapes,
@@ -10808,17 +10806,17 @@ IonBuilder::setPropTryCommonSetter(bool 
 
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::setPropTryCommonDOMSetter(bool *emitted, MDefinition *obj,
                                       MDefinition *value, JSFunction *setter,
-                                      types::TemporaryTypeSet *objTypes)
+                                      TemporaryTypeSet *objTypes)
 {
     MOZ_ASSERT(*emitted == false);
 
     if (!objTypes || !objTypes->isDOMClass(constraints()))
         return true;
 
     if (!testShouldDOMCall(objTypes, setter, JSJitInfo::Setter))
         return true;
@@ -10873,17 +10871,17 @@ IonBuilder::setPropTryReferencePropOfTyp
                                                  MDefinition *obj,
                                                  int32_t fieldOffset,
                                                  MDefinition *value,
                                                  TypedObjectPrediction fieldPrediction,
                                                  PropertyName *name)
 {
     ReferenceTypeDescr::Type fieldType = fieldPrediction.referenceType();
 
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
         return true;
 
     LinearSum byteOffset(alloc());
     if (!byteOffset.add(fieldOffset))
         setForceAbort();
 
     if (!storeReferenceTypedObjectValue(obj, byteOffset, fieldType, value, name))
@@ -10902,17 +10900,17 @@ IonBuilder::setPropTryScalarPropOfTypedO
                                               int32_t fieldOffset,
                                               MDefinition *value,
                                               TypedObjectPrediction fieldPrediction)
 {
     // Must always be loading the same scalar type
     Scalar::Type fieldType = fieldPrediction.scalarType();
 
     // Don't optimize if the typed object might be neutered.
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (globalKey->hasFlags(constraints(), OBJECT_FLAG_TYPED_OBJECT_NEUTERED))
         return true;
 
     LinearSum byteOffset(alloc());
     if (!byteOffset.add(fieldOffset))
         setForceAbort();
 
     if (!storeScalarTypedObjectValue(obj, byteOffset, fieldType, false, value))
@@ -10923,36 +10921,36 @@ IonBuilder::setPropTryScalarPropOfTypedO
     trackOptimizationSuccess();
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::setPropTryDefiniteSlot(bool *emitted, MDefinition *obj,
                                    PropertyName *name, MDefinition *value,
-                                   bool barrier, types::TemporaryTypeSet *objTypes)
+                                   bool barrier, TemporaryTypeSet *objTypes)
 {
     MOZ_ASSERT(*emitted == false);
 
     if (barrier) {
         trackOptimizationOutcome(TrackedOutcome::NeedsTypeBarrier);
         return true;
     }
 
     uint32_t slot = getDefiniteSlot(obj->resultTypeSet(), name);
     if (slot == UINT32_MAX)
         return true;
 
     bool writeBarrier = false;
     for (size_t i = 0; i < obj->resultTypeSet()->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = obj->resultTypeSet()->getObject(i);
+        TypeSet::ObjectKey *key = obj->resultTypeSet()->getObject(i);
         if (!key)
             continue;
 
-        types::HeapTypeSetKey property = key->property(NameToId(name));
+        HeapTypeSetKey property = key->property(NameToId(name));
         if (property.nonWritable(constraints())) {
             trackOptimizationOutcome(TrackedOutcome::NonWritableProperty);
             return true;
         }
         writeBarrier |= property.needsBarrier(constraints());
     }
 
     MInstruction *store;
@@ -11024,17 +11022,17 @@ IonBuilder::storeUnboxedProperty(MDefini
 
     current->add(store);
     return store;
 }
 
 bool
 IonBuilder::setPropTryUnboxed(bool *emitted, MDefinition *obj,
                               PropertyName *name, MDefinition *value,
-                              bool barrier, types::TemporaryTypeSet *objTypes)
+                              bool barrier, TemporaryTypeSet *objTypes)
 {
     MOZ_ASSERT(*emitted == false);
 
     if (barrier) {
         trackOptimizationOutcome(TrackedOutcome::NeedsTypeBarrier);
         return true;
     }
 
@@ -11058,17 +11056,17 @@ IonBuilder::setPropTryUnboxed(bool *emit
 
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::setPropTryInlineAccess(bool *emitted, MDefinition *obj,
                                    PropertyName *name, MDefinition *value,
-                                   bool barrier, types::TemporaryTypeSet *objTypes)
+                                   bool barrier, TemporaryTypeSet *objTypes)
 {
     MOZ_ASSERT(*emitted == false);
 
     if (barrier) {
         trackOptimizationOutcome(TrackedOutcome::NeedsTypeBarrier);
         return true;
     }
 
@@ -11172,17 +11170,17 @@ IonBuilder::setPropTryInlineAccess(bool 
     trackOptimizationOutcome(TrackedOutcome::Polymorphic);
     *emitted = true;
     return true;
 }
 
 bool
 IonBuilder::setPropTryCache(bool *emitted, MDefinition *obj,
                             PropertyName *name, MDefinition *value,
-                            bool barrier, types::TemporaryTypeSet *objTypes)
+                            bool barrier, TemporaryTypeSet *objTypes)
 {
     MOZ_ASSERT(*emitted == false);
 
     bool strict = IsStrictSetPC(pc);
     // Emit SetPropertyCache.
     MSetPropertyCache *ins = MSetPropertyCache::New(alloc(), obj, value, name, strict, barrier);
 
     if (!objTypes || objTypes->propertyNeedsBarrier(constraints(), NameToId(name)))
@@ -11234,17 +11232,17 @@ IonBuilder::jsop_regexp(RegExpObject *re
     // script could actually observe the effect of such cloning, for instance
     // by getting or setting properties on it.
     //
     // First, make sure the regex is one we can safely optimize. Lowering can
     // then check if this regex object only flows into known natives and can
     // avoid cloning in this case.
 
     bool mustClone = true;
-    types::TypeSetObjectKey *globalKey = types::TypeSetObjectKey::get(&script()->global());
+    TypeSet::ObjectKey *globalKey = TypeSet::ObjectKey::get(&script()->global());
     if (!globalKey->hasFlags(constraints(), OBJECT_FLAG_REGEXP_FLAGS_SET)) {
 #ifdef DEBUG
         // Only compare the statics if the one on script()->global() has been
         // instantiated.
         if (script()->global().hasRegExpStatics()) {
             RegExpStatics *res = script()->global().getAlreadyCreatedRegExpStatics();
             MOZ_ASSERT(res);
             uint32_t origFlags = reobj->getFlags();
@@ -11374,17 +11372,17 @@ IonBuilder::jsop_setarg(uint32_t arg)
                 for (MUseDefIterator iter(op); iter; iter++) {
                     MDefinition *def = iter.def();
                     if (def == val)
                         continue;
                     otherUses = true;
                 }
                 if (!otherUses) {
                     MOZ_ASSERT(op->resultTypeSet() == &argTypes[arg]);
-                    argTypes[arg].addType(types::Type::UnknownType(), alloc_->lifoAlloc());
+                    argTypes[arg].addType(TypeSet::UnknownType(), alloc_->lifoAlloc());
                     if (val->isMul()) {
                         val->setResultType(MIRType_Double);
                         val->toMul()->setSpecialization(MIRType_Double);
                     } else {
                         MOZ_ASSERT(val->type() == MIRType_Int32);
                     }
                     val->setResultTypeSet(nullptr);
                 }
@@ -11622,18 +11620,18 @@ IonBuilder::walkScopeChain(unsigned hops
 
 bool
 IonBuilder::hasStaticScopeObject(ScopeCoordinate sc, JSObject **pcall)
 {
     JSScript *outerScript = ScopeCoordinateFunctionScript(script(), pc);
     if (!outerScript || !outerScript->treatAsRunOnce())
         return false;
 
-    types::TypeSetObjectKey *funKey =
-        types::TypeSetObjectKey::get(outerScript->functionNonDelazifying());
+    TypeSet::ObjectKey *funKey =
+        TypeSet::ObjectKey::get(outerScript->functionNonDelazifying());
     if (funKey->hasFlags(constraints(), OBJECT_FLAG_RUNONCE_INVALIDATED))
         return false;
 
     // The script this aliased var operation is accessing will run only once,
     // so there will be only one call object and the aliased var access can be
     // compiled in the same manner as a global access. We still need to find
     // the call object though.
 
@@ -11712,17 +11710,17 @@ IonBuilder::jsop_getaliasedvar(ScopeCoor
     }
 
     // See jsop_checkaliasedlet.
     MDefinition *load = takeLexicalCheck();
     if (!load)
         load = getAliasedVar(sc);
     current->push(load);
 
-    types::TemporaryTypeSet *types = bytecodeTypes(pc);
+    TemporaryTypeSet *types = bytecodeTypes(pc);
     return pushTypeBarrier(load, types, BarrierKind::TypeSet);
 }
 
 bool
 IonBuilder::jsop_setaliasedvar(ScopeCoordinate sc)
 {
     JSObject *call = nullptr;
     if (hasStaticScopeObject(sc, &call)) {
@@ -11825,17 +11823,17 @@ IonBuilder::jsop_in_dense()
 
     current->add(ins);
     current->push(ins);
 
     return true;
 }
 
 static bool
-HasOnProtoChain(types::CompilerConstraintList *constraints, types::TypeSetObjectKey *key,
+HasOnProtoChain(CompilerConstraintList *constraints, TypeSet::ObjectKey *key,
                 JSObject *protoObject, bool *hasOnProto)
 {
     MOZ_ASSERT(protoObject);
 
     while (true) {
         if (!key->hasStableClassAndProto(constraints) || !key->clasp()->isNative())
             return false;
 
@@ -11845,17 +11843,17 @@ HasOnProtoChain(types::CompilerConstrain
             return true;
         }
 
         if (proto == protoObject) {
             *hasOnProto = true;
             return true;
         }
 
-        key = types::TypeSetObjectKey::get(proto);
+        key = TypeSet::ObjectKey::get(proto);
     }
 
     MOZ_CRASH("Unreachable");
 }
 
 bool
 IonBuilder::tryFoldInstanceOf(MDefinition *lhs, JSObject *protoObject)
 {
@@ -11863,27 +11861,27 @@ IonBuilder::tryFoldInstanceOf(MDefinitio
 
     if (!lhs->mightBeType(MIRType_Object)) {
         // If the lhs is a primitive, the result is false.
         lhs->setImplicitlyUsedUnchecked();
         pushConstant(BooleanValue(false));
         return true;
     }
 
-    types::TemporaryTypeSet *lhsTypes = lhs->resultTypeSet();
+    TemporaryTypeSet *lhsTypes = lhs->resultTypeSet();
     if (!lhsTypes || lhsTypes->unknownObject())
         return false;
 
     // We can fold if either all objects have protoObject on their proto chain
     // or none have.
     bool isFirst = true;
     bool knownIsInstance = false;
 
     for (unsigned i = 0; i < lhsTypes->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = lhsTypes->getObject(i);
+        TypeSet::ObjectKey *key = lhsTypes->getObject(i);
         if (!key)
             continue;
 
         bool isInstance;
         if (!HasOnProtoChain(constraints(), key, protoObject, &isInstance))
             return false;
 
         if (isFirst) {
@@ -11915,26 +11913,26 @@ bool
 IonBuilder::jsop_instanceof()
 {
     MDefinition *rhs = current->pop();
     MDefinition *obj = current->pop();
 
     // If this is an 'x instanceof function' operation and we can determine the
     // exact function and prototype object being tested for, use a typed path.
     do {
-        types::TemporaryTypeSet *rhsTypes = rhs->resultTypeSet();
+        TemporaryTypeSet *rhsTypes = rhs->resultTypeSet();
         JSObject *rhsObject = rhsTypes ? rhsTypes->maybeSingleton() : nullptr;
         if (!rhsObject || !rhsObject->is<JSFunction>() || rhsObject->isBoundFunction())
             break;
 
-        types::TypeSetObjectKey *rhsKey = types::TypeSetObjectKey::get(rhsObject);
+        TypeSet::ObjectKey *rhsKey = TypeSet::ObjectKey::get(rhsObject);
         if (rhsKey->unknownProperties())
             break;
 
-        types::HeapTypeSetKey protoProperty =
+        HeapTypeSetKey protoProperty =
             rhsKey->property(NameToId(names().prototype));
         JSObject *protoObject = protoProperty.singleton(constraints());
         if (!protoObject)
             break;
 
         rhs->setImplicitlyUsedUnchecked();
 
         if (tryFoldInstanceOf(obj, protoObject))
@@ -12059,49 +12057,49 @@ IonBuilder::addShapeGuardPolymorphic(MDe
     for (size_t i = 0, len = shapes.length(); i < len; i++) {
         if (!guard->addShape(shapes[i]))
             return nullptr;
     }
 
     return guard;
 }
 
-types::TemporaryTypeSet *
+TemporaryTypeSet *
 IonBuilder::bytecodeTypes(jsbytecode *pc)
 {
-    return types::TypeScript::BytecodeTypes(script(), pc, bytecodeTypeMap, &typeArrayHint, typeArray);
+    return TypeScript::BytecodeTypes(script(), pc, bytecodeTypeMap, &typeArrayHint, typeArray);
 }
 
 TypedObjectPrediction
 IonBuilder::typedObjectPrediction(MDefinition *typedObj)
 {
     // Extract TypedObjectPrediction directly if we can
     if (typedObj->isNewDerivedTypedObject()) {
         return typedObj->toNewDerivedTypedObject()->prediction();
     }
 
-    types::TemporaryTypeSet *types = typedObj->resultTypeSet();
+    TemporaryTypeSet *types = typedObj->resultTypeSet();
     return typedObjectPrediction(types);
 }
 
 TypedObjectPrediction
-IonBuilder::typedObjectPrediction(types::TemporaryTypeSet *types)
+IonBuilder::typedObjectPrediction(TemporaryTypeSet *types)
 {
     // Type set must be known to be an object.
     if (!types || types->getKnownMIRType() != MIRType_Object)
         return TypedObjectPrediction();
 
     // And only known objects.
     if (types->unknownObject())
         return TypedObjectPrediction();
 
     TypedObjectPrediction out;
     for (uint32_t i = 0; i < types->getObjectCount(); i++) {
         ObjectGroup *group = types->getGroup(i);
-        if (!group || !types::TypeSetObjectKey::get(group)->hasStableClassAndProto(constraints()))
+        if (!group || !TypeSet::ObjectKey::get(group)->hasStableClassAndProto(constraints()))
             return TypedObjectPrediction();
 
         if (!IsTypedObjectClass(group->clasp()))
             return TypedObjectPrediction();
 
         out.addDescr(group->typeDescr());
     }
 
@@ -12172,17 +12170,17 @@ IonBuilder::loadTypedObjectElements(MDef
 {
     MDefinition *owner;
     LinearSum ownerByteOffset(alloc());
     loadTypedObjectData(typedObj, &owner, &ownerByteOffset);
 
     if (!ownerByteOffset.add(baseByteOffset))
         setForceAbort();
 
-    types::TemporaryTypeSet *ownerTypes = owner->resultTypeSet();
+    TemporaryTypeSet *ownerTypes = owner->resultTypeSet();
     const Class *clasp = ownerTypes ? ownerTypes->getKnownClass(constraints()) : nullptr;
     if (clasp && IsInlineTypedObjectClass(clasp)) {
         // Perform the load directly from the owner pointer.
         if (!ownerByteOffset.add(InlineTypedObject::offsetOfDataStart()))
             setForceAbort();
         *ownerElements = owner;
     } else {
         bool definitelyOutline = clasp && IsOutlineTypedObjectClass(clasp);
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -213,17 +213,17 @@ class IonBuilder
         static CFGState Try(jsbytecode *exitpc, MBasicBlock *successor);
     };
 
     static int CmpSuccessors(const void *a, const void *b);
 
   public:
     IonBuilder(JSContext *analysisContext, CompileCompartment *comp,
                const JitCompileOptions &options, TempAllocator *temp,
-               MIRGraph *graph, types::CompilerConstraintList *constraints,
+               MIRGraph *graph, CompilerConstraintList *constraints,
                BaselineInspector *inspector, CompileInfo *info,
                const OptimizationInfo *optimizationInfo, BaselineFrameInspector *baselineFrame,
                size_t inliningDepth = 0, uint32_t loopDepth = 0);
 
     bool build();
     bool buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoint,
                      CallInfo &callInfo);
 
@@ -235,18 +235,18 @@ class IonBuilder
     uint32_t readIndex(jsbytecode *pc);
     JSAtom *readAtom(jsbytecode *pc);
     bool abort(const char *message, ...);
     void trackActionableAbort(const char *message);
     void spew(const char *message);
 
     MInstruction *constantMaybeNursery(JSObject *obj);
 
-    JSFunction *getSingleCallTarget(types::TemporaryTypeSet *calleeTypes);
-    bool getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constructing,
+    JSFunction *getSingleCallTarget(TemporaryTypeSet *calleeTypes);
+    bool getPolyCallTargets(TemporaryTypeSet *calleeTypes, bool constructing,
                             ObjectVector &targets, uint32_t maxTargets);
 
     void popCfgStack();
     DeferredEdge *filterDeadDeferredEdges(DeferredEdge *edge);
     bool processDeferredContinues(CFGState &state);
     ControlStatus processControlEnd();
     ControlStatus processCfgStack();
     ControlStatus processCfgEntry(CFGState &state);
@@ -313,17 +313,17 @@ class IonBuilder
 
     // Computes loop phis, places them in all successors of a loop, then
     // handles any pending breaks.
     ControlStatus finishLoop(CFGState &state, MBasicBlock *successor);
 
     // Incorporates a type/typeSet into an OSR value for a loop, after the loop
     // body has been processed.
     bool addOsrValueTypeBarrier(uint32_t slot, MInstruction **def,
-                                MIRType type, types::TemporaryTypeSet *typeSet);
+                                MIRType type, TemporaryTypeSet *typeSet);
     bool maybeAddOsrTypeBarriers();
 
     // Restarts processing of a loop if the type information at its header was
     // incomplete.
     ControlStatus restartLoop(CFGState state);
 
     void assertValidLoopHeadOp(jsbytecode *pc);
 
@@ -353,37 +353,37 @@ class IonBuilder
     MConstant *constant(const Value &v);
     MConstant *constantInt(int32_t i);
 
     // Improve the type information at tests
     bool improveTypesAtTest(MDefinition *ins, bool trueBranch, MTest *test);
     bool improveTypesAtCompare(MCompare *ins, bool trueBranch, MTest *test);
     // Used to detect triangular structure at test.
     bool detectAndOrStructure(MPhi *ins, bool *branchIsTrue);
-    bool replaceTypeSet(MDefinition *subject, types::TemporaryTypeSet *type, MTest *test);
+    bool replaceTypeSet(MDefinition *subject, TemporaryTypeSet *type, MTest *test);
 
     // Add a guard which ensure that the set of type which goes through this
     // generated code correspond to the observed types for the bytecode.
-    MDefinition *addTypeBarrier(MDefinition *def, types::TemporaryTypeSet *observed,
+    MDefinition *addTypeBarrier(MDefinition *def, TemporaryTypeSet *observed,
                                 BarrierKind kind, MTypeBarrier **pbarrier = nullptr);
-    bool pushTypeBarrier(MDefinition *def, types::TemporaryTypeSet *observed, BarrierKind kind);
+    bool pushTypeBarrier(MDefinition *def, TemporaryTypeSet *observed, BarrierKind kind);
 
     // As pushTypeBarrier, but will compute the needBarrier boolean itself based
     // on observed and the JSFunction that we're planning to call. The
     // JSFunction must be a DOM method or getter.
-    bool pushDOMTypeBarrier(MInstruction *ins, types::TemporaryTypeSet *observed, JSFunction* func);
+    bool pushDOMTypeBarrier(MInstruction *ins, TemporaryTypeSet *observed, JSFunction* func);
 
     // If definiteType is not known or def already has the right type, just
     // returns def.  Otherwise, returns an MInstruction that has that definite
     // type, infallibly unboxing ins as needed.  The new instruction will be
     // added to |current| in this case.
     MDefinition *ensureDefiniteType(MDefinition* def, MIRType definiteType);
 
     // Creates a MDefinition based on the given def improved with type as TypeSet.
-    MDefinition *ensureDefiniteTypeSet(MDefinition* def, types::TemporaryTypeSet *types);
+    MDefinition *ensureDefiniteTypeSet(MDefinition* def, TemporaryTypeSet *types);
 
     JSObject *getSingletonPrototype(JSFunction *target);
 
     MDefinition *createThisScripted(MDefinition *callee);
     MDefinition *createThisScriptedSingleton(JSFunction *target, MDefinition *callee);
     MDefinition *createThis(JSFunction *target, MDefinition *callee);
     MInstruction *createDeclEnvObject(MDefinition *callee, MDefinition *scopeObj);
     MInstruction *createCallObject(MDefinition *callee, MDefinition *scopeObj);
@@ -399,95 +399,95 @@ class IonBuilder
 
     MDefinition *convertShiftToMaskForStaticTypedArray(MDefinition *id,
                                                        Scalar::Type viewType);
 
     bool invalidatedIdempotentCache();
 
     bool hasStaticScopeObject(ScopeCoordinate sc, JSObject **pcall);
     bool loadSlot(MDefinition *obj, size_t slot, size_t nfixed, MIRType rvalType,
-                  BarrierKind barrier, types::TemporaryTypeSet *types);
+                  BarrierKind barrier, TemporaryTypeSet *types);
     bool loadSlot(MDefinition *obj, Shape *shape, MIRType rvalType,
-                  BarrierKind barrier, types::TemporaryTypeSet *types);
+                  BarrierKind barrier, TemporaryTypeSet *types);
     bool storeSlot(MDefinition *obj, size_t slot, size_t nfixed,
                    MDefinition *value, bool needsBarrier,
                    MIRType slotType = MIRType_None);
     bool storeSlot(MDefinition *obj, Shape *shape, MDefinition *value, bool needsBarrier,
                    MIRType slotType = MIRType_None);
 
     MDefinition *tryInnerizeWindow(MDefinition *obj);
 
     // jsop_getprop() helpers.
     bool checkIsDefinitelyOptimizedArguments(MDefinition *obj, bool *isOptimizedArgs);
     bool getPropTryInferredConstant(bool *emitted, MDefinition *obj, PropertyName *name,
-                                    types::TemporaryTypeSet *types);
+                                    TemporaryTypeSet *types);
     bool getPropTryArgumentsLength(bool *emitted, MDefinition *obj);
     bool getPropTryArgumentsCallee(bool *emitted, MDefinition *obj, PropertyName *name);
     bool getPropTryConstant(bool *emitted, MDefinition *obj, PropertyName *name,
-                            types::TemporaryTypeSet *types);
+                            TemporaryTypeSet *types);
     bool getPropTryDefiniteSlot(bool *emitted, MDefinition *obj, PropertyName *name,
-                                BarrierKind barrier, types::TemporaryTypeSet *types);
+                                BarrierKind barrier, TemporaryTypeSet *types);
     bool getPropTryUnboxed(bool *emitted, MDefinition *obj, PropertyName *name,
-                           BarrierKind barrier, types::TemporaryTypeSet *types);
+                           BarrierKind barrier, TemporaryTypeSet *types);
     bool getPropTryCommonGetter(bool *emitted, MDefinition *obj, PropertyName *name,
-                                types::TemporaryTypeSet *types);
+                                TemporaryTypeSet *types);
     bool getPropTryInlineAccess(bool *emitted, MDefinition *obj, PropertyName *name,
-                                BarrierKind barrier, types::TemporaryTypeSet *types);
+                                BarrierKind barrier, TemporaryTypeSet *types);
     bool getPropTryTypedObject(bool *emitted, MDefinition *obj, PropertyName *name);
     bool getPropTryScalarPropOfTypedObject(bool *emitted, MDefinition *typedObj,
                                            int32_t fieldOffset,
                                            TypedObjectPrediction fieldTypeReprs);
     bool getPropTryReferencePropOfTypedObject(bool *emitted, MDefinition *typedObj,
                                               int32_t fieldOffset,
                                               TypedObjectPrediction fieldPrediction,
                                               PropertyName *name);
     bool getPropTryComplexPropOfTypedObject(bool *emitted, MDefinition *typedObj,
                                             int32_t fieldOffset,
                                             TypedObjectPrediction fieldTypeReprs,
                                             size_t fieldIndex);
     bool getPropTryInnerize(bool *emitted, MDefinition *obj, PropertyName *name,
-                            types::TemporaryTypeSet *types);
+                            TemporaryTypeSet *types);
     bool getPropTryCache(bool *emitted, MDefinition *obj, PropertyName *name,
-                         BarrierKind barrier, types::TemporaryTypeSet *types);
+                         BarrierKind barrier, TemporaryTypeSet *types);
 
     // jsop_setprop() helpers.
     bool setPropTryCommonSetter(bool *emitted, MDefinition *obj,
                                 PropertyName *name, MDefinition *value);
     bool setPropTryCommonDOMSetter(bool *emitted, MDefinition *obj,
                                    MDefinition *value, JSFunction *setter,
-                                   types::TemporaryTypeSet *objTypes);
+                                   TemporaryTypeSet *objTypes);
     bool setPropTryDefiniteSlot(bool *emitted, MDefinition *obj,
                                 PropertyName *name, MDefinition *value,
-                                bool barrier, types::TemporaryTypeSet *objTypes);
+                                bool barrier, TemporaryTypeSet *objTypes);
     bool setPropTryUnboxed(bool *emitted, MDefinition *obj,
                            PropertyName *name, MDefinition *value,
-                           bool barrier, types::TemporaryTypeSet *objTypes);
+                           bool barrier, TemporaryTypeSet *objTypes);
     bool setPropTryInlineAccess(bool *emitted, MDefinition *obj,
                                 PropertyName *name, MDefinition *value,
-                                bool barrier, types::TemporaryTypeSet *objTypes);
+                                bool barrier, TemporaryTypeSet *objTypes);
     bool setPropTryTypedObject(bool *emitted, MDefinition *obj,
                                PropertyName *name, MDefinition *value);
     bool setPropTryReferencePropOfTypedObject(bool *emitted,
                                               MDefinition *obj,
                                               int32_t fieldOffset,
                                               MDefinition *value,
                                               TypedObjectPrediction fieldPrediction,
                                               PropertyName *name);
     bool setPropTryScalarPropOfTypedObject(bool *emitted,
                                            MDefinition *obj,
                                            int32_t fieldOffset,
                                            MDefinition *value,
                                            TypedObjectPrediction fieldTypeReprs);
     bool setPropTryCache(bool *emitted, MDefinition *obj,
                          PropertyName *name, MDefinition *value,
-                         bool barrier, types::TemporaryTypeSet *objTypes);
+                         bool barrier, TemporaryTypeSet *objTypes);
 
     // binary data lookup helpers.
     TypedObjectPrediction typedObjectPrediction(MDefinition *typedObj);
-    TypedObjectPrediction typedObjectPrediction(types::TemporaryTypeSet *types);
+    TypedObjectPrediction typedObjectPrediction(TemporaryTypeSet *types);
     bool typedObjectHasField(MDefinition *typedObj,
                              PropertyName *name,
                              size_t *fieldOffset,
                              TypedObjectPrediction *fieldTypeReprs,
                              size_t *fieldIndex);
     MDefinition *loadTypedObjectType(MDefinition *value);
     void loadTypedObjectData(MDefinition *typedObj,
                              MDefinition **owner,
@@ -645,17 +645,17 @@ class IonBuilder
     bool jsop_getgname(PropertyName *name);
     bool jsop_getname(PropertyName *name);
     bool jsop_intrinsic(PropertyName *name);
     bool jsop_bindname(PropertyName *name);
     bool jsop_getelem();
     bool jsop_getelem_dense(MDefinition *obj, MDefinition *index);
     bool jsop_getelem_typed(MDefinition *obj, MDefinition *index, ScalarTypeDescr::Type arrayType);
     bool jsop_setelem();
-    bool jsop_setelem_dense(types::TemporaryTypeSet::DoubleConversion conversion,
+    bool jsop_setelem_dense(TemporaryTypeSet::DoubleConversion conversion,
                             SetElemSafety safety,
                             MDefinition *object, MDefinition *index, MDefinition *value);
     bool jsop_setelem_typed(ScalarTypeDescr::Type arrayType,
                             SetElemSafety safety,
                             MDefinition *object, MDefinition *index, MDefinition *value);
     bool jsop_setelem_typed_object(ScalarTypeDescr::Type arrayType,
                                    SetElemSafety safety, bool racy,
                                    MDefinition *object, MDefinition *index, MDefinition *value);
@@ -721,17 +721,17 @@ class IonBuilder
     InliningDecision canInlineTarget(JSFunction *target, CallInfo &callInfo);
     InliningDecision makeInliningDecision(JSObject *target, CallInfo &callInfo);
     bool selectInliningTargets(const ObjectVector &targets, CallInfo &callInfo,
                                BoolVector &choiceSet, uint32_t *numInlineable);
 
     // Native inlining helpers.
     // The typeset for the return value of our function.  These are
     // the types it's been observed returning in the past.
-    types::TemporaryTypeSet *getInlineReturnTypeSet();
+    TemporaryTypeSet *getInlineReturnTypeSet();
     // The known MIR type of getInlineReturnTypeSet.
     MIRType getInlineReturnType();
 
     // Array natives.
     InliningStatus inlineArray(CallInfo &callInfo);
     InliningStatus inlineArrayPopShift(CallInfo &callInfo, MArrayPopShift::Mode mode);
     InliningStatus inlineArrayPush(CallInfo &callInfo);
     InliningStatus inlineArrayConcat(CallInfo &callInfo);
@@ -858,56 +858,56 @@ class IonBuilder
     MCall *makeCallHelper(JSFunction *target, CallInfo &callInfo, bool cloneAtCallsite);
     bool makeCall(JSFunction *target, CallInfo &callInfo, bool cloneAtCallsite);
 
     MDefinition *patchInlinedReturn(CallInfo &callInfo, MBasicBlock *exit, MBasicBlock *bottom);
     MDefinition *patchInlinedReturns(CallInfo &callInfo, MIRGraphReturns &returns,
                                      MBasicBlock *bottom);
     MDefinition *specializeInlinedReturn(MDefinition *rdef, MBasicBlock *exit);
 
-    bool objectsHaveCommonPrototype(types::TemporaryTypeSet *types, PropertyName *name,
+    bool objectsHaveCommonPrototype(TemporaryTypeSet *types, PropertyName *name,
                                     bool isGetter, JSObject *foundProto, bool *guardGlobal);
-    void freezePropertiesForCommonPrototype(types::TemporaryTypeSet *types, PropertyName *name,
+    void freezePropertiesForCommonPrototype(TemporaryTypeSet *types, PropertyName *name,
                                             JSObject *foundProto, bool allowEmptyTypesForGlobal = false);
     /*
      * Callers must pass a non-null globalGuard if they pass a non-null globalShape.
      */
-    bool testCommonGetterSetter(types::TemporaryTypeSet *types, PropertyName *name,
+    bool testCommonGetterSetter(TemporaryTypeSet *types, PropertyName *name,
                                 bool isGetter, JSObject *foundProto, Shape *lastProperty,
                                 MDefinition **guard, Shape *globalShape = nullptr,
                                 MDefinition **globalGuard = nullptr);
-    bool testShouldDOMCall(types::TypeSet *inTypes,
+    bool testShouldDOMCall(TypeSet *inTypes,
                            JSFunction *func, JSJitInfo::OpType opType);
 
     MDefinition *addShapeGuardsForGetterSetter(MDefinition *obj, JSObject *holder, Shape *holderShape,
                                                const BaselineInspector::ShapeVector &receiverShapes,
                                                bool isOwnProperty);
 
     bool annotateGetPropertyCache(MDefinition *obj, MGetPropertyCache *getPropCache,
-                                  types::TemporaryTypeSet *objTypes,
-                                  types::TemporaryTypeSet *pushedTypes);
+                                  TemporaryTypeSet *objTypes,
+                                  TemporaryTypeSet *pushedTypes);
 
     MGetPropertyCache *getInlineableGetPropertyCache(CallInfo &callInfo);
 
     JSObject *testSingletonProperty(JSObject *obj, PropertyName *name);
     bool testSingletonPropertyTypes(MDefinition *obj, JSObject *singleton, PropertyName *name,
                                     bool *testObject, bool *testString);
-    uint32_t getDefiniteSlot(types::TemporaryTypeSet *types, PropertyName *name);
-    uint32_t getUnboxedOffset(types::TemporaryTypeSet *types, PropertyName *name,
+    uint32_t getDefiniteSlot(TemporaryTypeSet *types, PropertyName *name);
+    uint32_t getUnboxedOffset(TemporaryTypeSet *types, PropertyName *name,
                               JSValueType *punboxedType);
     MInstruction *loadUnboxedProperty(MDefinition *obj, size_t offset, JSValueType unboxedType,
-                                      BarrierKind barrier, types::TemporaryTypeSet *types);
+                                      BarrierKind barrier, TemporaryTypeSet *types);
     MInstruction *storeUnboxedProperty(MDefinition *obj, size_t offset, JSValueType unboxedType,
                                        MDefinition *value);
-    bool freezePropTypeSets(types::TemporaryTypeSet *types,
+    bool freezePropTypeSets(TemporaryTypeSet *types,
                             JSObject *foundProto, PropertyName *name);
     bool canInlinePropertyOpShapes(const BaselineInspector::ShapeVector &nativeShapes,
                                    const BaselineInspector::ObjectGroupVector &unboxedGroups);
 
-    types::TemporaryTypeSet *bytecodeTypes(jsbytecode *pc);
+    TemporaryTypeSet *bytecodeTypes(jsbytecode *pc);
 
     // Use one of the below methods for updating the current block, rather than
     // updating |current| directly. setCurrent() should only be used in cases
     // where the block cannot have phis whose type needs to be computed.
 
     bool setCurrentAndSpecializePhis(MBasicBlock *block) {
         if (block) {
             if (!block->specializePhis())
@@ -941,17 +941,17 @@ class IonBuilder
   public:
     void clearForBackEnd();
 
     JSScript *script() const { return script_; }
 
     CodeGenerator *backgroundCodegen() const { return backgroundCodegen_; }
     void setBackgroundCodegen(CodeGenerator *codegen) { backgroundCodegen_ = codegen; }
 
-    types::CompilerConstraintList *constraints() {
+    CompilerConstraintList *constraints() {
         return constraints_;
     }
 
     bool isInlineBuilder() const {
         return callerBuilder_ != nullptr;
     }
 
     const JSAtomState &names() { return compartment->runtime()->names(); }
@@ -973,25 +973,25 @@ class IonBuilder
 
   private:
     bool init();
 
     JSContext *analysisContext;
     BaselineFrameInspector *baselineFrame_;
 
     // Constraints for recording dependencies on type information.
-    types::CompilerConstraintList *constraints_;
+    CompilerConstraintList *constraints_;
 
     // Basic analysis information about the script.
     BytecodeAnalysis analysis_;
     BytecodeAnalysis &analysis() {
         return analysis_;
     }
 
-    types::TemporaryTypeSet *thisTypes, *argTypes, *typeArray;
+    TemporaryTypeSet *thisTypes, *argTypes, *typeArray;
     uint32_t typeArrayHint;
     uint32_t *bytecodeTypeMap;
 
     GSNCache gsn;
     ScopeCoordinateNameCache scopeCoordinateNameCache;
 
     jsbytecode *pc;
     MBasicBlock *current;
@@ -1114,17 +1114,17 @@ class IonBuilder
 
     // Used in tracking outcomes of optimization strategies for devtools.
     void startTrackingOptimizations();
 
     // The track* methods below are called often. Do not combine them with the
     // unchecked variants, despite the unchecked variants having no other
     // callers.
     void trackTypeInfo(JS::TrackedTypeSite site, MIRType mirType,
-                       types::TemporaryTypeSet *typeSet)
+                       TemporaryTypeSet *typeSet)
     {
         if (MOZ_UNLIKELY(current->trackedSite()->hasOptimizations()))
             trackTypeInfoUnchecked(site, mirType, typeSet);
     }
     void trackTypeInfo(JS::TrackedTypeSite site, JSObject *obj) {
         if (MOZ_UNLIKELY(current->trackedSite()->hasOptimizations()))
             trackTypeInfoUnchecked(site, obj);
     }
@@ -1151,17 +1151,17 @@ class IonBuilder
     void trackInlineSuccess(InliningStatus status = InliningStatus_Inlined) {
         if (MOZ_UNLIKELY(current->trackedSite()->hasOptimizations()))
             trackInlineSuccessUnchecked(status);
     }
 
     // Out-of-line variants that don't check if optimization tracking is
     // enabled.
     void trackTypeInfoUnchecked(JS::TrackedTypeSite site, MIRType mirType,
-                                types::TemporaryTypeSet *typeSet);
+                                TemporaryTypeSet *typeSet);
     void trackTypeInfoUnchecked(JS::TrackedTypeSite site, JSObject *obj);
     void trackTypeInfoUnchecked(CallInfo &callInfo);
     void trackOptimizationAttemptUnchecked(JS::TrackedStrategy strategy);
     void amendOptimizationAttemptUnchecked(uint32_t index);
     void trackOptimizationOutcomeUnchecked(JS::TrackedOutcome outcome);
     void trackOptimizationSuccessUnchecked();
     void trackInlineSuccessUnchecked(InliningStatus status);
 };
@@ -1287,16 +1287,16 @@ class CallInfo
     void setImplicitlyUsedUnchecked() {
         fun_->setImplicitlyUsedUnchecked();
         thisArg_->setImplicitlyUsedUnchecked();
         for (uint32_t i = 0; i < argc(); i++)
             getArg(i)->setImplicitlyUsedUnchecked();
     }
 };
 
-bool TypeSetIncludes(types::TypeSet *types, MIRType input, types::TypeSet *inputTypes);
+bool TypeSetIncludes(TypeSet *types, MIRType input, TypeSet *inputTypes);
 
 bool NeedsPostBarrier(CompileInfo &info, MDefinition *value);
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_IonBuilder_h */
--- a/js/src/jit/IonCaches.cpp
+++ b/js/src/jit/IonCaches.cpp
@@ -1263,20 +1263,19 @@ GetPropertyIC::allowArrayLength(Context 
 
     uint32_t locationIndex, numLocations;
     getLocationInfo(&locationIndex, &numLocations);
 
     IonScript *ion = GetTopJitJSScript(cx)->ionScript();
     CacheLocation *locs = ion->getCacheLocs(locationIndex);
     for (size_t i = 0; i < numLocations; i++) {
         CacheLocation &curLoc = locs[i];
-        types::StackTypeSet *bcTypes =
-            types::TypeScript::BytecodeTypes(curLoc.script, curLoc.pc);
-
-        if (!bcTypes->hasType(types::Type::Int32Type()))
+        StackTypeSet *bcTypes = TypeScript::BytecodeTypes(curLoc.script, curLoc.pc);
+
+        if (!bcTypes->hasType(TypeSet::Int32Type()))
             return false;
     }
 
     return true;
 }
 
 bool
 GetPropertyIC::tryAttachNative(JSContext *cx, HandleScript outerScript, IonScript *ion,
@@ -1850,17 +1849,17 @@ GetPropertyIC::update(JSContext *cx, siz
         if (JSOp(*pc) == JSOP_CALLPROP && MOZ_UNLIKELY(vp.isUndefined())) {
             if (!OnUnknownMethod(cx, obj, IdToValue(id), vp))
                 return false;
         }
 #endif
 
         // Monitor changes to cache entry.
         if (!cache.monitoredResult())
-            types::TypeScript::Monitor(cx, script, pc, vp);
+            TypeScript::Monitor(cx, script, pc, vp);
     }
 
     return true;
 }
 
 void
 GetPropertyIC::reset()
 {
@@ -1895,21 +1894,21 @@ IonCache::destroy()
 static void
 CheckTypeSetForWrite(MacroAssembler &masm, JSObject *obj, jsid id,
                      Register object, ConstantOrRegister value, Label *failure)
 {
     TypedOrValueRegister valReg = value.reg();
     ObjectGroup *group = obj->group();
     if (group->unknownProperties())
         return;
-    types::HeapTypeSet *propTypes = group->maybeGetProperty(id);
+    HeapTypeSet *propTypes = group->maybeGetProperty(id);
     MOZ_ASSERT(propTypes);
 
     // guardTypeSet can read from type sets without triggering read barriers.
-    types::TypeSet::readBarrier(propTypes);
+    TypeSet::readBarrier(propTypes);
 
     Register scratch = object;
     masm.guardTypeSet(valReg, propTypes, BarrierKind::TypeSet, scratch, failure);
 }
 
 static void
 GenerateSetSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &attacher,
                 NativeObject *obj, Shape *shape, Register object, ConstantOrRegister value,
@@ -2576,37 +2575,37 @@ SetPropertyIC::attachAddSlot(JSContext *
 }
 
 static bool
 CanInlineSetPropTypeCheck(JSObject *obj, jsid id, ConstantOrRegister val, bool *checkTypeset)
 {
     bool shouldCheck = false;
     ObjectGroup *group = obj->group();
     if (!group->unknownProperties()) {
-        types::HeapTypeSet *propTypes = group->maybeGetProperty(id);
+        HeapTypeSet *propTypes = group->maybeGetProperty(id);
         if (!propTypes)
             return false;
         if (!propTypes->unknown()) {
             if (obj->isSingleton() && !propTypes->nonConstantProperty())
                 return false;
             shouldCheck = true;
             if (val.constant()) {
                 // If the input is a constant, then don't bother if the barrier will always fail.
-                if (!propTypes->hasType(types::GetValueType(val.value())))
+                if (!propTypes->hasType(TypeSet::GetValueType(val.value())))
                     return false;
                 shouldCheck = false;
             } else {
                 TypedOrValueRegister reg = val.reg();
                 // We can do the same trick as above for primitive types of specialized registers.
                 // TIs handling of objects is complicated enough to warrant a runtime
                 // check, as we can't statically handle the case where the typeset
                 // contains the specific object, but doesn't have ANYOBJECT set.
                 if (reg.hasTyped() && reg.type() != MIRType_Object) {
                     JSValueType valType = ValueTypeFromMIRType(reg.type());
-                    if (!propTypes->hasType(types::Type::PrimitiveType(valType)))
+                    if (!propTypes->hasType(TypeSet::PrimitiveType(valType)))
                         return false;
                     shouldCheck = false;
                 }
             }
         }
     }
 
     *checkTypeset = shouldCheck;
@@ -3404,17 +3403,17 @@ GetElementIC::update(JSContext *cx, size
 
     // Override the return value when the script is invalidated (bug 728188).
     AutoDetectInvalidation adi(cx, res, ion);
 
     if (cache.isDisabled()) {
         if (!GetObjectElementOperation(cx, JSOp(*pc), obj, idval, res))
             return false;
         if (!cache.monitoredResult())
-            types::TypeScript::Monitor(cx, script, pc, res);
+            TypeScript::Monitor(cx, script, pc, res);
         return true;
     }
 
     RootedId id(cx);
     if (!ValueToId<CanGC>(cx, idval, &id))
         return false;
 
     bool attachedStub = false;
@@ -3458,17 +3457,17 @@ GetElementIC::update(JSContext *cx, size
             JitSpew(JitSpew_IonIC, "Disable inline cache");
             cache.disable();
         }
     } else {
         cache.resetFailedUpdates();
     }
 
     if (!cache.monitoredResult())
-        types::TypeScript::Monitor(cx, script, pc, res);
+        TypeScript::Monitor(cx, script, pc, res);
     return true;
 }
 
 void
 GetElementIC::reset()
 {
     RepatchIonCache::reset();
     hasDenseStub_ = false;
@@ -4138,17 +4137,17 @@ NameIC::update(JSContext *cx, size_t cac
             }
         } else if (IsCacheableNameCallGetter(scopeChain, obj, holder, shape)) {
             if (!cache.attachCallGetter(cx, outerScript, ion, scopeChain, obj, holder, shape, returnAddr))
                 return false;
         }
     }
 
     // Monitor changes to cache entry.
-    types::TypeScript::Monitor(cx, script, pc, vp);
+    TypeScript::Monitor(cx, script, pc, vp);
 
     return true;
 }
 
 bool
 CallsiteCloneIC::attach(JSContext *cx, HandleScript outerScript, IonScript *ion,
                         HandleFunction original, HandleFunction clone)
 {
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -260,17 +260,17 @@ struct IonScript
     // List of patchable backedges which are threaded into the runtime's list.
     uint32_t backedgeList_;
     uint32_t backedgeEntries_;
 
     // Number of references from invalidation records.
     uint32_t invalidationCount_;
 
     // Identifier of the compilation which produced this code.
-    types::RecompileInfo recompileInfo_;
+    RecompileInfo recompileInfo_;
 
     // The optimization level this script was compiled in.
     OptimizationLevel optimizationLevel_;
 
     // Number of times we tried to enter this script via OSR but failed due to
     // a LOOPENTRY pc other than osrPc_.
     uint32_t osrPcMismatchCounter_;
 
@@ -327,17 +327,17 @@ struct IonScript
 
   private:
     void trace(JSTracer *trc);
 
   public:
     // Do not call directly, use IonScript::New. This is public for cx->new_.
     IonScript();
 
-    static IonScript *New(JSContext *cx, types::RecompileInfo recompileInfo,
+    static IonScript *New(JSContext *cx, RecompileInfo recompileInfo,
                           uint32_t frameSlots, uint32_t argumentSlots, uint32_t frameSize,
                           size_t snapshotsListSize, size_t snapshotsRVATableSize,
                           size_t recoversSize, size_t bailoutEntries,
                           size_t constants, size_t safepointIndexEntries,
                           size_t osiIndexEntries, size_t cacheEntries,
                           size_t runtimeSize, size_t safepointsSize,
                           size_t backedgeEntries, OptimizationLevel optimizationLevel);
     static void Trace(JSTracer *trc, IonScript *script);
@@ -536,20 +536,20 @@ struct IonScript
         invalidationCount_++;
     }
     void decrementInvalidationCount(FreeOp *fop) {
         MOZ_ASSERT(invalidationCount_);
         invalidationCount_--;
         if (!invalidationCount_)
             Destroy(fop, this);
     }
-    const types::RecompileInfo& recompileInfo() const {
+    const RecompileInfo& recompileInfo() const {
         return recompileInfo_;
     }
-    types::RecompileInfo& recompileInfoRef() {
+    RecompileInfo& recompileInfoRef() {
         return recompileInfo_;
     }
     OptimizationLevel optimizationLevel() const {
         return optimizationLevel_;
     }
     uint32_t incrOsrPcMismatchCounter() {
         return ++osrPcMismatchCounter_;
     }
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -2110,17 +2110,17 @@ SnapshotIterator::computeInstructionResu
         // No need to iterate over the only resume point.
         if (!numResults) {
             MOZ_ASSERT(results->isInitialized());
             return true;
         }
 
         // Use AutoEnterAnalysis to avoid invoking the object metadata callback,
         // which could try to walk the stack while bailing out.
-        types::AutoEnterAnalysis enter(cx);
+        AutoEnterAnalysis enter(cx);
 
         // Fill with the results of recover instructions.
         SnapshotIterator s(*this);
         s.instructionResults_ = results;
         while (s.moreInstructions()) {
             // Skip resume point and only interpret recover instructions.
             if (s.instruction()->isResumePoint()) {
                 s.skipInstruction();
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -2290,17 +2290,17 @@ LIRGenerator::visitFilterTypeSet(MFilter
 }
 
 void
 LIRGenerator::visitTypeBarrier(MTypeBarrier *ins)
 {
     // Requesting a non-GC pointer is safe here since we never re-enter C++
     // from inside a type barrier test.
 
-    const types::TemporaryTypeSet *types = ins->resultTypeSet();
+    const TemporaryTypeSet *types = ins->resultTypeSet();
     bool needTemp = !types->unknownObject() && types->getObjectCount() > 0;
 
     MIRType inputType = ins->getOperand(0)->type();
     DebugOnly<MIRType> outputType = ins->type();
 
     MOZ_ASSERT(inputType == outputType);
 
     // Handle typebarrier that will always bail.
@@ -2320,17 +2320,17 @@ LIRGenerator::visitTypeBarrier(MTypeBarr
         useBox(barrier, LTypeBarrierV::Input, ins->input());
         assignSnapshot(barrier, Bailout_TypeBarrierV);
         redefine(ins, ins->input());
         add(barrier, ins);
         return;
     }
 
     // Handle typebarrier with specific ObjectGroup/SingleObjects.
-    if (inputType == MIRType_Object && !types->hasType(types::Type::AnyObjectType()) &&
+    if (inputType == MIRType_Object && !types->hasType(TypeSet::AnyObjectType()) &&
         ins->barrierKind() != BarrierKind::TypeTagOnly)
     {
         LDefinition tmp = needTemp ? temp() : LDefinition::BogusTemp();
         LTypeBarrierO *barrier = new(alloc()) LTypeBarrierO(useRegister(ins->getOperand(0)), tmp);
         assignSnapshot(barrier, Bailout_TypeBarrierO);
         redefine(ins, ins->getOperand(0));
         add(barrier, ins);
         return;
@@ -2341,17 +2341,17 @@ LIRGenerator::visitTypeBarrier(MTypeBarr
 }
 
 void
 LIRGenerator::visitMonitorTypes(MMonitorTypes *ins)
 {
     // Requesting a non-GC pointer is safe here since we never re-enter C++
     // from inside a type check.
 
-    const types::TemporaryTypeSet *types = ins->typeSet();
+    const TemporaryTypeSet *types = ins->typeSet();
     bool needTemp = !types->unknownObject() && types->getObjectCount() > 0;
     LDefinition tmp = needTemp ? temp() : tempToUnbox();
 
     LMonitorTypes *lir = new(alloc()) LMonitorTypes(tmp);
     useBox(lir, LMonitorTypes::Input, ins->input());
     assignSnapshot(lir, Bailout_MonitorTypes);
     add(lir, ins);
 }
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -269,17 +269,17 @@ IonBuilder::InliningStatus
 IonBuilder::inlineNativeGetter(CallInfo &callInfo, JSFunction *target)
 {
     MOZ_ASSERT(target->isNative());
     JSNative native = target->native();
 
     if (!optimizationInfo().inlineNative())
         return InliningStatus_NotInlined;
 
-    types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+    TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
     MOZ_ASSERT(callInfo.argc() == 0);
 
     // Try to optimize typed array lengths. There is one getter on
     // %TypedArray%.prototype for typed arrays and one getter on
     // SharedTypedArray.prototype for shared typed arrays.  Make sure we're
     // accessing the right one for the type of the instance object.
     if (thisTypes) {
         Scalar::Type type;
@@ -316,26 +316,26 @@ IonBuilder::inlineNonFunctionCall(CallIn
         return inlineConstructTypedObject(callInfo, &target->as<TypeDescr>());
 
     if (!callInfo.constructing() && target->callHook() == SimdTypeDescr::call)
         return inlineConstructSimdObject(callInfo, &target->as<SimdTypeDescr>());
 
     return InliningStatus_NotInlined;
 }
 
-types::TemporaryTypeSet *
+TemporaryTypeSet *
 IonBuilder::getInlineReturnTypeSet()
 {
     return bytecodeTypes(pc);
 }
 
 MIRType
 IonBuilder::getInlineReturnType()
 {
-    types::TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
+    TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
     return returnTypes->getKnownMIRType();
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineMathFunction(CallInfo &callInfo, MMathFunction::Function function)
 {
     if (callInfo.constructing())
         return InliningStatus_NotInlined;
@@ -372,33 +372,33 @@ IonBuilder::inlineArray(CallInfo &callIn
     }
     ArrayObject *templateArray = &templateObject->as<ArrayObject>();
 
     // Multiple arguments imply array initialization, not just construction.
     if (callInfo.argc() >= 2) {
         initLength = callInfo.argc();
         allocating = NewArray_FullyAllocating;
 
-        types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(templateArray);
+        TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(templateArray);
         if (!key->unknownProperties()) {
-            types::HeapTypeSetKey elemTypes = key->property(JSID_VOID);
+            HeapTypeSetKey elemTypes = key->property(JSID_VOID);
 
             for (uint32_t i = 0; i < initLength; i++) {
                 MDefinition *value = callInfo.getArg(i);
                 if (!TypeSetIncludes(elemTypes.maybeTypes(), value->type(), value->resultTypeSet())) {
                     elemTypes.freeze(constraints());
                     return InliningStatus_NotInlined;
                 }
             }
         }
     }
 
-    types::TemporaryTypeSet::DoubleConversion conversion =
+    TemporaryTypeSet::DoubleConversion conversion =
         getInlineReturnTypeSet()->convertDoubleElements(constraints());
-    if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles)
+    if (conversion == TemporaryTypeSet::AlwaysConvertToDoubles)
         templateArray->setShouldConvertDoubleElements();
     else
         templateArray->clearShouldConvertDoubleElements();
 
     // A single integer argument denotes initial length.
     if (callInfo.argc() == 1) {
         if (callInfo.getArg(0)->type() != MIRType_Int32)
             return InliningStatus_NotInlined;
@@ -456,17 +456,17 @@ IonBuilder::inlineArray(CallInfo &callIn
         // jsop_initelem_array is doing because we do not expect to bailout
         // because the memory is supposed to be allocated by now.
         MConstant *id = nullptr;
         for (uint32_t i = 0; i < initLength; i++) {
             id = MConstant::New(alloc(), Int32Value(i));
             current->add(id);
 
             MDefinition *value = callInfo.getArg(i);
-            if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles) {
+            if (conversion == TemporaryTypeSet::AlwaysConvertToDoubles) {
                 MInstruction *valueDouble = MToDouble::New(alloc(), value);
                 current->add(valueDouble);
                 value = valueDouble;
             }
 
             // There is normally no need for a post barrier on these writes
             // because the new array will be in the nursery. However, this
             // assumption is volated if we specifically requested pre-tenuring.
@@ -507,36 +507,36 @@ IonBuilder::inlineArrayPopShift(CallInfo
     // used in an iterator: popping elements does not account for suppressing
     // deleted properties in active iterators.
     ObjectGroupFlags unhandledFlags =
         OBJECT_FLAG_SPARSE_INDEXES |
         OBJECT_FLAG_LENGTH_OVERFLOW |
         OBJECT_FLAG_ITERATED;
 
     MDefinition *obj = callInfo.thisArg();
-    types::TemporaryTypeSet *thisTypes = obj->resultTypeSet();
+    TemporaryTypeSet *thisTypes = obj->resultTypeSet();
     if (!thisTypes || thisTypes->getKnownClass(constraints()) != &ArrayObject::class_)
         return InliningStatus_NotInlined;
     if (thisTypes->hasObjectFlags(constraints(), unhandledFlags)) {
         trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
         return InliningStatus_NotInlined;
     }
 
-    if (types::ArrayPrototypeHasIndexedProperty(constraints(), script())) {
+    if (ArrayPrototypeHasIndexedProperty(constraints(), script())) {
         trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
         return InliningStatus_NotInlined;
     }
 
     callInfo.setImplicitlyUsedUnchecked();
 
     obj = addMaybeCopyElementsForWrite(obj);
 
-    types::TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
+    TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
     bool needsHoleCheck = thisTypes->hasObjectFlags(constraints(), OBJECT_FLAG_NON_PACKED);
-    bool maybeUndefined = returnTypes->hasType(types::Type::UndefinedType());
+    bool maybeUndefined = returnTypes->hasType(TypeSet::UndefinedType());
 
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(),
                                                        obj, nullptr, returnTypes);
     if (barrier != BarrierKind::NoBarrier)
         returnType = MIRType_Value;
 
     MArrayPopShift *ins = MArrayPopShift::New(alloc(), obj, mode, needsHoleCheck, maybeUndefined);
     current->add(ins);
@@ -635,43 +635,43 @@ IonBuilder::inlineArrayPush(CallInfo &ca
     }
     MOZ_ASSERT(obj == callInfo.thisArg() && value == callInfo.getArg(0));
 
     if (getInlineReturnType() != MIRType_Int32)
         return InliningStatus_NotInlined;
     if (callInfo.thisArg()->type() != MIRType_Object)
         return InliningStatus_NotInlined;
 
-    types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+    TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
     if (!thisTypes || thisTypes->getKnownClass(constraints()) != &ArrayObject::class_)
         return InliningStatus_NotInlined;
     if (thisTypes->hasObjectFlags(constraints(), OBJECT_FLAG_SPARSE_INDEXES |
                                   OBJECT_FLAG_LENGTH_OVERFLOW))
     {
         trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
         return InliningStatus_NotInlined;
     }
 
-    if (types::ArrayPrototypeHasIndexedProperty(constraints(), script())) {
+    if (ArrayPrototypeHasIndexedProperty(constraints(), script())) {
         trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
         return InliningStatus_NotInlined;
     }
 
-    types::TemporaryTypeSet::DoubleConversion conversion =
+    TemporaryTypeSet::DoubleConversion conversion =
         thisTypes->convertDoubleElements(constraints());
-    if (conversion == types::TemporaryTypeSet::AmbiguousDoubleConversion) {
+    if (conversion == TemporaryTypeSet::AmbiguousDoubleConversion) {
         trackOptimizationOutcome(TrackedOutcome::ArrayDoubleConversion);
         return InliningStatus_NotInlined;
     }
 
     callInfo.setImplicitlyUsedUnchecked();
     value = callInfo.getArg(0);
 
-    if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles ||
-        conversion == types::TemporaryTypeSet::MaybeConvertToDoubles)
+    if (conversion == TemporaryTypeSet::AlwaysConvertToDoubles ||
+        conversion == TemporaryTypeSet::MaybeConvertToDoubles)
     {
         MInstruction *valueDouble = MToDouble::New(alloc(), value);
         current->add(valueDouble);
         value = valueDouble;
     }
 
     obj = addMaybeCopyElementsForWrite(obj);
 
@@ -699,18 +699,18 @@ IonBuilder::inlineArrayConcat(CallInfo &
     if (getInlineReturnType() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (callInfo.thisArg()->type() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (callInfo.getArg(0)->type() != MIRType_Object)
         return InliningStatus_NotInlined;
 
     // |this| and the argument must be dense arrays.
-    types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
-    types::TemporaryTypeSet *argTypes = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+    TemporaryTypeSet *argTypes = callInfo.getArg(0)->resultTypeSet();
     if (!thisTypes || !argTypes)
         return InliningStatus_NotInlined;
 
     if (thisTypes->getKnownClass(constraints()) != &ArrayObject::class_)
         return InliningStatus_NotInlined;
     if (thisTypes->hasObjectFlags(constraints(), OBJECT_FLAG_SPARSE_INDEXES |
                                   OBJECT_FLAG_LENGTH_OVERFLOW))
     {
@@ -723,60 +723,60 @@ IonBuilder::inlineArrayConcat(CallInfo &
     if (argTypes->hasObjectFlags(constraints(), OBJECT_FLAG_SPARSE_INDEXES |
                                  OBJECT_FLAG_LENGTH_OVERFLOW))
     {
         trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
         return InliningStatus_NotInlined;
     }
 
     // Watch out for indexed properties on the prototype.
-    if (types::ArrayPrototypeHasIndexedProperty(constraints(), script())) {
+    if (ArrayPrototypeHasIndexedProperty(constraints(), script())) {
         trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
         return InliningStatus_NotInlined;
     }
 
     // Require the 'this' types to have a specific type matching the current
     // global, so we can create the result object inline.
     if (thisTypes->getObjectCount() != 1)
         return InliningStatus_NotInlined;
 
     ObjectGroup *thisGroup = thisTypes->getGroup(0);
     if (!thisGroup)
         return InliningStatus_NotInlined;
-    types::TypeSetObjectKey *thisKey = types::TypeSetObjectKey::get(thisGroup);
+    TypeSet::ObjectKey *thisKey = TypeSet::ObjectKey::get(thisGroup);
     if (thisKey->unknownProperties())
         return InliningStatus_NotInlined;
 
     // Don't inline if 'this' is packed and the argument may not be packed
     // (the result array will reuse the 'this' type).
     if (!thisTypes->hasObjectFlags(constraints(), OBJECT_FLAG_NON_PACKED) &&
         argTypes->hasObjectFlags(constraints(), OBJECT_FLAG_NON_PACKED))
     {
         trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
         return InliningStatus_NotInlined;
     }
 
     // Constraints modeling this concat have not been generated by inference,
     // so check that type information already reflects possible side effects of
     // this call.
-    types::HeapTypeSetKey thisElemTypes = thisKey->property(JSID_VOID);
-
-    types::TemporaryTypeSet *resTypes = getInlineReturnTypeSet();
-    if (!resTypes->hasType(types::Type::ObjectType(thisKey)))
+    HeapTypeSetKey thisElemTypes = thisKey->property(JSID_VOID);
+
+    TemporaryTypeSet *resTypes = getInlineReturnTypeSet();
+    if (!resTypes->hasType(TypeSet::ObjectType(thisKey)))
         return InliningStatus_NotInlined;
 
     for (unsigned i = 0; i < argTypes->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = argTypes->getObject(i);
+        TypeSet::ObjectKey *key = argTypes->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties())
             return InliningStatus_NotInlined;
 
-        types::HeapTypeSetKey elemTypes = key->property(JSID_VOID);
+        HeapTypeSetKey elemTypes = key->property(JSID_VOID);
         if (!elemTypes.knownSubset(constraints(), thisElemTypes))
             return InliningStatus_NotInlined;
     }
 
     // Inline the call.
     JSObject *templateObj = inspector->getTemplateObjectForNative(pc, js::array_concat);
     if (!templateObj || templateObj->group() != thisGroup)
         return InliningStatus_NotInlined;
@@ -1231,21 +1231,21 @@ IonBuilder::inlineMathFRound(CallInfo &c
 {
     if (callInfo.argc() != 1 || callInfo.constructing()) {
         trackOptimizationOutcome(TrackedOutcome::CantInlineNativeBadForm);
         return InliningStatus_NotInlined;
     }
 
     // MIRType can't be Float32, as this point, as getInlineReturnType uses JSVal types
     // to infer the returned MIR type.
-    types::TemporaryTypeSet *returned = getInlineReturnTypeSet();
+    TemporaryTypeSet *returned = getInlineReturnTypeSet();
     if (returned->empty()) {
         // As there's only one possible returned type, just add it to the observed
         // returned typeset
-        returned->addType(types::Type::DoubleType(), alloc_->lifoAlloc());
+        returned->addType(TypeSet::DoubleType(), alloc_->lifoAlloc());
     } else {
         MIRType returnType = getInlineReturnType();
         if (!IsNumberType(returnType))
             return InliningStatus_NotInlined;
     }
 
     MIRType arg = callInfo.getArg(0)->type();
     if (!IsNumberType(arg))
@@ -1372,25 +1372,25 @@ IonBuilder::inlineStringSplit(CallInfo &
     if (callInfo.getArg(0)->type() != MIRType_String)
         return InliningStatus_NotInlined;
 
     JSObject *templateObject = inspector->getTemplateObjectForNative(pc, js::str_split);
     if (!templateObject)
         return InliningStatus_NotInlined;
     MOZ_ASSERT(templateObject->is<ArrayObject>());
 
-    types::TypeSetObjectKey *retKey = types::TypeSetObjectKey::get(templateObject);
+    TypeSet::ObjectKey *retKey = TypeSet::ObjectKey::get(templateObject);
     if (retKey->unknownProperties())
         return InliningStatus_NotInlined;
 
-    types::HeapTypeSetKey key = retKey->property(JSID_VOID);
+    HeapTypeSetKey key = retKey->property(JSID_VOID);
     if (!key.maybeTypes())
         return InliningStatus_NotInlined;
 
-    if (!key.maybeTypes()->hasType(types::Type::StringType())) {
+    if (!key.maybeTypes()->hasType(TypeSet::StringType())) {
         key.freeze(constraints());
         return InliningStatus_NotInlined;
     }
 
     callInfo.setImplicitlyUsedUnchecked();
     MConstant *templateObjectDef = MConstant::New(alloc(), ObjectValue(*templateObject), constraints());
     current->add(templateObjectDef);
 
@@ -1542,17 +1542,17 @@ IonBuilder::inlineRegExpExec(CallInfo &c
     if (callInfo.argc() != 1 || callInfo.constructing()) {
         trackOptimizationOutcome(TrackedOutcome::CantInlineNativeBadForm);
         return InliningStatus_NotInlined;
     }
 
     if (callInfo.thisArg()->type() != MIRType_Object)
         return InliningStatus_NotInlined;
 
-    types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+    TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
     const Class *clasp = thisTypes ? thisTypes->getKnownClass(constraints()) : nullptr;
     if (clasp != &RegExpObject::class_)
         return InliningStatus_NotInlined;
 
     if (callInfo.getArg(0)->mightBeType(MIRType_Object))
         return InliningStatus_NotInlined;
 
     JSContext *cx = GetJitContext()->cx;
@@ -1583,17 +1583,17 @@ IonBuilder::inlineRegExpTest(CallInfo &c
     }
 
     // TI can infer a nullptr return type of regexp_test with eager compilation.
     if (CallResultEscapes(pc) && getInlineReturnType() != MIRType_Boolean)
         return InliningStatus_NotInlined;
 
     if (callInfo.thisArg()->type() != MIRType_Object)
         return InliningStatus_NotInlined;
-    types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
+    TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
     const Class *clasp = thisTypes ? thisTypes->getKnownClass(constraints()) : nullptr;
     if (clasp != &RegExpObject::class_)
         return InliningStatus_NotInlined;
     if (callInfo.getArg(0)->mightBeType(MIRType_Object))
         return InliningStatus_NotInlined;
 
     JSContext *cx = GetJitContext()->cx;
     if (!cx->compartment()->jitCompartment()->ensureRegExpTestStubExists(cx))
@@ -1622,17 +1622,17 @@ IonBuilder::inlineStrReplace(CallInfo &c
     if (getInlineReturnType() != MIRType_String)
         return InliningStatus_NotInlined;
 
     // This: String.
     if (callInfo.thisArg()->type() != MIRType_String)
         return InliningStatus_NotInlined;
 
     // Arg 0: RegExp.
-    types::TemporaryTypeSet *arg0Type = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *arg0Type = callInfo.getArg(0)->resultTypeSet();
     const Class *clasp = arg0Type ? arg0Type->getKnownClass(constraints()) : nullptr;
     if (clasp != &RegExpObject::class_ && callInfo.getArg(0)->type() != MIRType_String)
         return InliningStatus_NotInlined;
 
     // Arg 1: String.
     if (callInfo.getArg(1)->type() != MIRType_String)
         return InliningStatus_NotInlined;
 
@@ -1699,17 +1699,17 @@ IonBuilder::inlineObjectCreate(CallInfo 
     MOZ_ASSERT(!templateObject->isSingleton());
 
     // Ensure the argument matches the template object's prototype.
     MDefinition *arg = callInfo.getArg(0);
     if (JSObject *proto = templateObject->getProto()) {
         if (IsInsideNursery(proto))
             return InliningStatus_NotInlined;
 
-        types::TemporaryTypeSet *types = arg->resultTypeSet();
+        TemporaryTypeSet *types = arg->resultTypeSet();
         if (!types || types->maybeSingleton() != proto)
             return InliningStatus_NotInlined;
 
         MOZ_ASSERT(types->getKnownMIRType() == MIRType_Object);
     } else {
         if (arg->type() != MIRType_Null)
             return InliningStatus_NotInlined;
     }
@@ -1846,17 +1846,17 @@ IonBuilder::inlineUnsafeSetDenseArrayEle
     // - idx < initialized length
     // Furthermore, note that inlineUnsafePutElements ensures the type of the
     // value is reflected in the JSID_VOID property of the array.
 
     MDefinition *obj = callInfo.getArg(base + 0);
     MDefinition *id = callInfo.getArg(base + 1);
     MDefinition *elem = callInfo.getArg(base + 2);
 
-    types::TemporaryTypeSet::DoubleConversion conversion =
+    TemporaryTypeSet::DoubleConversion conversion =
         obj->resultTypeSet()->convertDoubleElements(constraints());
     if (!jsop_setelem_dense(conversion, SetElem_Unsafe, obj, id, elem))
         return false;
     return true;
 }
 
 bool
 IonBuilder::inlineUnsafeSetTypedArrayElement(CallInfo &callInfo,
@@ -1908,17 +1908,17 @@ IonBuilder::inlineHasClass(CallInfo &cal
         return InliningStatus_NotInlined;
     }
 
     if (callInfo.getArg(0)->type() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (getInlineReturnType() != MIRType_Boolean)
         return InliningStatus_NotInlined;
 
-    types::TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
     const Class *knownClass = types ? types->getKnownClass(constraints()) : nullptr;
     if (knownClass) {
         pushConstant(BooleanValue(knownClass == clasp1 ||
                                   knownClass == clasp2 ||
                                   knownClass == clasp3 ||
                                   knownClass == clasp4));
     } else {
         MHasClass *hasClass1 = MHasClass::New(alloc(), callInfo.getArg(0), clasp1);
@@ -1961,30 +1961,30 @@ IonBuilder::inlineIsTypedArray(CallInfo 
     if (callInfo.getArg(0)->type() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (getInlineReturnType() != MIRType_Boolean)
         return InliningStatus_NotInlined;
 
     // The test is elaborate: in-line only if there is exact
     // information.
 
-    types::TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
     if (!types)
         return InliningStatus_NotInlined;
 
     bool result = false;
     switch (types->forAllClasses(constraints(), IsTypedArrayClass)) {
-      case types::TemporaryTypeSet::ForAllResult::ALL_FALSE:
-      case types::TemporaryTypeSet::ForAllResult::EMPTY:
+      case TemporaryTypeSet::ForAllResult::ALL_FALSE:
+      case TemporaryTypeSet::ForAllResult::EMPTY:
         result = false;
         break;
-      case types::TemporaryTypeSet::ForAllResult::ALL_TRUE:
+      case TemporaryTypeSet::ForAllResult::ALL_TRUE:
         result = true;
         break;
-      case types::TemporaryTypeSet::ForAllResult::MIXED:
+      case TemporaryTypeSet::ForAllResult::MIXED:
         return InliningStatus_NotInlined;
     }
 
     pushConstant(BooleanValue(result));
 
     callInfo.setImplicitlyUsedUnchecked();
     return InliningStatus_Inlined;
 }
@@ -2021,30 +2021,30 @@ IonBuilder::inlineObjectIsTypeDescr(Call
     if (callInfo.getArg(0)->type() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (getInlineReturnType() != MIRType_Boolean)
         return InliningStatus_NotInlined;
 
     // The test is elaborate: in-line only if there is exact
     // information.
 
-    types::TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
     if (!types)
         return InliningStatus_NotInlined;
 
     bool result = false;
     switch (types->forAllClasses(constraints(), IsTypeDescrClass)) {
-    case types::TemporaryTypeSet::ForAllResult::ALL_FALSE:
-    case types::TemporaryTypeSet::ForAllResult::EMPTY:
+    case TemporaryTypeSet::ForAllResult::ALL_FALSE:
+    case TemporaryTypeSet::ForAllResult::EMPTY:
         result = false;
         break;
-    case types::TemporaryTypeSet::ForAllResult::ALL_TRUE:
+    case TemporaryTypeSet::ForAllResult::ALL_TRUE:
         result = true;
         break;
-    case types::TemporaryTypeSet::ForAllResult::MIXED:
+    case TemporaryTypeSet::ForAllResult::MIXED:
         return InliningStatus_NotInlined;
     }
 
     pushConstant(BooleanValue(result));
 
     callInfo.setImplicitlyUsedUnchecked();
     return InliningStatus_Inlined;
 }
@@ -2065,25 +2065,25 @@ IonBuilder::inlineSetTypedObjectOffset(C
         return InliningStatus_NotInlined;
 
     // Check typedObj is a, well, typed object. Go ahead and use TI
     // data. If this check should fail, that is almost certainly a bug
     // in self-hosted code -- either because it's not being careful
     // with TI or because of something else -- but we'll just let it
     // fall through to the SetTypedObjectOffset intrinsic in such
     // cases.
-    types::TemporaryTypeSet *types = typedObj->resultTypeSet();
+    TemporaryTypeSet *types = typedObj->resultTypeSet();
     if (typedObj->type() != MIRType_Object || !types)
         return InliningStatus_NotInlined;
     switch (types->forAllClasses(constraints(), IsTypedObjectClass)) {
-      case types::TemporaryTypeSet::ForAllResult::ALL_FALSE:
-      case types::TemporaryTypeSet::ForAllResult::EMPTY:
-      case types::TemporaryTypeSet::ForAllResult::MIXED:
+      case TemporaryTypeSet::ForAllResult::ALL_FALSE:
+      case TemporaryTypeSet::ForAllResult::EMPTY:
+      case TemporaryTypeSet::ForAllResult::MIXED:
         return InliningStatus_NotInlined;
-      case types::TemporaryTypeSet::ForAllResult::ALL_TRUE:
+      case TemporaryTypeSet::ForAllResult::ALL_TRUE:
         break;
     }
 
     // Check type of offset argument is an integer.
     if (offset->type() != MIRType_Int32)
         return InliningStatus_NotInlined;
 
     callInfo.setImplicitlyUsedUnchecked();
@@ -2183,17 +2183,17 @@ IonBuilder::inlineIsCallable(CallInfo &c
     // Try inlining with constant true/false: only objects may be callable at
     // all, and if we know the class check if it is callable.
     bool isCallableKnown = false;
     bool isCallableConstant;
     if (callInfo.getArg(0)->type() != MIRType_Object) {
         isCallableKnown = true;
         isCallableConstant = false;
     } else {
-        types::TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
+        TemporaryTypeSet *types = callInfo.getArg(0)->resultTypeSet();
         const Class *clasp = types ? types->getKnownClass(constraints()) : nullptr;
         if (clasp && !clasp->isProxy()) {
             isCallableKnown = true;
             isCallableConstant = clasp->nonProxyCallable();
         }
     }
 
     callInfo.setImplicitlyUsedUnchecked();
@@ -2583,17 +2583,17 @@ IonBuilder::atomicsMeetsPreconditions(Ca
         return false;
 
     // Ensure that the first argument is a valid SharedTypedArray.
     //
     // Then check both that the element type is something we can
     // optimize and that the return type is suitable for that element
     // type.
 
-    types::TemporaryTypeSet *arg0Types = callInfo.getArg(0)->resultTypeSet();
+    TemporaryTypeSet *arg0Types = callInfo.getArg(0)->resultTypeSet();
     if (!arg0Types)
         return false;
 
     *arrayType = arg0Types->getSharedTypedArrayType(constraints());
     switch (*arrayType) {
       case Scalar::Int8:
       case Scalar::Uint8:
       case Scalar::Int16:
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -265,17 +265,17 @@ bool
 MDefinition::mightBeMagicType() const
 {
     if (IsMagicType(type()))
         return true;
 
     if (MIRType_Value != type())
         return false;
 
-    return !resultTypeSet() || resultTypeSet()->hasType(types::Type::MagicArgType());
+    return !resultTypeSet() || resultTypeSet()->hasType(TypeSet::MagicArgType());
 }
 
 MDefinition *
 MInstruction::foldsToStoredValue(TempAllocator &alloc, MDefinition *loaded)
 {
     // If the type are matching then we return the value which is used as
     // argument of the store.
     if (loaded->type() != type()) {
@@ -334,49 +334,49 @@ void
 MInstruction::clearResumePoint()
 {
     resumePoint_->resetInstruction();
     block()->discardPreAllocatedResumePoint(resumePoint_);
     resumePoint_ = nullptr;
 }
 
 static bool
-MaybeEmulatesUndefined(types::CompilerConstraintList *constraints, MDefinition *op)
+MaybeEmulatesUndefined(CompilerConstraintList *constraints, MDefinition *op)
 {
     if (!op->mightBeType(MIRType_Object))
         return false;
 
-    types::TemporaryTypeSet *types = op->resultTypeSet();
+    TemporaryTypeSet *types = op->resultTypeSet();
     if (!types)
         return true;
 
     return types->maybeEmulatesUndefined(constraints);
 }
 
 static bool
-MaybeCallable(types::CompilerConstraintList *constraints, MDefinition *op)
+MaybeCallable(CompilerConstraintList *constraints, MDefinition *op)
 {
     if (!op->mightBeType(MIRType_Object))
         return false;
 
-    types::TemporaryTypeSet *types = op->resultTypeSet();
+    TemporaryTypeSet *types = op->resultTypeSet();
     if (!types)
         return true;
 
     return types->maybeCallable(constraints);
 }
 
 MTest *
 MTest::New(TempAllocator &alloc, MDefinition *ins, MBasicBlock *ifTrue, MBasicBlock *ifFalse)
 {
     return new(alloc) MTest(ins, ifTrue, ifFalse);
 }
 
 void
-MTest::cacheOperandMightEmulateUndefined(types::CompilerConstraintList *constraints)
+MTest::cacheOperandMightEmulateUndefined(CompilerConstraintList *constraints)
 {
     MOZ_ASSERT(operandMightEmulateUndefined());
 
     if (!MaybeEmulatesUndefined(constraints, getOperand(0)))
         markOperandCantEmulateUndefined();
 }
 
 MDefinition *
@@ -616,23 +616,23 @@ MDefinition::optimizeOutAllUses(TempAllo
 
 bool
 MDefinition::emptyResultTypeSet() const
 {
     return resultTypeSet() && resultTypeSet()->empty();
 }
 
 MConstant *
-MConstant::New(TempAllocator &alloc, const Value &v, types::CompilerConstraintList *constraints)
+MConstant::New(TempAllocator &alloc, const Value &v, CompilerConstraintList *constraints)
 {
     return new(alloc) MConstant(v, constraints);
 }
 
 MConstant *
-MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, types::CompilerConstraintList *constraints)
+MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, CompilerConstraintList *constraints)
 {
     MOZ_ASSERT(!IsSimdType(type));
     MConstant *constant = new(alloc) MConstant(v, constraints);
     constant->setResultType(type);
     return constant;
 }
 
 MConstant *
@@ -642,39 +642,39 @@ MConstant::NewAsmJS(TempAllocator &alloc
 }
 
 MConstant *
 MConstant::NewConstraintlessObject(TempAllocator &alloc, JSObject *v)
 {
     return new(alloc) MConstant(v);
 }
 
-types::TemporaryTypeSet *
-jit::MakeSingletonTypeSet(types::CompilerConstraintList *constraints, JSObject *obj)
+TemporaryTypeSet *
+jit::MakeSingletonTypeSet(CompilerConstraintList *constraints, JSObject *obj)
 {
     // Invalidate when this object's ObjectGroup gets unknown properties. This
     // happens for instance when we mutate an object's __proto__, in this case
     // we want to invalidate and mark this TypeSet as containing AnyObject
     // (because mutating __proto__ will change an object's ObjectGroup).
     MOZ_ASSERT(constraints);
-    types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(obj);
+    TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(obj);
     key->hasStableClassAndProto(constraints);
 
     LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
-    return alloc->new_<types::TemporaryTypeSet>(alloc, types::Type::ObjectType(obj));
-}
-
-static types::TemporaryTypeSet *
+    return alloc->new_<TemporaryTypeSet>(alloc, TypeSet::ObjectType(obj));
+}
+
+static TemporaryTypeSet *
 MakeUnknownTypeSet()
 {
     LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
-    return alloc->new_<types::TemporaryTypeSet>(alloc, types::Type::UnknownType());
-}
-
-MConstant::MConstant(const js::Value &vp, types::CompilerConstraintList *constraints)
+    return alloc->new_<TemporaryTypeSet>(alloc, TypeSet::UnknownType());
+}
+
+MConstant::MConstant(const js::Value &vp, CompilerConstraintList *constraints)
   : value_(vp)
 {
     setResultType(MIRTypeFromValue(vp));
     if (vp.isObject()) {
         // Create a singleton type set for the object. This isn't necessary for
         // other types as the result type encodes all needed information.
         MOZ_ASSERT(!IsInsideNursery(&vp.toObject()));
         setResultTypeSet(MakeSingletonTypeSet(constraints, &vp.toObject()));
@@ -801,31 +801,31 @@ MConstant::canProduceFloat32() const
 
     if (type() == MIRType_Int32)
         return IsFloat32Representable(static_cast<double>(value_.toInt32()));
     if (type() == MIRType_Double)
         return IsFloat32Representable(value_.toDouble());
     return true;
 }
 
-MNurseryObject::MNurseryObject(JSObject *obj, uint32_t index, types::CompilerConstraintList *constraints)
+MNurseryObject::MNurseryObject(JSObject *obj, uint32_t index, CompilerConstraintList *constraints)
   : index_(index)
 {
     setResultType(MIRType_Object);
 
     MOZ_ASSERT(IsInsideNursery(obj));
     MOZ_ASSERT(!obj->isSingleton());
     setResultTypeSet(MakeSingletonTypeSet(constraints, obj));
 
     setMovable();
 }
 
 MNurseryObject *
 MNurseryObject::New(TempAllocator &alloc, JSObject *obj, uint32_t index,
-                    types::CompilerConstraintList *constraints)
+                    CompilerConstraintList *constraints)
 {
     return new(alloc) MNurseryObject(obj, index, constraints);
 }
 
 HashNumber
 MNurseryObject::valueHash() const
 {
     return HashNumber(index_);
@@ -1102,17 +1102,17 @@ MMathFunction::foldsTo(TempAllocator &al
     }
 
     if (input->type() == MIRType_Float32)
         return MConstant::NewTypedValue(alloc, DoubleValue(out), MIRType_Float32);
     return MConstant::New(alloc, DoubleValue(out));
 }
 
 MParameter *
-MParameter::New(TempAllocator &alloc, int32_t index, types::TemporaryTypeSet *types)
+MParameter::New(TempAllocator &alloc, int32_t index, TemporaryTypeSet *types)
 {
     return new(alloc) MParameter(index, types);
 }
 
 void
 MParameter::printOpcode(FILE *fp) const
 {
     PrintOpcodeName(fp, op());
@@ -1619,30 +1619,30 @@ MPhi::congruentTo(const MDefinition *ins
     //
     // For now, consider phis in different blocks incongruent.
     if (ins->block() != block())
         return false;
 
     return congruentIfOperandsEqual(ins);
 }
 
-static inline types::TemporaryTypeSet *
+static inline TemporaryTypeSet *
 MakeMIRTypeSet(MIRType type)
 {
     MOZ_ASSERT(type != MIRType_Value);
-    types::Type ntype = type == MIRType_Object
-                        ? types::Type::AnyObjectType()
-                        : types::Type::PrimitiveType(ValueTypeFromMIRType(type));
+    TypeSet::Type ntype = type == MIRType_Object
+                          ? TypeSet::AnyObjectType()
+                          : TypeSet::PrimitiveType(ValueTypeFromMIRType(type));
     LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
-    return alloc->new_<types::TemporaryTypeSet>(alloc, ntype);
+    return alloc->new_<TemporaryTypeSet>(alloc, ntype);
 }
 
 bool
-jit::MergeTypes(MIRType *ptype, types::TemporaryTypeSet **ptypeSet,
-                MIRType newType, types::TemporaryTypeSet *newTypeSet)
+jit::MergeTypes(MIRType *ptype, TemporaryTypeSet **ptypeSet,
+                MIRType newType, TemporaryTypeSet *newTypeSet)
 {
     if (newTypeSet && newTypeSet->empty())
         return true;
     if (newType != *ptype) {
         if (IsNumberType(newType) && IsNumberType(*ptype)) {
             *ptype = MIRType_Double;
         } else if (*ptype != MIRType_Value) {
             if (!*ptypeSet) {
@@ -1659,17 +1659,17 @@ jit::MergeTypes(MIRType *ptype, types::T
         LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
         if (!newTypeSet && newType != MIRType_Value) {
             newTypeSet = MakeMIRTypeSet(newType);
             if (!newTypeSet)
                 return false;
         }
         if (newTypeSet) {
             if (!newTypeSet->isSubset(*ptypeSet))
-                *ptypeSet = types::TypeSet::unionSets(*ptypeSet, newTypeSet, alloc);
+                *ptypeSet = TypeSet::unionSets(*ptypeSet, newTypeSet, alloc);
         } else {
             *ptypeSet = nullptr;
         }
     }
     return true;
 }
 
 bool
@@ -1689,37 +1689,37 @@ MPhi::specializeType()
         start = 0;
     } else {
         setResultType(getOperand(0)->type());
         setResultTypeSet(getOperand(0)->resultTypeSet());
         start = 1;
     }
 
     MIRType resultType = this->type();
-    types::TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
+    TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
 
     for (size_t i = start; i < inputs_.length(); i++) {
         MDefinition *def = getOperand(i);
         if (!MergeTypes(&resultType, &resultTypeSet, def->type(), def->resultTypeSet()))
             return false;
     }
 
     setResultType(resultType);
     setResultTypeSet(resultTypeSet);
     return true;
 }
 
 bool
-MPhi::addBackedgeType(MIRType type, types::TemporaryTypeSet *typeSet)
+MPhi::addBackedgeType(MIRType type, TemporaryTypeSet *typeSet)
 {
     MOZ_ASSERT(!specialized_);
 
     if (hasBackedgeType_) {
         MIRType resultType = this->type();
-        types::TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
+        TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
 
         if (!MergeTypes(&resultType, &resultTypeSet, type, typeSet))
             return false;
 
         setResultType(resultType);
         setResultTypeSet(resultTypeSet);
     } else {
         setResultType(type);
@@ -1730,17 +1730,17 @@ MPhi::addBackedgeType(MIRType type, type
 }
 
 bool
 MPhi::typeIncludes(MDefinition *def)
 {
     if (def->type() == MIRType_Int32 && this->type() == MIRType_Double)
         return true;
 
-    if (types::TemporaryTypeSet *types = def->resultTypeSet()) {
+    if (TemporaryTypeSet *types = def->resultTypeSet()) {
         if (this->resultTypeSet())
             return types->isSubset(this->resultTypeSet());
         if (this->type() == MIRType_Value || types->empty())
             return true;
         return this->type() == types->getKnownMIRType();
     }
 
     if (def->type() == MIRType_Value) {
@@ -1751,17 +1751,17 @@ MPhi::typeIncludes(MDefinition *def)
 
     return this->mightBeType(def->type());
 }
 
 bool
 MPhi::checkForTypeChange(MDefinition *ins, bool *ptypeChange)
 {
     MIRType resultType = this->type();
-    types::TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
+    TemporaryTypeSet *resultTypeSet = this->resultTypeSet();
 
     if (!MergeTypes(&resultType, &resultTypeSet, ins->type(), ins->resultTypeSet()))
         return false;
 
     if (resultType != this->type() || resultTypeSet != this->resultTypeSet()) {
         *ptypeChange = true;
         setResultType(resultType);
         setResultTypeSet(resultTypeSet);
@@ -2463,17 +2463,17 @@ MBinaryArithInstruction::inferFallback(B
         return;
     }
 
     // If we can't specialize because we have no type information at all for
     // the lhs or rhs, mark the binary instruction as having no possible types
     // either to avoid degrading subsequent analysis.
     if (getOperand(0)->emptyResultTypeSet() || getOperand(1)->emptyResultTypeSet()) {
         LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
-        types::TemporaryTypeSet *types = alloc->new_<types::TemporaryTypeSet>();
+        TemporaryTypeSet *types = alloc->new_<TemporaryTypeSet>();
         if (types)
             setResultTypeSet(types);
     }
 }
 
 static bool
 SafelyCoercesToDouble(MDefinition *op)
 {
@@ -2491,17 +2491,17 @@ ObjectOrSimplePrimitive(MDefinition *op)
         && !op->mightBeType(MIRType_Double)
         && !op->mightBeType(MIRType_Float32)
         && !op->mightBeType(MIRType_MagicOptimizedArguments)
         && !op->mightBeType(MIRType_MagicHole)
         && !op->mightBeType(MIRType_MagicIsConstructing);
 }
 
 static bool
-CanDoValueBitwiseCmp(types::CompilerConstraintList *constraints,
+CanDoValueBitwiseCmp(CompilerConstraintList *constraints,
                      MDefinition *lhs, MDefinition *rhs, bool looseEq)
 {
     // Only primitive (not double/string) or objects are supported.
     // I.e. Undefined/Null/Boolean/Int32 and Object
     if (!ObjectOrSimplePrimitive(lhs) || !ObjectOrSimplePrimitive(rhs))
         return false;
 
     // Objects that emulate undefined are not supported.
@@ -2614,17 +2614,17 @@ MBinaryInstruction::tryUseUnsignedOperan
             replaceOperand(1, newrhs);
         }
         return true;
     }
     return false;
 }
 
 void
-MCompare::infer(types::CompilerConstraintList *constraints, BaselineInspector *inspector, jsbytecode *pc)
+MCompare::infer(CompilerConstraintList *constraints, BaselineInspector *inspector, jsbytecode *pc)
 {
     MOZ_ASSERT(operandMightEmulateUndefined());
 
     if (!MaybeEmulatesUndefined(constraints, getOperand(0)) &&
         !MaybeEmulatesUndefined(constraints, getOperand(1)))
     {
         markNoOperandEmulatesUndefined();
     }
@@ -2822,17 +2822,17 @@ MTypeOf::foldsTo(TempAllocator &alloc)
       default:
         return this;
     }
 
     return MConstant::New(alloc, StringValue(TypeName(type, GetJitContext()->runtime->names())));
 }
 
 void
-MTypeOf::cacheInputMaybeCallableOrEmulatesUndefined(types::CompilerConstraintList *constraints)
+MTypeOf::cacheInputMaybeCallableOrEmulatesUndefined(CompilerConstraintList *constraints)
 {
     MOZ_ASSERT(inputMaybeCallableOrEmulatesUndefined());
 
     if (!MaybeEmulatesUndefined(constraints, input()) && !MaybeCallable(constraints, input()))
         markInputNotCallableOrEmulatesUndefined();
 }
 
 MBitAnd *
@@ -3563,17 +3563,17 @@ MCompare::filtersUndefinedOrNull(bool tr
     } else {
         *filtersUndefined = *filtersNull = true;
     }
 
     *subject = lhs();
 }
 
 void
-MNot::cacheOperandMightEmulateUndefined(types::CompilerConstraintList *constraints)
+MNot::cacheOperandMightEmulateUndefined(CompilerConstraintList *constraints)
 {
     MOZ_ASSERT(operandMightEmulateUndefined());
 
     if (!MaybeEmulatesUndefined(constraints, getOperand(0)))
         markOperandCantEmulateUndefined();
 }
 
 MDefinition *
@@ -4025,26 +4025,26 @@ InlinePropertyTable::hasFunction(JSFunct
 {
     for (size_t i = 0; i < numEntries(); i++) {
         if (entries_[i]->func == func)
             return true;
     }
     return false;
 }
 
-types::TemporaryTypeSet *
+TemporaryTypeSet *
 InlinePropertyTable::buildTypeSetForFunction(JSFunction *func) const
 {
     LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
-    types::TemporaryTypeSet *types = alloc->new_<types::TemporaryTypeSet>();
+    TemporaryTypeSet *types = alloc->new_<TemporaryTypeSet>();
     if (!types)
         return nullptr;
     for (size_t i = 0; i < numEntries(); i++) {
         if (entries_[i]->func == func)
-            types->addType(types::Type::ObjectType(entries_[i]->group), alloc);
+            types->addType(TypeSet::ObjectType(entries_[i]->group), alloc);
     }
     return types;
 }
 
 void *
 MLoadTypedArrayElementStatic::base() const
 {
     return AnyTypedArrayViewData(someTypedArray_);
@@ -4080,17 +4080,17 @@ MStoreTypedArrayElementStatic::base() co
 }
 
 bool
 MGetElementCache::allowDoubleResult() const
 {
     if (!resultTypeSet())
         return true;
 
-    return resultTypeSet()->hasType(types::Type::DoubleType());
+    return resultTypeSet()->hasType(TypeSet::DoubleType());
 }
 
 size_t
 MStoreTypedArrayElementStatic::length() const
 {
     return AnyTypedArrayByteLength(someTypedArray_);
 }
 
@@ -4272,133 +4272,133 @@ MArrayJoin::foldsTo(TempAllocator &alloc
     MDefinition *pattern = arr->toStringSplit()->separator();
     MDefinition *replacement = sep();
 
     setNotRecoveredOnBailout();
     return MStringReplace::New(alloc, string, pattern, replacement);
 }
 
 bool
-jit::ElementAccessIsDenseNative(types::CompilerConstraintList *constraints,
+jit::ElementAccessIsDenseNative(CompilerConstraintList *constraints,
                                 MDefinition *obj, MDefinition *id)
 {
     if (obj->mightBeType(MIRType_String))
         return false;
 
     if (id->type() != MIRType_Int32 && id->type() != MIRType_Double)
         return false;
 
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
     if (!types)
         return false;
 
     // Typed arrays are native classes but do not have dense elements.
     const Class *clasp = types->getKnownClass(constraints);
     return clasp && clasp->isNative() && !IsAnyTypedArrayClass(clasp);
 }
 
 bool
-jit::ElementAccessIsAnyTypedArray(types::CompilerConstraintList *constraints,
+jit::ElementAccessIsAnyTypedArray(CompilerConstraintList *constraints,
                                   MDefinition *obj, MDefinition *id,
                                   Scalar::Type *arrayType)
 {
     if (obj->mightBeType(MIRType_String))
         return false;
 
     if (id->type() != MIRType_Int32 && id->type() != MIRType_Double)
         return false;
 
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
     if (!types)
         return false;
 
     *arrayType = types->getTypedArrayType(constraints);
     if (*arrayType != Scalar::MaxTypedArrayViewType)
         return true;
     *arrayType = types->getSharedTypedArrayType(constraints);
     return *arrayType != Scalar::MaxTypedArrayViewType;
 }
 
 bool
-jit::ElementAccessIsPacked(types::CompilerConstraintList *constraints, MDefinition *obj)
-{
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+jit::ElementAccessIsPacked(CompilerConstraintList *constraints, MDefinition *obj)
+{
+    TemporaryTypeSet *types = obj->resultTypeSet();
     return types && !types->hasObjectFlags(constraints, OBJECT_FLAG_NON_PACKED);
 }
 
 bool
-jit::ElementAccessMightBeCopyOnWrite(types::CompilerConstraintList *constraints, MDefinition *obj)
-{
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+jit::ElementAccessMightBeCopyOnWrite(CompilerConstraintList *constraints, MDefinition *obj)
+{
+    TemporaryTypeSet *types = obj->resultTypeSet();
     return !types || types->hasObjectFlags(constraints, OBJECT_FLAG_COPY_ON_WRITE);
 }
 
 bool
-jit::ElementAccessHasExtraIndexedProperty(types::CompilerConstraintList *constraints,
+jit::ElementAccessHasExtraIndexedProperty(CompilerConstraintList *constraints,
                                           MDefinition *obj)
 {
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
 
     if (!types || types->hasObjectFlags(constraints, OBJECT_FLAG_LENGTH_OVERFLOW))
         return true;
 
-    return types::TypeCanHaveExtraIndexedProperties(constraints, types);
+    return TypeCanHaveExtraIndexedProperties(constraints, types);
 }
 
 MIRType
-jit::DenseNativeElementType(types::CompilerConstraintList *constraints, MDefinition *obj)
-{
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+jit::DenseNativeElementType(CompilerConstraintList *constraints, MDefinition *obj)
+{
+    TemporaryTypeSet *types = obj->resultTypeSet();
     MIRType elementType = MIRType_None;
     unsigned count = types->getObjectCount();
 
     for (unsigned i = 0; i < count; i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties())
             return MIRType_None;
 
-        types::HeapTypeSetKey elementTypes = key->property(JSID_VOID);
+        HeapTypeSetKey elementTypes = key->property(JSID_VOID);
 
         MIRType type = elementTypes.knownMIRType(constraints);
         if (type == MIRType_None)
             return MIRType_None;
 
         if (elementType == MIRType_None)
             elementType = type;
         else if (elementType != type)
             return MIRType_None;
     }
 
     return elementType;
 }
 
 static BarrierKind
-PropertyReadNeedsTypeBarrier(types::CompilerConstraintList *constraints,
-                             types::TypeSetObjectKey *key, PropertyName *name,
-                             types::TypeSet *observed)
+PropertyReadNeedsTypeBarrier(CompilerConstraintList *constraints,
+                             TypeSet::ObjectKey *key, PropertyName *name,
+                             TypeSet *observed)
 {
     // If the object being read from has types for the property which haven't
     // been observed at this access site, the read could produce a new type and
     // a barrier is needed. Note that this only covers reads from properties
     // which are accounted for by type information, i.e. native data properties
     // and elements.
     //
     // We also need a barrier if the object is a proxy, because then all bets
     // are off, just as if it has unknown properties.
     if (key->unknownProperties() || observed->empty() ||
         key->clasp()->isProxy())
     {
         return BarrierKind::TypeSet;
     }
 
     jsid id = name ? NameToId(name) : JSID_VOID;
-    types::HeapTypeSetKey property = key->property(id);
+    HeapTypeSetKey property = key->property(id);
     if (property.maybeTypes()) {
         if (!TypeSetIncludes(observed, MIRType_Value, property.maybeTypes())) {
             // If all possible objects have been observed, we don't have to
             // guard on the specific object types.
             if (property.maybeTypes()->objectsAreSubset(observed)) {
                 property.freeze(constraints);
                 return BarrierKind::TypeTagOnly;
             }
@@ -4407,54 +4407,54 @@ PropertyReadNeedsTypeBarrier(types::Comp
     }
 
     // Type information for global objects is not required to reflect the
     // initial 'undefined' value for properties, in particular global
     // variables declared with 'var'. Until the property is assigned a value
     // other than undefined, a barrier is required.
     if (key->isSingleton()) {
         JSObject *obj = key->singleton();
-        if (name && types::CanHaveEmptyPropertyTypesForOwnProperty(obj) &&
+        if (name && CanHaveEmptyPropertyTypesForOwnProperty(obj) &&
             (!property.maybeTypes() || property.maybeTypes()->empty()))
         {
             return BarrierKind::TypeSet;
         }
     }
 
     property.freeze(constraints);
     return BarrierKind::NoBarrier;
 }
 
 BarrierKind
 jit::PropertyReadNeedsTypeBarrier(JSContext *propertycx,
-                                  types::CompilerConstraintList *constraints,
-                                  types::TypeSetObjectKey *key, PropertyName *name,
-                                  types::TemporaryTypeSet *observed, bool updateObserved)
+                                  CompilerConstraintList *constraints,
+                                  TypeSet::ObjectKey *key, PropertyName *name,
+                                  TemporaryTypeSet *observed, bool updateObserved)
 {
     // If this access has never executed, try to add types to the observed set
     // according to any property which exists on the object or its prototype.
     if (updateObserved && observed->empty() && name) {
         JSObject *obj;
         if (key->isSingleton())
             obj = key->singleton();
         else
             obj = key->proto().toObjectOrNull();
 
         while (obj) {
             if (!obj->getClass()->isNative())
                 break;
 
-            types::TypeSetObjectKey *key = types::TypeSetObjectKey::get(obj);
+            TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(obj);
             if (propertycx)
                 key->ensureTrackedProperty(propertycx, NameToId(name));
 
             if (!key->unknownProperties()) {
-                types::HeapTypeSetKey property = key->property(NameToId(name));
+                HeapTypeSetKey property = key->property(NameToId(name));
                 if (property.maybeTypes()) {
-                    types::TypeSet::TypeList types;
+                    TypeSet::TypeList types;
                     if (!property.maybeTypes()->enumerateTypes(&types))
                         break;
                     if (types.length()) {
                         // Note: the return value here is ignored.
                         observed->addType(types[0], GetJitContext()->temp->lifoAlloc());
                         break;
                     }
                 }
@@ -4464,33 +4464,32 @@ jit::PropertyReadNeedsTypeBarrier(JSCont
         }
     }
 
     return PropertyReadNeedsTypeBarrier(constraints, key, name, observed);
 }
 
 BarrierKind
 jit::PropertyReadNeedsTypeBarrier(JSContext *propertycx,
-                                  types::CompilerConstraintList *constraints,
+                                  CompilerConstraintList *constraints,
                                   MDefinition *obj, PropertyName *name,
-                                  types::TemporaryTypeSet *observed)
+                                  TemporaryTypeSet *observed)
 {
     if (observed->unknown())
         return BarrierKind::NoBarrier;
 
-    types::TypeSet *types = obj->resultTypeSet();
+    TypeSet *types = obj->resultTypeSet();
     if (!types || types->unknownObject())
         return BarrierKind::TypeSet;
 
     BarrierKind res = BarrierKind::NoBarrier;
 
     bool updateObserved = types->getObjectCount() == 1;
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
-        if (key) {
+        if (TypeSet::ObjectKey *key = types->getObject(i)) {
             BarrierKind kind = PropertyReadNeedsTypeBarrier(propertycx, constraints, key, name,
                                                             observed, updateObserved);
             if (kind == BarrierKind::TypeSet)
                 return BarrierKind::TypeSet;
 
             if (kind == BarrierKind::TypeTagOnly) {
                 MOZ_ASSERT(res == BarrierKind::NoBarrier || res == BarrierKind::TypeTagOnly);
                 res = BarrierKind::TypeTagOnly;
@@ -4499,39 +4498,39 @@ jit::PropertyReadNeedsTypeBarrier(JSCont
             }
         }
     }
 
     return res;
 }
 
 BarrierKind
-jit::PropertyReadOnPrototypeNeedsTypeBarrier(types::CompilerConstraintList *constraints,
+jit::PropertyReadOnPrototypeNeedsTypeBarrier(CompilerConstraintList *constraints,
                                              MDefinition *obj, PropertyName *name,
-                                             types::TemporaryTypeSet *observed)
+                                             TemporaryTypeSet *observed)
 {
     if (observed->unknown())
         return BarrierKind::NoBarrier;
 
-    types::TypeSet *types = obj->resultTypeSet();
+    TypeSet *types = obj->resultTypeSet();
     if (!types || types->unknownObject())
         return BarrierKind::TypeSet;
 
     BarrierKind res = BarrierKind::NoBarrier;
 
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
         while (true) {
             if (!key->hasStableClassAndProto(constraints))
                 return BarrierKind::TypeSet;
             if (!key->proto().isObject())
                 break;
-            key = types::TypeSetObjectKey::get(key->proto().toObject());
+            key = TypeSet::ObjectKey::get(key->proto().toObject());
             BarrierKind kind = PropertyReadNeedsTypeBarrier(constraints, key, name, observed);
             if (kind == BarrierKind::TypeSet)
                 return BarrierKind::TypeSet;
 
             if (kind == BarrierKind::TypeTagOnly) {
                 MOZ_ASSERT(res == BarrierKind::NoBarrier || res == BarrierKind::TypeTagOnly);
                 res = BarrierKind::TypeTagOnly;
             } else {
@@ -4539,129 +4538,127 @@ jit::PropertyReadOnPrototypeNeedsTypeBar
             }
         }
     }
 
     return res;
 }
 
 bool
-jit::PropertyReadIsIdempotent(types::CompilerConstraintList *constraints,
+jit::PropertyReadIsIdempotent(CompilerConstraintList *constraints,
                               MDefinition *obj, PropertyName *name)
 {
     // Determine if reading a property from obj is likely to be idempotent.
 
-    types::TypeSet *types = obj->resultTypeSet();
+    TypeSet *types = obj->resultTypeSet();
     if (!types || types->unknownObject())
         return false;
 
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
-        if (key) {
+        if (TypeSet::ObjectKey *key = types->getObject(i)) {
             if (key->unknownProperties())
                 return false;
 
             // Check if the property has been reconfigured or is a getter.
-            types::HeapTypeSetKey property = key->property(NameToId(name));
+            HeapTypeSetKey property = key->property(NameToId(name));
             if (property.nonData(constraints))
                 return false;
         }
     }
 
     return true;
 }
 
 void
 jit::AddObjectsForPropertyRead(MDefinition *obj, PropertyName *name,
-                               types::TemporaryTypeSet *observed)
+                               TemporaryTypeSet *observed)
 {
     // Add objects to observed which *could* be observed by reading name from obj,
     // to hopefully avoid unnecessary type barriers and code invalidations.
 
     LifoAlloc *alloc = GetJitContext()->temp->lifoAlloc();
 
-    types::TemporaryTypeSet *types = obj->resultTypeSet();
+    TemporaryTypeSet *types = obj->resultTypeSet();
     if (!types || types->unknownObject()) {
-        observed->addType(types::Type::AnyObjectType(), alloc);
+        observed->addType(TypeSet::AnyObjectType(), alloc);
         return;
     }
 
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties()) {
-            observed->addType(types::Type::AnyObjectType(), alloc);
+            observed->addType(TypeSet::AnyObjectType(), alloc);
             return;
         }
 
         jsid id = name ? NameToId(name) : JSID_VOID;
-        types::HeapTypeSetKey property = key->property(id);
-        types::HeapTypeSet *types = property.maybeTypes();
+        HeapTypeSetKey property = key->property(id);
+        HeapTypeSet *types = property.maybeTypes();
         if (!types)
             continue;
 
         if (types->unknownObject()) {
-            observed->addType(types::Type::AnyObjectType(), alloc);
+            observed->addType(TypeSet::AnyObjectType(), alloc);
             return;
         }
 
         for (size_t i = 0; i < types->getObjectCount(); i++) {
-            types::TypeSetObjectKey *key = types->getObject(i);
-            if (key)
-                observed->addType(types::Type::ObjectType(key), alloc);
+            if (TypeSet::ObjectKey *key = types->getObject(i))
+                observed->addType(TypeSet::ObjectType(key), alloc);
         }
     }
 }
 
 static bool
-PropertyTypeIncludes(TempAllocator &alloc, types::HeapTypeSetKey property,
+PropertyTypeIncludes(TempAllocator &alloc, HeapTypeSetKey property,
                      MDefinition *value, MIRType implicitType)
 {
     // If implicitType is not MIRType_None, it is an additional type which the
     // property implicitly includes. In this case, make a new type set which
     // explicitly contains the type.
-    types::TypeSet *types = property.maybeTypes();
+    TypeSet *types = property.maybeTypes();
     if (implicitType != MIRType_None) {
-        types::Type newType = types::Type::PrimitiveType(ValueTypeFromMIRType(implicitType));
+        TypeSet::Type newType = TypeSet::PrimitiveType(ValueTypeFromMIRType(implicitType));
         if (types)
             types = types->clone(alloc.lifoAlloc());
         else
-            types = alloc.lifoAlloc()->new_<types::TemporaryTypeSet>();
+            types = alloc.lifoAlloc()->new_<TemporaryTypeSet>();
         types->addType(newType, alloc.lifoAlloc());
     }
 
     return TypeSetIncludes(types, value->type(), value->resultTypeSet());
 }
 
 static bool
-TryAddTypeBarrierForWrite(TempAllocator &alloc, types::CompilerConstraintList *constraints,
-                          MBasicBlock *current, types::TemporaryTypeSet *objTypes,
+TryAddTypeBarrierForWrite(TempAllocator &alloc, CompilerConstraintList *constraints,
+                          MBasicBlock *current, TemporaryTypeSet *objTypes,
                           PropertyName *name, MDefinition **pvalue, MIRType implicitType)
 {
     // Return whether pvalue was modified to include a type barrier ensuring
     // that writing the value to objTypes/id will not require changing type
     // information.
 
     // All objects in the set must have the same types for name. Otherwise, we
     // could bail out without subsequently triggering a type change that
     // invalidates the compiled code.
-    Maybe<types::HeapTypeSetKey> aggregateProperty;
+    Maybe<HeapTypeSetKey> aggregateProperty;
 
     for (size_t i = 0; i < objTypes->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = objTypes->getObject(i);
+        TypeSet::ObjectKey *key = objTypes->getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties())
             return false;
 
         jsid id = name ? NameToId(name) : JSID_VOID;
-        types::HeapTypeSetKey property = key->property(id);
+        HeapTypeSetKey property = key->property(id);
         if (!property.maybeTypes() || property.couldBeConstant(constraints))
             return false;
 
         if (PropertyTypeIncludes(alloc, property, *pvalue, implicitType))
             return false;
 
         // This freeze is not required for correctness, but ensures that we
         // will recompile if the property types change and the barrier can
@@ -4699,34 +4696,34 @@ TryAddTypeBarrierForWrite(TempAllocator 
         return true;
       }
       default:;
     }
 
     if ((*pvalue)->type() != MIRType_Value)
         return false;
 
-    types::TemporaryTypeSet *types = aggregateProperty->maybeTypes()->clone(alloc.lifoAlloc());
+    TemporaryTypeSet *types = aggregateProperty->maybeTypes()->clone(alloc.lifoAlloc());
     if (!types)
         return false;
 
     // If all possible objects can be stored without a barrier, we don't have to
     // guard on the specific object types.
     BarrierKind kind = BarrierKind::TypeSet;
     if ((*pvalue)->resultTypeSet() && (*pvalue)->resultTypeSet()->objectsAreSubset(types))
         kind = BarrierKind::TypeTagOnly;
 
     MInstruction *ins = MMonitorTypes::New(alloc, *pvalue, types, kind);
     current->add(ins);
     return true;
 }
 
 static MInstruction *
 AddGroupGuard(TempAllocator &alloc, MBasicBlock *current, MDefinition *obj,
-              types::TypeSetObjectKey *key, bool bailOnEquality)
+              TypeSet::ObjectKey *key, bool bailOnEquality)
 {
     MInstruction *guard;
 
     if (key->isGroup()) {
         guard = MGuardObjectGroup::New(alloc, obj, key->group(), bailOnEquality,
                                        Bailout_ObjectIdentityOrTypeGuard);
     } else {
         guard = MGuardObjectIdentity::New(alloc, obj, key->singleton(), bailOnEquality);
@@ -4737,59 +4734,59 @@ AddGroupGuard(TempAllocator &alloc, MBas
     // For now, never move object group / identity guards.
     guard->setNotMovable();
 
     return guard;
 }
 
 // Whether value can be written to property without changing type information.
 bool
-jit::CanWriteProperty(TempAllocator &alloc, types::CompilerConstraintList *constraints,
-                      types::HeapTypeSetKey property, MDefinition *value,
+jit::CanWriteProperty(TempAllocator &alloc, CompilerConstraintList *constraints,
+                      HeapTypeSetKey property, MDefinition *value,
                       MIRType implicitType /* = MIRType_None */)
 {
     if (property.couldBeConstant(constraints))
         return false;
     return PropertyTypeIncludes(alloc, property, value, implicitType);
 }
 
 bool
-jit::PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+jit::PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, CompilerConstraintList *constraints,
                                    MBasicBlock *current, MDefinition **pobj,
                                    PropertyName *name, MDefinition **pvalue,
                                    bool canModify, MIRType implicitType)
 {
     // If any value being written is not reflected in the type information for
     // objects which obj could represent, a type barrier is needed when writing
     // the value. As for propertyReadNeedsTypeBarrier, this only applies for
     // properties that are accounted for by type information, i.e. normal data
     // properties and elements.
 
-    types::TemporaryTypeSet *types = (*pobj)->resultTypeSet();
+    TemporaryTypeSet *types = (*pobj)->resultTypeSet();
     if (!types || types->unknownObject())
         return true;
 
     // If all of the objects being written to have property types which already
     // reflect the value, no barrier at all is needed. Additionally, if all
     // objects being written to have the same types for the property, and those
     // types do *not* reflect the value, add a type barrier for the value.
 
     bool success = true;
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key || key->unknownProperties())
             continue;
 
         // TI doesn't track TypedArray indexes and should never insert a type
         // barrier for them.
         if (!name && IsAnyTypedArrayClass(key->clasp()))
             continue;
 
         jsid id = name ? NameToId(name) : JSID_VOID;
-        types::HeapTypeSetKey property = key->property(id);
+        HeapTypeSetKey property = key->property(id);
         if (!CanWriteProperty(alloc, constraints, property, *pvalue, implicitType)) {
             // Either pobj or pvalue needs to be modified to filter out the
             // types which the value could have but are not in the property,
             // or a VM call is required. A VM call is always required if pobj
             // and pvalue cannot be modified.
             if (!canModify)
                 return true;
             success = TryAddTypeBarrierForWrite(alloc, constraints, current, types, name, pvalue,
@@ -4803,26 +4800,26 @@ jit::PropertyWriteNeedsTypeBarrier(TempA
 
     // If all of the objects except one have property types which reflect the
     // value, and the remaining object has no types at all for the property,
     // add a guard that the object does not have that remaining object's type.
 
     if (types->getObjectCount() <= 1)
         return true;
 
-    types::TypeSetObjectKey *excluded = nullptr;
+    TypeSet::ObjectKey *excluded = nullptr;
     for (size_t i = 0; i < types->getObjectCount(); i++) {
-        types::TypeSetObjectKey *key = types->getObject(i);
+        TypeSet::ObjectKey *key = types->getObject(i);
         if (!key || key->unknownProperties())
             continue;
         if (!name && IsAnyTypedArrayClass(key->clasp()))
             continue;
 
         jsid id = name ? NameToId(name) : JSID_VOID;
-        types::HeapTypeSetKey property = key->property(id);
+        HeapTypeSetKey property = key->property(id);
         if (CanWriteProperty(alloc, constraints, property, *pvalue, implicitType))
             continue;
 
         if ((property.maybeTypes() && !property.maybeTypes()->empty()) || excluded)
             return true;
         excluded = key;
     }
 
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -358,17 +358,17 @@ class MDefinition : public MNode
 
   private:
     InlineList<MUse> uses_;        // Use chain.
     uint32_t id_;                  // Instruction ID, which after block re-ordering
                                    // is sorted within a basic block.
     uint32_t flags_;               // Bit flags.
     Range *range_;                 // Any computed range for this def.
     MIRType resultType_;           // Representation of result type.
-    types::TemporaryTypeSet *resultTypeSet_; // Optional refinement of the result type.
+    TemporaryTypeSet *resultTypeSet_; // Optional refinement of the result type.
     union {
         MInstruction *dependency_; // Implicit dependency (store, call, etc.) of this instruction.
                                    // Used by alias analysis, GVN and LICM.
         uint32_t virtualRegister_; // Used by lowering to map definitions to virtual registers.
     };
 
     // Track bailouts by storing the current pc in MIR instruction. Also used
     // for profiling and keeping track of what the last known pc was.
@@ -603,17 +603,17 @@ class MDefinition : public MNode
     //
     // Unless this is an MUrsh that has bailouts disabled, which, as a special
     // case, may return a value in (INT32_MAX,UINT32_MAX] even when its type()
     // is MIRType_Int32.
     MIRType type() const {
         return resultType_;
     }
 
-    types::TemporaryTypeSet *resultTypeSet() const {
+    TemporaryTypeSet *resultTypeSet() const {
         return resultTypeSet_;
     }
     bool emptyResultTypeSet() const;
 
     bool mightBeType(MIRType type) const {
         MOZ_ASSERT(type != MIRType_Value);
 
         if (type == this->type())
@@ -776,17 +776,17 @@ class MDefinition : public MNode
     virtual bool isControlInstruction() const {
         return false;
     }
     inline MControlInstruction *toControlInstruction();
 
     void setResultType(MIRType type) {
         resultType_ = type;
     }
-    void setResultTypeSet(types::TemporaryTypeSet *types) {
+    void setResultTypeSet(TemporaryTypeSet *types) {
         resultTypeSet_ = types;
     }
 
     MInstruction *dependency() const {
         return dependency_;
     }
     void setDependency(MInstruction *dependency) {
         dependency_ = dependency;
@@ -1272,25 +1272,25 @@ class MLimitedTruncate
 };
 
 // A constant js::Value.
 class MConstant : public MNullaryInstruction
 {
     Value value_;
 
   protected:
-    MConstant(const Value &v, types::CompilerConstraintList *constraints);
+    MConstant(const Value &v, CompilerConstraintList *constraints);
     explicit MConstant(JSObject *obj);
 
   public:
     INSTRUCTION_HEADER(Constant)
     static MConstant *New(TempAllocator &alloc, const Value &v,
-                          types::CompilerConstraintList *constraints = nullptr);
+                          CompilerConstraintList *constraints = nullptr);
     static MConstant *NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type,
-                                    types::CompilerConstraintList *constraints = nullptr);
+                                    CompilerConstraintList *constraints = nullptr);
     static MConstant *NewAsmJS(TempAllocator &alloc, const Value &v, MIRType type);
     static MConstant *NewConstraintlessObject(TempAllocator &alloc, JSObject *v);
 
     const js::Value &value() const {
         return value_;
     }
     const js::Value *vp() const {
         return &value_;
@@ -1330,22 +1330,22 @@ class MConstant : public MNullaryInstruc
 };
 
 class MNurseryObject : public MNullaryInstruction
 {
     // Index in MIRGenerator::nurseryObjects_.
     uint32_t index_;
 
   protected:
-    MNurseryObject(JSObject *obj, uint32_t index, types::CompilerConstraintList *constraints);
+    MNurseryObject(JSObject *obj, uint32_t index, CompilerConstraintList *constraints);
 
   public:
     INSTRUCTION_HEADER(NurseryObject)
     static MNurseryObject *New(TempAllocator &alloc, JSObject *obj, uint32_t index,
-                               types::CompilerConstraintList *constraints = nullptr);
+                               CompilerConstraintList *constraints = nullptr);
 
     HashNumber valueHash() const MOZ_OVERRIDE;
     bool congruentTo(const MDefinition *ins) const MOZ_OVERRIDE;
 
     uint32_t index() const {
         return index_;
     }
 
@@ -2192,26 +2192,26 @@ class MCloneLiteral
 
 class MParameter : public MNullaryInstruction
 {
     int32_t index_;
 
   public:
     static const int32_t THIS_SLOT = -1;
 
-    MParameter(int32_t index, types::TemporaryTypeSet *types)
+    MParameter(int32_t index, TemporaryTypeSet *types)
       : index_(index)
     {
         setResultType(MIRType_Value);
         setResultTypeSet(types);
     }
 
   public:
     INSTRUCTION_HEADER(Parameter)
-    static MParameter *New(TempAllocator &alloc, int32_t index, types::TemporaryTypeSet *types);
+    static MParameter *New(TempAllocator &alloc, int32_t index, TemporaryTypeSet *types);
 
     int32_t index() const {
         return index_;
     }
     void printOpcode(FILE *fp) const MOZ_OVERRIDE;
 
     HashNumber valueHash() const MOZ_OVERRIDE;
     bool congruentTo(const MDefinition *ins) const MOZ_OVERRIDE;
@@ -2535,17 +2535,17 @@ class MTest
         return AliasSet::None();
     }
 
     // We cache whether our operand might emulate undefined, but we don't want
     // to do that from New() or the constructor, since those can be called on
     // background threads.  So make callers explicitly call it if they want us
     // to check whether the operand might do this.  If this method is never
     // called, we'll assume our operand can emulate undefined.
-    void cacheOperandMightEmulateUndefined(types::CompilerConstraintList *constraints);
+    void cacheOperandMightEmulateUndefined(CompilerConstraintList *constraints);
     MDefinition *foldsTo(TempAllocator &alloc) MOZ_OVERRIDE;
     void filtersUndefinedOrNull(bool trueBranch, MDefinition **subject, bool *filtersUndefined,
                                 bool *filtersNull);
 
     void markOperandCantEmulateUndefined() {
         operandMightEmulateUndefined_ = false;
     }
     bool operandMightEmulateUndefined() const {
@@ -2627,22 +2627,22 @@ class MThrow
         return AliasSet::None();
     }
     bool possiblyCalls() const MOZ_OVERRIDE {
         return true;
     }
 };
 
 // Fabricate a type set containing only the type of the specified object.
-types::TemporaryTypeSet *
-MakeSingletonTypeSet(types::CompilerConstraintList *constraints, JSObject *obj);
+TemporaryTypeSet *
+MakeSingletonTypeSet(CompilerConstraintList *constraints, JSObject *obj);
 
 bool
-MergeTypes(MIRType *ptype, types::TemporaryTypeSet **ptypeSet,
-           MIRType newType, types::TemporaryTypeSet *newTypeSet);
+MergeTypes(MIRType *ptype, TemporaryTypeSet **ptypeSet,
+           MIRType newType, TemporaryTypeSet *newTypeSet);
 
 // Helper class to assert all GC pointers embedded in MIR instructions are
 // tenured. Off-thread Ion compilation and nursery GCs can happen in parallel,
 // so it's invalid to store pointers to nursery things. There's no need to root
 // these pointers, as GC is suppressed during compilation and off-thread
 // compilations are canceled on every major GC.
 template <typename T>
 class AlwaysTenured
@@ -2684,33 +2684,33 @@ class MNewArray
     // Number of space to allocate for the array.
     uint32_t count_;
 
     // Heap where the array should be allocated.
     gc::InitialHeap initialHeap_;
     // Allocate space at initialization or not
     AllocatingBehaviour allocating_;
 
-    MNewArray(types::CompilerConstraintList *constraints, uint32_t count, MConstant *templateConst,
+    MNewArray(CompilerConstraintList *constraints, uint32_t count, MConstant *templateConst,
               gc::InitialHeap initialHeap, AllocatingBehaviour allocating)
       : MUnaryInstruction(templateConst),
         count_(count),
         initialHeap_(initialHeap),
         allocating_(allocating)
     {
         ArrayObject *obj = templateObject();
         setResultType(MIRType_Object);
         if (!obj->isSingleton())
             setResultTypeSet(MakeSingletonTypeSet(constraints, obj));
     }
 
   public:
     INSTRUCTION_HEADER(NewArray)
 
-    static MNewArray *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MNewArray *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                           uint32_t count, MConstant *templateConst,
                           gc::InitialHeap initialHeap, AllocatingBehaviour allocating)
     {
         return new(alloc) MNewArray(constraints, count, templateConst, initialHeap, allocating);
     }
 
     uint32_t count() const {
         return count_;
@@ -2750,31 +2750,31 @@ class MNewArray
     }
 };
 
 class MNewArrayCopyOnWrite : public MNullaryInstruction
 {
     AlwaysTenured<ArrayObject*> templateObject_;
     gc::InitialHeap initialHeap_;
 
-    MNewArrayCopyOnWrite(types::CompilerConstraintList *constraints, ArrayObject *templateObject,
+    MNewArrayCopyOnWrite(CompilerConstraintList *constraints, ArrayObject *templateObject,
               gc::InitialHeap initialHeap)
       : templateObject_(templateObject),
         initialHeap_(initialHeap)
     {
         MOZ_ASSERT(!templateObject->isSingleton());
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
     }
 
   public:
     INSTRUCTION_HEADER(NewArrayCopyOnWrite)
 
     static MNewArrayCopyOnWrite *New(TempAllocator &alloc,
-                                     types::CompilerConstraintList *constraints,
+                                     CompilerConstraintList *constraints,
                                      ArrayObject *templateObject,
                                      gc::InitialHeap initialHeap)
     {
         return new(alloc) MNewArrayCopyOnWrite(constraints, templateObject, initialHeap);
     }
 
     ArrayObject *templateObject() const {
         return templateObject_;
@@ -2791,32 +2791,32 @@ class MNewArrayCopyOnWrite : public MNul
 
 class MNewArrayDynamicLength
   : public MUnaryInstruction,
     public IntPolicy<0>::Data
 {
     AlwaysTenured<ArrayObject*> templateObject_;
     gc::InitialHeap initialHeap_;
 
-    MNewArrayDynamicLength(types::CompilerConstraintList *constraints, ArrayObject *templateObject,
+    MNewArrayDynamicLength(CompilerConstraintList *constraints, ArrayObject *templateObject,
                            gc::InitialHeap initialHeap, MDefinition *length)
       : MUnaryInstruction(length),
         templateObject_(templateObject),
         initialHeap_(initialHeap)
     {
         setGuard(); // Need to throw if length is negative.
         setResultType(MIRType_Object);
         if (!templateObject->isSingleton())
             setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
     }
 
   public:
     INSTRUCTION_HEADER(NewArrayDynamicLength)
 
-    static MNewArrayDynamicLength *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MNewArrayDynamicLength *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                                        ArrayObject *templateObject, gc::InitialHeap initialHeap,
                                        MDefinition *length)
     {
         return new(alloc) MNewArrayDynamicLength(constraints, templateObject, initialHeap, length);
     }
 
     MDefinition *length() const {
         return getOperand(0);
@@ -2839,17 +2839,17 @@ class MNewObject
 {
   public:
     enum Mode { ObjectLiteral, ObjectCreate };
 
   private:
     gc::InitialHeap initialHeap_;
     Mode mode_;
 
-    MNewObject(types::CompilerConstraintList *constraints, MConstant *templateConst,
+    MNewObject(CompilerConstraintList *constraints, MConstant *templateConst,
                gc::InitialHeap initialHeap, Mode mode)
       : MUnaryInstruction(templateConst),
         initialHeap_(initialHeap),
         mode_(mode)
     {
         PlainObject *obj = templateObject();
         MOZ_ASSERT_IF(mode != ObjectLiteral, !shouldUseVM());
         setResultType(MIRType_Object);
@@ -2862,17 +2862,17 @@ class MNewObject
         // it and inline its content inside the code produced by the
         // CodeGenerator.
         templateConst->setEmittedAtUses();
     }
 
   public:
     INSTRUCTION_HEADER(NewObject)
 
-    static MNewObject *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MNewObject *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                            MConstant *templateConst, gc::InitialHeap initialHeap,
                            Mode mode)
     {
         return new(alloc) MNewObject(constraints, templateConst, initialHeap, mode);
     }
 
     // Returns true if the code generator should call through to the
     // VM rather than the fast path.
@@ -2898,31 +2898,31 @@ class MNewObject
     }
 };
 
 class MNewTypedObject : public MNullaryInstruction
 {
     AlwaysTenured<InlineTypedObject *> templateObject_;
     gc::InitialHeap initialHeap_;
 
-    MNewTypedObject(types::CompilerConstraintList *constraints,
+    MNewTypedObject(CompilerConstraintList *constraints,
                     InlineTypedObject *templateObject,
                     gc::InitialHeap initialHeap)
       : templateObject_(templateObject),
         initialHeap_(initialHeap)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
     }
 
   public:
     INSTRUCTION_HEADER(NewTypedObject)
 
     static MNewTypedObject *New(TempAllocator &alloc,
-                                types::CompilerConstraintList *constraints,
+                                CompilerConstraintList *constraints,
                                 InlineTypedObject *templateObject,
                                 gc::InitialHeap initialHeap)
     {
         return new(alloc) MNewTypedObject(constraints, templateObject, initialHeap);
     }
 
     InlineTypedObject *templateObject() const {
         return templateObject_;
@@ -2973,17 +2973,17 @@ class MTypedObjectDescr
 class MSimdBox
   : public MUnaryInstruction,
     public NoTypePolicy::Data
 {
   protected:
     AlwaysTenured<InlineTypedObject *> templateObject_;
     gc::InitialHeap initialHeap_;
 
-    MSimdBox(types::CompilerConstraintList *constraints,
+    MSimdBox(CompilerConstraintList *constraints,
              MDefinition *op,
              InlineTypedObject *templateObject,
              gc::InitialHeap initialHeap)
       : MUnaryInstruction(op),
         templateObject_(templateObject),
         initialHeap_(initialHeap)
     {
         MOZ_ASSERT(IsSimdType(op->type()));
@@ -2991,17 +2991,17 @@ class MSimdBox
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
     }
 
   public:
     INSTRUCTION_HEADER(SimdBox)
 
     static MSimdBox *New(TempAllocator &alloc,
-                         types::CompilerConstraintList *constraints,
+                         CompilerConstraintList *constraints,
                          MDefinition *op,
                          InlineTypedObject *templateObject,
                          gc::InitialHeap initialHeap)
     {
         return new(alloc) MSimdBox(constraints, op, templateObject, initialHeap);
     }
 
     InlineTypedObject *templateObject() const {
@@ -3905,17 +3905,17 @@ class MCompare
                               CompareType compareType);
 
     bool tryFold(bool *result);
     bool evaluateConstantOperands(TempAllocator &alloc, bool *result);
     MDefinition *foldsTo(TempAllocator &alloc) MOZ_OVERRIDE;
     void filtersUndefinedOrNull(bool trueBranch, MDefinition **subject, bool *filtersUndefined,
                                 bool *filtersNull);
 
-    void infer(types::CompilerConstraintList *constraints,
+    void infer(CompilerConstraintList *constraints,
                BaselineInspector *inspector, jsbytecode *pc);
     CompareType compareType() const {
         return compareType_;
     }
     bool isInt32Comparison() const {
         return compareType() == Compare_Int32 ||
                compareType() == Compare_Int32MaybeCoerceBoth ||
                compareType() == Compare_Int32MaybeCoerceLHS ||
@@ -3997,20 +3997,20 @@ class MBox
 {
     MBox(TempAllocator &alloc, MDefinition *ins)
       : MUnaryInstruction(ins)
     {
         setResultType(MIRType_Value);
         if (ins->resultTypeSet()) {
             setResultTypeSet(ins->resultTypeSet());
         } else if (ins->type() != MIRType_Value) {
-            types::Type ntype = ins->type() == MIRType_Object
-                                ? types::Type::AnyObjectType()
-                                : types::Type::PrimitiveType(ValueTypeFromMIRType(ins->type()));
-            setResultTypeSet(alloc.lifoAlloc()->new_<types::TemporaryTypeSet>(alloc.lifoAlloc(), ntype));
+            TypeSet::Type ntype = ins->type() == MIRType_Object
+                                  ? TypeSet::AnyObjectType()
+                                  : TypeSet::PrimitiveType(ValueTypeFromMIRType(ins->type()));
+            setResultTypeSet(alloc.lifoAlloc()->new_<TemporaryTypeSet>(alloc.lifoAlloc(), ntype));
         }
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Box)
     static MBox *New(TempAllocator &alloc, MDefinition *ins)
     {
@@ -4256,28 +4256,28 @@ class MAssertRange
 // Caller-side allocation of |this| for |new|:
 // Given a templateobject, construct |this| for JSOP_NEW
 class MCreateThisWithTemplate
   : public MUnaryInstruction,
     public NoTypePolicy::Data
 {
     gc::InitialHeap initialHeap_;
 
-    MCreateThisWithTemplate(types::CompilerConstraintList *constraints, MConstant *templateConst,
+    MCreateThisWithTemplate(CompilerConstraintList *constraints, MConstant *templateConst,
                             gc::InitialHeap initialHeap)
       : MUnaryInstruction(templateConst),
         initialHeap_(initialHeap)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject()));
     }
 
   public:
     INSTRUCTION_HEADER(CreateThisWithTemplate)
-    static MCreateThisWithTemplate *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MCreateThisWithTemplate *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                                         MConstant *templateConst, gc::InitialHeap initialHeap)
     {
         return new(alloc) MCreateThisWithTemplate(constraints, templateConst, initialHeap);
     }
 
     // Template for |this|, provided by TI.
     JSObject *templateObject() const {
         return &getOperand(0)->toConstant()->value().toObject();
@@ -4966,17 +4966,17 @@ class MTypeOf
         return new(alloc) MTypeOf(def, inputType);
     }
 
     MIRType inputType() const {
         return inputType_;
     }
 
     MDefinition *foldsTo(TempAllocator &alloc) MOZ_OVERRIDE;
-    void cacheInputMaybeCallableOrEmulatesUndefined(types::CompilerConstraintList *constraints);
+    void cacheInputMaybeCallableOrEmulatesUndefined(CompilerConstraintList *constraints);
 
     bool inputMaybeCallableOrEmulatesUndefined() const {
         return inputMaybeCallableOrEmulatesUndefined_;
     }
     void markInputNotCallableOrEmulatesUndefined() {
         inputMaybeCallableOrEmulatesUndefined_ = false;
     }
 
@@ -6288,28 +6288,28 @@ class MFromCharCode
 
     ALLOW_CLONE(MFromCharCode)
 };
 
 class MStringSplit
   : public MTernaryInstruction,
     public MixPolicy<StringPolicy<0>, StringPolicy<1> >::Data
 {
-    MStringSplit(types::CompilerConstraintList *constraints, MDefinition *string, MDefinition *sep,
+    MStringSplit(CompilerConstraintList *constraints, MDefinition *string, MDefinition *sep,
                  MConstant *templateObject)
       : MTernaryInstruction(string, sep, templateObject)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(templateObject->resultTypeSet());
     }
 
   public:
     INSTRUCTION_HEADER(StringSplit)
 
-    static MStringSplit *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MStringSplit *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                              MDefinition *string, MDefinition *sep,
                              MConstant *templateObject)
     {
         return new(alloc) MStringSplit(constraints, string, sep, templateObject);
     }
     MDefinition *string() const {
         return getOperand(0);
     }
@@ -6499,17 +6499,17 @@ class MPhi MOZ_FINAL
         return getOperand(1);
     }
 
     // Whether this phi's type already includes information for def.
     bool typeIncludes(MDefinition *def);
 
     // Add types for this phi which speculate about new inputs that may come in
     // via a loop backedge.
-    bool addBackedgeType(MIRType type, types::TemporaryTypeSet *typeSet);
+    bool addBackedgeType(MIRType type, TemporaryTypeSet *typeSet);
 
     // Initializes the operands vector to the given capacity,
     // permitting use of addInput() instead of addInputSlow().
     bool reserveLength(size_t length) {
         return inputs_.reserve(length);
     }
 
     // Use only if capacity has been reserved by reserveLength
@@ -6899,28 +6899,28 @@ class MDefFun
     }
 };
 
 class MRegExp : public MNullaryInstruction
 {
     AlwaysTenured<RegExpObject *> source_;
     bool mustClone_;
 
-    MRegExp(types::CompilerConstraintList *constraints, RegExpObject *source, bool mustClone)
+    MRegExp(CompilerConstraintList *constraints, RegExpObject *source, bool mustClone)
       : source_(source),
         mustClone_(mustClone)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, source));
     }
 
   public:
     INSTRUCTION_HEADER(RegExp)
 
-    static MRegExp *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MRegExp *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                         RegExpObject *source, bool mustClone)
     {
         return new(alloc) MRegExp(constraints, source, mustClone);
     }
 
     bool mustClone() const {
         return mustClone_;
     }
@@ -7178,28 +7178,28 @@ struct LambdaFunctionInfo
 };
 
 class MLambda
   : public MBinaryInstruction,
     public SingleObjectPolicy::Data
 {
     LambdaFunctionInfo info_;
 
-    MLambda(types::CompilerConstraintList *constraints, MDefinition *scopeChain, MConstant *cst)
+    MLambda(CompilerConstraintList *constraints, MDefinition *scopeChain, MConstant *cst)
       : MBinaryInstruction(scopeChain, cst), info_(&cst->value().toObject().as<JSFunction>())
     {
         setResultType(MIRType_Object);
         if (!info().fun->isSingleton() && !ObjectGroup::useSingletonForClone(info().fun))
             setResultTypeSet(MakeSingletonTypeSet(constraints, info().fun));
     }
 
   public:
     INSTRUCTION_HEADER(Lambda)
 
-    static MLambda *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MLambda *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                         MDefinition *scopeChain, MConstant *fun)
     {
         return new(alloc) MLambda(constraints, scopeChain, fun);
     }
     MDefinition *scopeChain() const {
         return getOperand(0);
     }
     MConstant *functionOperand() const {
@@ -7215,30 +7215,30 @@ class MLambda
 };
 
 class MLambdaArrow
   : public MBinaryInstruction,
     public MixPolicy<ObjectPolicy<0>, BoxPolicy<1> >::Data
 {
     LambdaFunctionInfo info_;
 
-    MLambdaArrow(types::CompilerConstraintList *constraints, MDefinition *scopeChain,
+    MLambdaArrow(CompilerConstraintList *constraints, MDefinition *scopeChain,
                  MDefinition *this_, JSFunction *fun)
       : MBinaryInstruction(scopeChain, this_), info_(fun)
     {
         setResultType(MIRType_Object);
         MOZ_ASSERT(!ObjectGroup::useSingletonForClone(fun));
         if (!fun->isSingleton())
             setResultTypeSet(MakeSingletonTypeSet(constraints, fun));
     }
 
   public:
     INSTRUCTION_HEADER(LambdaArrow)
 
-    static MLambdaArrow *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MLambdaArrow *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                              MDefinition *scopeChain, MDefinition *this_, JSFunction *fun)
     {
         return new(alloc) MLambdaArrow(constraints, scopeChain, this_, fun);
     }
     MDefinition *scopeChain() const {
         return getOperand(0);
     }
     MDefinition *thisDef() const {
@@ -7768,17 +7768,17 @@ class MNot
     static MNot *NewAsmJS(TempAllocator &alloc, MDefinition *elements) {
         MNot *ins = new(alloc) MNot(elements);
         ins->setResultType(MIRType_Int32);
         return ins;
     }
 
     INSTRUCTION_HEADER(Not)
 
-    void cacheOperandMightEmulateUndefined(types::CompilerConstraintList *constraints);
+    void cacheOperandMightEmulateUndefined(CompilerConstraintList *constraints);
     MDefinition *foldsTo(TempAllocator &alloc) MOZ_OVERRIDE;
 
     void markOperandCantEmulateUndefined() {
         operandMightEmulateUndefined_ = false;
     }
     bool operandMightEmulateUndefined() const {
         return operandMightEmulateUndefined_;
     }
@@ -8509,30 +8509,30 @@ class MArrayPush
 // Array.prototype.concat on two dense arrays.
 class MArrayConcat
   : public MBinaryInstruction,
     public MixPolicy<ObjectPolicy<0>, ObjectPolicy<1> >::Data
 {
     AlwaysTenured<ArrayObject*> templateObj_;
     gc::InitialHeap initialHeap_;
 
-    MArrayConcat(types::CompilerConstraintList *constraints, MDefinition *lhs, MDefinition *rhs,
+    MArrayConcat(CompilerConstraintList *constraints, MDefinition *lhs, MDefinition *rhs,
                  ArrayObject *templateObj, gc::InitialHeap initialHeap)
       : MBinaryInstruction(lhs, rhs),
         templateObj_(templateObj),
         initialHeap_(initialHeap)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObj));
     }
 
   public:
     INSTRUCTION_HEADER(ArrayConcat)
 
-    static MArrayConcat *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MArrayConcat *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                              MDefinition *lhs, MDefinition *rhs,
                              ArrayObject *templateObj, gc::InitialHeap initialHeap)
     {
         return new(alloc) MArrayConcat(constraints, lhs, rhs, templateObj, initialHeap);
     }
 
     ArrayObject *templateObj() const {
         return templateObj_;
@@ -9246,17 +9246,17 @@ class InlinePropertyTable : public TempO
     }
 
     JSFunction *getFunction(size_t i) const {
         MOZ_ASSERT(i < numEntries());
         return entries_[i]->func;
     }
 
     bool hasFunction(JSFunction *func) const;
-    types::TemporaryTypeSet *buildTypeSetForFunction(JSFunction *func) const;
+    TemporaryTypeSet *buildTypeSetForFunction(JSFunction *func) const;
 
     // Remove targets that vetoed inlining from the InlinePropertyTable.
     void trimTo(ObjectVector &targets, BoolVector &choiceSet);
 
     // Ensure that the InlinePropertyTable's domain is a subset of |targets|.
     void trimToTargets(ObjectVector &targets);
 };
 
@@ -11314,29 +11314,29 @@ class MRestCommon
     }
 };
 
 class MRest
   : public MUnaryInstruction,
     public MRestCommon,
     public IntPolicy<0>::Data
 {
-    MRest(types::CompilerConstraintList *constraints, MDefinition *numActuals, unsigned numFormals,
+    MRest(CompilerConstraintList *constraints, MDefinition *numActuals, unsigned numFormals,
           ArrayObject *templateObject)
       : MUnaryInstruction(numActuals),
         MRestCommon(numFormals, templateObject)
     {
         setResultType(MIRType_Object);
         setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
     }
 
   public:
     INSTRUCTION_HEADER(Rest)
 
-    static MRest *New(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+    static MRest *New(TempAllocator &alloc, CompilerConstraintList *constraints,
                       MDefinition *numActuals, unsigned numFormals,
                       ArrayObject *templateObject)
     {
         return new(alloc) MRest(constraints, numActuals, numFormals, templateObject);
     }
 
     MDefinition *numActuals() const {
         return getOperand(0);
@@ -11349,28 +11349,28 @@ class MRest
         return true;
     }
 };
 
 class MFilterTypeSet
   : public MUnaryInstruction,
     public FilterTypeSetPolicy::Data
 {
-    MFilterTypeSet(MDefinition *def, types::TemporaryTypeSet *types)
+    MFilterTypeSet(MDefinition *def, TemporaryTypeSet *types)
       : MUnaryInstruction(def)
     {
         MOZ_ASSERT(!types->unknown());
         setResultType(types->getKnownMIRType());
         setResultTypeSet(types);
     }
 
   public:
     INSTRUCTION_HEADER(FilterTypeSet)
 
-    static MFilterTypeSet *New(TempAllocator &alloc, MDefinition *def, types::TemporaryTypeSet *types) {
+    static MFilterTypeSet *New(TempAllocator &alloc, MDefinition *def, TemporaryTypeSet *types) {
         return new(alloc) MFilterTypeSet(def, types);
     }
 
     bool congruentTo(const MDefinition *def) const MOZ_OVERRIDE {
         return false;
     }
     AliasSet getAliasSet() const MOZ_OVERRIDE {
         return AliasSet::None();
@@ -11383,34 +11383,34 @@ class MFilterTypeSet
 // Given a value, guard that the value is in a particular TypeSet, then returns
 // that value.
 class MTypeBarrier
   : public MUnaryInstruction,
     public TypeBarrierPolicy::Data
 {
     BarrierKind barrierKind_;
 
-    MTypeBarrier(MDefinition *def, types::TemporaryTypeSet *types, BarrierKind kind)
+    MTypeBarrier(MDefinition *def, TemporaryTypeSet *types, BarrierKind kind)
       : MUnaryInstruction(def),
         barrierKind_(kind)
     {
         MOZ_ASSERT(kind == BarrierKind::TypeTagOnly || kind == BarrierKind::TypeSet);
 
         MOZ_ASSERT(!types->unknown());
         setResultType(types->getKnownMIRType());
         setResultTypeSet(types);
 
         setGuard();
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(TypeBarrier)
 
-    static MTypeBarrier *New(TempAllocator &alloc, MDefinition *def, types::TemporaryTypeSet *types,
+    static MTypeBarrier *New(TempAllocator &alloc, MDefinition *def, TemporaryTypeSet *types,
                              BarrierKind kind = BarrierKind::TypeSet) {
         return new(alloc) MTypeBarrier(def, types, kind);
     }
 
     void printOpcode(FILE *fp) const MOZ_OVERRIDE;
     bool congruentTo(const MDefinition *def) const MOZ_OVERRIDE;
 
     AliasSet getAliasSet() const MOZ_OVERRIDE {
@@ -11439,39 +11439,39 @@ class MTypeBarrier
 
 // Like MTypeBarrier, guard that the value is in the given type set. This is
 // used before property writes to ensure the value being written is represented
 // in the property types for the object.
 class MMonitorTypes
   : public MUnaryInstruction,
     public BoxInputsPolicy::Data
 {
-    const types::TemporaryTypeSet *typeSet_;
+    const TemporaryTypeSet *typeSet_;
     BarrierKind barrierKind_;
 
-    MMonitorTypes(MDefinition *def, const types::TemporaryTypeSet *types, BarrierKind kind)
+    MMonitorTypes(MDefinition *def, const TemporaryTypeSet *types, BarrierKind kind)
       : MUnaryInstruction(def),
         typeSet_(types),
         barrierKind_(kind)
     {
         MOZ_ASSERT(kind == BarrierKind::TypeTagOnly || kind == BarrierKind::TypeSet);
 
         setGuard();
         MOZ_ASSERT(!types->unknown());
     }
 
   public:
     INSTRUCTION_HEADER(MonitorTypes)
 
-    static MMonitorTypes *New(TempAllocator &alloc, MDefinition *def, const types::TemporaryTypeSet *types,
+    static MMonitorTypes *New(TempAllocator &alloc, MDefinition *def, const TemporaryTypeSet *types,
                               BarrierKind kind) {
         return new(alloc) MMonitorTypes(def, types, kind);
     }
 
-    const types::TemporaryTypeSet *typeSet() const {
+    const TemporaryTypeSet *typeSet() const {
         return typeSet_;
     }
     BarrierKind barrierKind() const {
         return barrierKind_;
     }
 
     AliasSet getAliasSet() const MOZ_OVERRIDE {
         return AliasSet::None();
@@ -12696,45 +12696,45 @@ const MInstruction *MDefinition::toInstr
 
 MControlInstruction *MDefinition::toControlInstruction() {
     MOZ_ASSERT(isControlInstruction());
     return (MControlInstruction *)this;
 }
 
 // Helper functions used to decide how to build MIR.
 
-bool ElementAccessIsDenseNative(types::CompilerConstraintList *constraints,
+bool ElementAccessIsDenseNative(CompilerConstraintList *constraints,
                                 MDefinition *obj, MDefinition *id);
-bool ElementAccessIsAnyTypedArray(types::CompilerConstraintList *constraints,
+bool ElementAccessIsAnyTypedArray(CompilerConstraintList *constraints,
                                   MDefinition *obj, MDefinition *id,
                                   Scalar::Type *arrayType);
-bool ElementAccessIsPacked(types::CompilerConstraintList *constraints, MDefinition *obj);
-bool ElementAccessMightBeCopyOnWrite(types::CompilerConstraintList *constraints, MDefinition *obj);
-bool ElementAccessHasExtraIndexedProperty(types::CompilerConstraintList *constraints,
+bool ElementAccessIsPacked(CompilerConstraintList *constraints, MDefinition *obj);
+bool ElementAccessMightBeCopyOnWrite(CompilerConstraintList *constraints, MDefinition *obj);
+bool ElementAccessHasExtraIndexedProperty(CompilerConstraintList *constraints,
                                           MDefinition *obj);
-MIRType DenseNativeElementType(types::CompilerConstraintList *constraints, MDefinition *obj);
+MIRType DenseNativeElementType(CompilerConstraintList *constraints, MDefinition *obj);
 BarrierKind PropertyReadNeedsTypeBarrier(JSContext *propertycx,
-                                         types::CompilerConstraintList *constraints,
-                                         types::TypeSetObjectKey *key, PropertyName *name,
-                                         types::TemporaryTypeSet *observed, bool updateObserved);
+                                         CompilerConstraintList *constraints,
+                                         TypeSet::ObjectKey *key, PropertyName *name,
+                                         TemporaryTypeSet *observed, bool updateObserved);
 BarrierKind PropertyReadNeedsTypeBarrier(JSContext *propertycx,
-                                         types::CompilerConstraintList *constraints,
+                                         CompilerConstraintList *constraints,
                                          MDefinition *obj, PropertyName *name,
-                                         types::TemporaryTypeSet *observed);
-BarrierKind PropertyReadOnPrototypeNeedsTypeBarrier(types::CompilerConstraintList *constraints,
+                                         TemporaryTypeSet *observed);
+BarrierKind PropertyReadOnPrototypeNeedsTypeBarrier(CompilerConstraintList *constraints,
                                                     MDefinition *obj, PropertyName *name,
-                                                    types::TemporaryTypeSet *observed);
-bool PropertyReadIsIdempotent(types::CompilerConstraintList *constraints,
+                                                    TemporaryTypeSet *observed);
+bool PropertyReadIsIdempotent(CompilerConstraintList *constraints,
                               MDefinition *obj, PropertyName *name);
 void AddObjectsForPropertyRead(MDefinition *obj, PropertyName *name,
-                               types::TemporaryTypeSet *observed);
-bool CanWriteProperty(TempAllocator &alloc, types::CompilerConstraintList *constraints,
-                      types::HeapTypeSetKey property, MDefinition *value,
+                               TemporaryTypeSet *observed);
+bool CanWriteProperty(TempAllocator &alloc, CompilerConstraintList *constraints,
+                      HeapTypeSetKey property, MDefinition *value,
                       MIRType implicitType = MIRType_None);
-bool PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, types::CompilerConstraintList *constraints,
+bool PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, CompilerConstraintList *constraints,
                                    MBasicBlock *current, MDefinition **pobj,
                                    PropertyName *name, MDefinition **pvalue,
                                    bool canModify, MIRType implicitType = MIRType_None);
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_MIR_h */
--- a/js/src/jit/MacroAssembler.cpp
+++ b/js/src/jit/MacroAssembler.cpp
@@ -32,27 +32,27 @@ using namespace js::jit;
 using JS::GenericNaN;
 using JS::ToInt32;
 
 namespace {
 
 // Emulate a TypeSet logic from a Type object to avoid duplicating the guard
 // logic.
 class TypeWrapper {
-    types::Type t_;
+    TypeSet::Type t_;
 
   public:
-    explicit TypeWrapper(types::Type t) : t_(t) {}
+    explicit TypeWrapper(TypeSet::Type t) : t_(t) {}
 
     inline bool unknown() const {
         return t_.isUnknown();
     }
-    inline bool hasType(types::Type t) const {
-        if (t == types::Type::Int32Type())
-            return t == t_ || t_ == types::Type::DoubleType();
+    inline bool hasType(TypeSet::Type t) const {
+        if (t == TypeSet::Int32Type())
+            return t == t_ || t_ == TypeSet::DoubleType();
         return t == t_;
     }
     inline unsigned getObjectCount() const {
         if (t_.isAnyObject() || t_.isUnknown() || !t_.isObject())
             return 0;
         return 1;
     }
     inline JSObject *getSingletonNoBarrier(unsigned) const {
@@ -64,57 +64,57 @@ class TypeWrapper {
         if (t_.isGroup())
             return t_.groupNoBarrier();
         return nullptr;
     }
 };
 
 } /* anonymous namespace */
 
-template <typename Source, typename TypeSet> void
-MacroAssembler::guardTypeSet(const Source &address, const TypeSet *types, BarrierKind kind,
+template <typename Source, typename Set> void
+MacroAssembler::guardTypeSet(const Source &address, const Set *types, BarrierKind kind,
                              Register scratch, Label *miss)
 {
     MOZ_ASSERT(kind == BarrierKind::TypeTagOnly || kind == BarrierKind::TypeSet);
     MOZ_ASSERT(!types->unknown());
 
     Label matched;
-    types::Type tests[8] = {
-        types::Type::Int32Type(),
-        types::Type::UndefinedType(),
-        types::Type::BooleanType(),
-        types::Type::StringType(),
-        types::Type::SymbolType(),
-        types::Type::NullType(),
-        types::Type::MagicArgType(),
-        types::Type::AnyObjectType()
+    TypeSet::Type tests[8] = {
+        TypeSet::Int32Type(),
+        TypeSet::UndefinedType(),
+        TypeSet::BooleanType(),
+        TypeSet::StringType(),
+        TypeSet::SymbolType(),
+        TypeSet::NullType(),
+        TypeSet::MagicArgType(),
+        TypeSet::AnyObjectType()
     };
 
     // The double type also implies Int32.
     // So replace the int32 test with the double one.
-    if (types->hasType(types::Type::DoubleType())) {
-        MOZ_ASSERT(types->hasType(types::Type::Int32Type()));
-        tests[0] = types::Type::DoubleType();
+    if (types->hasType(TypeSet::DoubleType())) {
+        MOZ_ASSERT(types->hasType(TypeSet::Int32Type()));
+        tests[0] = TypeSet::DoubleType();
     }
 
     Register tag = extractTag(address, scratch);
 
     // Emit all typed tests.
     BranchType lastBranch;
     for (size_t i = 0; i < mozilla::ArrayLength(tests); i++) {
         if (!types->hasType(tests[i]))
             continue;
 
         if (lastBranch.isInitialized())
             lastBranch.emit(*this);
         lastBranch = BranchType(Equal, tag, tests[i], &matched);
     }
 
     // If this is the last check, invert the last branch.
-    if (types->hasType(types::Type::AnyObjectType()) || !types->getObjectCount()) {
+    if (types->hasType(TypeSet::AnyObjectType()) || !types->getObjectCount()) {
         if (!lastBranch.isInitialized()) {
             jump(miss);
             return;
         }
 
         lastBranch.invertCondition();
         lastBranch.relink(miss);
         lastBranch.emit(*this);
@@ -151,22 +151,22 @@ MacroAssembler::guardTypeSet(const Sourc
 
         assumeUnreachable("Unexpected object type");
 #endif
     }
 
     bind(&matched);
 }
 
-template <typename TypeSet> void
-MacroAssembler::guardObjectType(Register obj, const TypeSet *types,
+template <typename Set> void
+MacroAssembler::guardObjectType(Register obj, const Set *types,
                                 Register scratch, Label *miss)
 {
     MOZ_ASSERT(!types->unknown());
-    MOZ_ASSERT(!types->hasType(types::Type::AnyObjectType()));
+    MOZ_ASSERT(!types->hasType(TypeSet::AnyObjectType()));
     MOZ_ASSERT(types->getObjectCount());
     MOZ_ASSERT(scratch != InvalidReg);
 
     // Note: this method elides read barriers on values read from type sets, as
     // this may be called off the main thread during Ion compilation. This is
     // safe to do as the final JitCode object will be allocated during the
     // incremental GC (or the compilation canceled before we start sweeping),
     // see CodeGenerator::link. Other callers should use TypeSet::readBarrier
@@ -224,55 +224,55 @@ MacroAssembler::guardObjectType(Register
     lastBranch.relink(miss);
     lastBranch.emit(*this);
 
     bind(&matched);
     return;
 }
 
 template <typename Source> void
-MacroAssembler::guardType(const Source &address, types::Type type,
+MacroAssembler::guardType(const Source &address, TypeSet::Type type,
                           Register scratch, Label *miss)
 {
     TypeWrapper wrapper(type);
     guardTypeSet(address, &wrapper, BarrierKind::TypeSet, scratch, miss);
 }
 
-template void MacroAssembler::guardTypeSet(const Address &address, const types::TemporaryTypeSet *types,
+template void MacroAssembler::guardTypeSet(const Address &address, const TemporaryTypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
-template void MacroAssembler::guardTypeSet(const ValueOperand &value, const types::TemporaryTypeSet *types,
+template void MacroAssembler::guardTypeSet(const ValueOperand &value, const TemporaryTypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
 
-template void MacroAssembler::guardTypeSet(const Address &address, const types::HeapTypeSet *types,
+template void MacroAssembler::guardTypeSet(const Address &address, const HeapTypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
-template void MacroAssembler::guardTypeSet(const ValueOperand &value, const types::HeapTypeSet *types,
+template void MacroAssembler::guardTypeSet(const ValueOperand &value, const HeapTypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
-template void MacroAssembler::guardTypeSet(const TypedOrValueRegister &reg, const types::HeapTypeSet *types,
+template void MacroAssembler::guardTypeSet(const TypedOrValueRegister &reg, const HeapTypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
 
-template void MacroAssembler::guardTypeSet(const Address &address, const types::TypeSet *types,
+template void MacroAssembler::guardTypeSet(const Address &address, const TypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
-template void MacroAssembler::guardTypeSet(const ValueOperand &value, const types::TypeSet *types,
+template void MacroAssembler::guardTypeSet(const ValueOperand &value, const TypeSet *types,
                                            BarrierKind kind, Register scratch, Label *miss);
 
 template void MacroAssembler::guardTypeSet(const Address &address, const TypeWrapper *types,
                                            BarrierKind kind, Register scratch, Label *miss);
 template void MacroAssembler::guardTypeSet(const ValueOperand &value, const TypeWrapper *types,
                                            BarrierKind kind, Register scratch, Label *miss);
 
-template void MacroAssembler::guardObjectType(Register obj, const types::TemporaryTypeSet *types,
+template void MacroAssembler::guardObjectType(Register obj, const TemporaryTypeSet *types,
                                               Register scratch, Label *miss);
-template void MacroAssembler::guardObjectType(Register obj, const types::TypeSet *types,
+template void MacroAssembler::guardObjectType(Register obj, const TypeSet *types,
                                               Register scratch, Label *miss);
 template void MacroAssembler::guardObjectType(Register obj, const TypeWrapper *types,
                                               Register scratch, Label *miss);
 
-template void MacroAssembler::guardType(const Address &address, types::Type type,
+template void MacroAssembler::guardType(const Address &address, TypeSet::Type type,
                                         Register scratch, Label *miss);
-template void MacroAssembler::guardType(const ValueOperand &value, types::Type type,
+template void MacroAssembler::guardType(const ValueOperand &value, TypeSet::Type type,
                                         Register scratch, Label *miss);
 
 template<typename S, typename T>
 static void
 StoreToTypedFloatArray(MacroAssembler &masm, int arrayType, const S &value, const T &dest)
 {
     switch (arrayType) {
       case Scalar::Float32:
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -113,30 +113,30 @@ class MacroAssembler : public MacroAssem
         void relink(Label *jump) {
             jump_ = jump;
         }
 
         virtual void emit(MacroAssembler &masm) = 0;
     };
 
     /*
-     * Creates a branch based on a specific types::Type.
-     * Note: emits number test (int/double) for types::Type::DoubleType()
+     * Creates a branch based on a specific TypeSet::Type.
+     * Note: emits number test (int/double) for TypeSet::DoubleType()
      */
     class BranchType : public Branch
     {
-        types::Type type_;
+        TypeSet::Type type_;
 
       public:
         BranchType()
           : Branch(),
-            type_(types::Type::UnknownType())
+            type_(TypeSet::UnknownType())
         { }
 
-        BranchType(Condition cond, Register reg, types::Type type, Label *jump)
+        BranchType(Condition cond, Register reg, TypeSet::Type type, Label *jump)
           : Branch(cond, reg, jump),
             type_(type)
         { }
 
         void emit(MacroAssembler &masm) {
             MOZ_ASSERT(isInitialized());
             MIRType mirType = MIRType_None;
 
@@ -273,17 +273,17 @@ class MacroAssembler : public MacroAssem
 
     // Emits a test of a value against all types in a TypeSet. A scratch
     // register is required.
     template <typename Source, typename TypeSet>
     void guardTypeSet(const Source &address, const TypeSet *types, BarrierKind kind, Register scratch, Label *miss);
     template <typename TypeSet>
     void guardObjectType(Register obj, const TypeSet *types, Register scratch, Label *miss);
     template <typename Source>
-    void guardType(const Source &address, types::Type type, Register scratch, Label *miss);
+    void guardType(const Source &address, TypeSet::Type type, Register scratch, Label *miss);
 
     void loadObjShape(Register objReg, Register dest) {
         loadPtr(Address(objReg, JSObject::offsetOfShape()), dest);
     }
     void loadBaseShape(Register objReg, Register dest) {
         loadPtr(Address(objReg, JSObject::offsetOfShape()), dest);
 
         loadPtr(Address(dest, Shape::offsetOfBase()), dest);
--- a/js/src/jit/OptimizationTracking.cpp
+++ b/js/src/jit/OptimizationTracking.cpp
@@ -133,17 +133,17 @@ SpewTempOptimizationTypeInfoVector(const
                                    const char *indent = nullptr)
 {
 #ifdef DEBUG
     for (const OptimizationTypeInfo *t = types->begin(); t != types->end(); t++) {
         JitSpewStart(JitSpew_OptimizationTracking, "   %s%s of type %s, type set",
                      indent ? indent : "",
                      TrackedTypeSiteString(t->site()), StringFromMIRType(t->mirType()));
         for (uint32_t i = 0; i < t->types().length(); i++)
-            JitSpewCont(JitSpew_OptimizationTracking, " %s", types::TypeString(t->types()[i]));
+            JitSpewCont(JitSpew_OptimizationTracking, " %s", TypeSet::TypeString(t->types()[i]));
         JitSpewFin(JitSpew_OptimizationTracking);
     }
 #endif
 }
 
 void
 SpewTempOptimizationAttemptsVector(const TempOptimizationAttemptsVector *attempts,
                                    const char *indent = nullptr)
@@ -161,25 +161,25 @@ TrackedOptimizations::spew() const
 {
 #ifdef DEBUG
     SpewTempOptimizationTypeInfoVector(&types_);
     SpewTempOptimizationAttemptsVector(&attempts_);
 #endif
 }
 
 bool
-OptimizationTypeInfo::trackTypeSet(types::TemporaryTypeSet *typeSet)
+OptimizationTypeInfo::trackTypeSet(TemporaryTypeSet *typeSet)
 {
     if (!typeSet)
         return true;
     return typeSet->enumerateTypes(&types_);
 }
 
 bool
-OptimizationTypeInfo::trackType(types::Type type)
+OptimizationTypeInfo::trackType(TypeSet::Type type)
 {
     return types_.append(type);
 }
 
 bool
 OptimizationTypeInfo::operator ==(const OptimizationTypeInfo &other) const
 {
     return site_ == other.site_ && mirType_ == other.mirType_ &&
@@ -197,25 +197,25 @@ CombineHash(HashNumber h, HashNumber n)
 {
     h += n;
     h += (h << 10);
     h ^= (h >> 6);
     return h;
 }
 
 static inline HashNumber
-HashType(types::Type ty)
+HashType(TypeSet::Type ty)
 {
     if (ty.isObjectUnchecked())
-        return PointerHasher<types::TypeSetObjectKey *, 3>::hash(ty.objectKey());
+        return PointerHasher<TypeSet::ObjectKey *, 3>::hash(ty.objectKey());
     return HashNumber(ty.raw());
 }
 
 static HashNumber
-HashTypeList(const types::TypeSet::TypeList &types)
+HashTypeList(const TypeSet::TypeList &types)
 {
     HashNumber h = 0;
     for (uint32_t i = 0; i < types.length(); i++)
         h = CombineHash(h, HashType(types[i]));
     return h;
 }
 
 HashNumber
@@ -343,44 +343,44 @@ UniqueTrackedOptimizations::indexOf(cons
 }
 
 // Assigns each unique tracked type an index; outputs a compact list.
 class jit::UniqueTrackedTypes
 {
   public:
     struct TypeHasher
     {
-        typedef types::Type Lookup;
+        typedef TypeSet::Type Lookup;
 
         static HashNumber hash(const Lookup &ty) { return HashType(ty); }
-        static bool match(const types::Type &ty1, const types::Type &ty2) { return ty1 == ty2; }
+        static bool match(const TypeSet::Type &ty1, const TypeSet::Type &ty2) { return ty1 == ty2; }
     };
 
   private:
-    // Map of unique types::Types to indices.
-    typedef HashMap<types::Type, uint8_t, TypeHasher> TypesMap;
+    // Map of unique TypeSet::Types to indices.
+    typedef HashMap<TypeSet::Type, uint8_t, TypeHasher> TypesMap;
     TypesMap map_;
 
-    Vector<types::Type, 1> list_;
+    Vector<TypeSet::Type, 1> list_;
 
   public:
     explicit UniqueTrackedTypes(JSContext *cx)
       : map_(cx),
         list_(cx)
     { }
 
     bool init() { return map_.init(); }
-    bool getIndexOf(types::Type ty, uint8_t *indexp);
+    bool getIndexOf(TypeSet::Type ty, uint8_t *indexp);
 
     uint32_t count() const { MOZ_ASSERT(map_.count() == list_.length()); return list_.length(); }
-    bool enumerate(types::TypeSet::TypeList *types) const;
+    bool enumerate(TypeSet::TypeList *types) const;
 };
 
 bool
-UniqueTrackedTypes::getIndexOf(types::Type ty, uint8_t *indexp)
+UniqueTrackedTypes::getIndexOf(TypeSet::Type ty, uint8_t *indexp)
 {
     TypesMap::AddPtr p = map_.lookupForAdd(ty);
     if (p) {
         *indexp = p->value();
         return true;
     }
 
     // Store indices as max of uint8_t. In practice each script has fewer than
@@ -393,17 +393,17 @@ UniqueTrackedTypes::getIndexOf(types::Ty
         return false;
     if (!list_.append(ty))
         return false;
     *indexp = index;
     return true;
 }
 
 bool
-UniqueTrackedTypes::enumerate(types::TypeSet::TypeList *types) const
+UniqueTrackedTypes::enumerate(TypeSet::TypeList *types) const
 {
     return types->append(list_.begin(), list_.end());
 }
 
 void
 IonTrackedOptimizationsRegion::unpackHeader()
 {
     CompactBufferReader reader(start_, end_);
@@ -809,55 +809,55 @@ WriteOffsetsTable(CompactBufferWriter &w
     if (writer.oom())
         return false;
 
     *tableOffsetp = tableOffset;
     return true;
 }
 
 static JSFunction *
-MaybeConstructorFromType(types::Type ty)
+MaybeConstructorFromType(TypeSet::Type ty)
 {
     if (ty.isUnknown() || ty.isAnyObject() || !ty.isGroup())
         return nullptr;
     ObjectGroup *obj = ty.group();
-    types::TypeNewScript *newScript = obj->newScript();
+    TypeNewScript *newScript = obj->newScript();
     if (!newScript && obj->maybeUnboxedLayout())
         newScript = obj->unboxedLayout().newScript();
     return newScript ? newScript->function() : nullptr;
 }
 
 static void
-SpewConstructor(types::Type ty, JSFunction *constructor)
+SpewConstructor(TypeSet::Type ty, JSFunction *constructor)
 {
 #ifdef DEBUG
     char buf[512];
     PutEscapedString(buf, 512, constructor->displayAtom(), 0);
 
     const char *filename;
     uint32_t lineno;
     if (constructor->hasScript()) {
         filename = constructor->nonLazyScript()->filename();
         lineno = constructor->nonLazyScript()->lineno();
     } else {
         filename = constructor->lazyScript()->filename();
         lineno = constructor->lazyScript()->lineno();
     }
 
     JitSpew(JitSpew_OptimizationTracking, "   Unique type %s has constructor %s (%s:%u)",
-            types::TypeString(ty), buf, filename, lineno);
+            TypeSet::TypeString(ty), buf, filename, lineno);
 #endif
 }
 
 static void
-SpewAllocationSite(types::Type ty, JSScript *script, uint32_t offset)
+SpewAllocationSite(TypeSet::Type ty, JSScript *script, uint32_t offset)
 {
 #ifdef DEBUG
     JitSpew(JitSpew_OptimizationTracking, "   Unique type %s has alloc site %s:%u",
-            types::TypeString(ty), script->filename(),
+            TypeSet::TypeString(ty), script->filename(),
             PCToLineNumber(script, script->offsetToPC(offset)));
 #endif
 }
 
 bool
 jit::WriteIonTrackedOptimizationsTable(JSContext *cx, CompactBufferWriter &writer,
                                        const NativeToTrackedOptimizations *start,
                                        const NativeToTrackedOptimizations *end,
@@ -937,29 +937,31 @@ jit::WriteIonTrackedOptimizationsTable(J
         }
     }
 
     // Enumerate the unique types, and pull out any 'new' script constructor
     // functions and allocation site information. We do this during linking
     // instead of during profiling to avoid touching compartment tables during
     // profiling. Additionally, TypeNewScript is subject to GC in the
     // meantime.
-    types::TypeSet::TypeList uniqueTypeList;
+    TypeSet::TypeList uniqueTypeList;
     if (!uniqueTypes.enumerate(&uniqueTypeList))
         return false;
     for (uint32_t i = 0; i < uniqueTypeList.length(); i++) {
-        types::Type ty = uniqueTypeList[i];
+        TypeSet::Type ty = uniqueTypeList[i];
         if (JSFunction *constructor = MaybeConstructorFromType(ty)) {
             if (!allTypes->append(IonTrackedTypeWithAddendum(ty, constructor)))
                 return false;
             SpewConstructor(ty, constructor);
         } else {
             JSScript *script;
             uint32_t offset;
-            if (ObjectGroup::findAllocationSiteForType(cx, ty, &script, &offset)) {
+            if (!ty.isUnknown() && !ty.isAnyObject() && ty.isGroup() &&
+                ObjectGroup::findAllocationSite(cx, ty.group(), &script, &offset))
+            {
                 if (!allTypes->append(IonTrackedTypeWithAddendum(ty, script, offset)))
                     return false;
                 SpewAllocationSite(ty, script, offset);
             } else {
                 if (!allTypes->append(IonTrackedTypeWithAddendum(ty)))
                     return false;
             }
         }
@@ -1027,17 +1029,17 @@ IonBuilder::startTrackingOptimizations()
 
         if (site)
             current->updateTrackedSite(site);
     }
 }
 
 void
 IonBuilder::trackTypeInfoUnchecked(TrackedTypeSite kind, MIRType mirType,
-                                   types::TemporaryTypeSet *typeSet)
+                                   TemporaryTypeSet *typeSet)
 {
     BytecodeSite *site = current->trackedSite();
     // OOMs are handled as if optimization tracking were turned off.
     OptimizationTypeInfo typeInfo(kind, mirType);
     if (!typeInfo.trackTypeSet(typeSet)) {
         site->setOptimizations(nullptr);
         return;
     }
@@ -1046,34 +1048,34 @@ IonBuilder::trackTypeInfoUnchecked(Track
 }
 
 void
 IonBuilder::trackTypeInfoUnchecked(TrackedTypeSite kind, JSObject *obj)
 {
     BytecodeSite *site = current->trackedSite();
     // OOMs are handled as if optimization tracking were turned off.
     OptimizationTypeInfo typeInfo(kind, MIRType_Object);
-    if (!typeInfo.trackType(types::Type::ObjectType(obj)))
+    if (!typeInfo.trackType(TypeSet::ObjectType(obj)))
         return;
     if (!site->optimizations()->trackTypeInfo(mozilla::Move(typeInfo)))
         site->setOptimizations(nullptr);
 }
 
 void
 IonBuilder::trackTypeInfoUnchecked(CallInfo &callInfo)
 {
     MDefinition *thisArg = callInfo.thisArg();
     trackTypeInfoUnchecked(TrackedTypeSite::Call_This, thisArg->type(), thisArg->resultTypeSet());
 
     for (uint32_t i = 0; i < callInfo.argc(); i++) {
         MDefinition *arg = callInfo.getArg(i);
         trackTypeInfoUnchecked(TrackedTypeSite::Call_Arg, arg->type(), arg->resultTypeSet());
     }
 
-    types::TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
+    TemporaryTypeSet *returnTypes = getInlineReturnTypeSet();
     trackTypeInfoUnchecked(TrackedTypeSite::Call_Return, returnTypes->getKnownMIRType(),
                            returnTypes);
 }
 
 void
 IonBuilder::trackOptimizationAttemptUnchecked(TrackedStrategy strategy)
 {
     BytecodeSite *site = current->trackedSite();
@@ -1135,17 +1137,17 @@ InterpretedFunctionFilenameAndLineNumber
 }
 
 static JSFunction *
 InterpretedFunctionFromTrackedType(const IonTrackedTypeWithAddendum &tracked)
 {
     if (tracked.hasConstructor())
         return tracked.constructor;
 
-    types::Type ty = tracked.type;
+    TypeSet::Type ty = tracked.type;
 
     if (ty.isSingleton()) {
         JSObject *obj = ty.singleton();
         return obj->is<JSFunction>() ? &obj->as<JSFunction>() : nullptr;
     }
 
     return ty.group()->maybeInterpretedFunction();
 }
@@ -1157,20 +1159,20 @@ class ForEachTypeInfoAdapter : public Io
     ForEachTrackedOptimizationTypeInfoOp &op_;
 
   public:
     explicit ForEachTypeInfoAdapter(ForEachTrackedOptimizationTypeInfoOp &op)
       : op_(op)
     { }
 
     void readType(const IonTrackedTypeWithAddendum &tracked) MOZ_OVERRIDE {
-        types::Type ty = tracked.type;
+        TypeSet::Type ty = tracked.type;
 
         if (ty.isPrimitive() || ty.isUnknown() || ty.isAnyObject()) {
-            op_.readType("primitive", types::NonObjectTypeString(ty), nullptr, 0);
+            op_.readType("primitive", TypeSet::NonObjectTypeString(ty), nullptr, 0);
             return;
         }
 
         char buf[512];
         const uint32_t bufsize = mozilla::ArrayLength(buf);
 
         if (JSFunction *fun = InterpretedFunctionFromTrackedType(tracked)) {
             PutEscapedString(buf, bufsize, fun->displayAtom(), 0);
--- a/js/src/jit/OptimizationTracking.h
+++ b/js/src/jit/OptimizationTracking.h
@@ -54,36 +54,36 @@ class OptimizationAttempt
 typedef Vector<OptimizationAttempt, 4, JitAllocPolicy> TempOptimizationAttemptsVector;
 
 class UniqueTrackedTypes;
 
 class OptimizationTypeInfo
 {
     JS::TrackedTypeSite site_;
     MIRType mirType_;
-    types::TypeSet::TypeList types_;
+    TypeSet::TypeList types_;
 
   public:
     OptimizationTypeInfo(OptimizationTypeInfo &&other)
       : site_(other.site_),
         mirType_(other.mirType_),
         types_(mozilla::Move(other.types_))
     { }
 
     OptimizationTypeInfo(JS::TrackedTypeSite site, MIRType mirType)
       : site_(site),
         mirType_(mirType)
     { }
 
-    bool trackTypeSet(types::TemporaryTypeSet *typeSet);
-    bool trackType(types::Type type);
+    bool trackTypeSet(TemporaryTypeSet *typeSet);
+    bool trackType(TypeSet::Type type);
 
     JS::TrackedTypeSite site() const { return site_; }
     MIRType mirType() const { return mirType_; }
-    const types::TypeSet::TypeList &types() const { return types_; }
+    const TypeSet::TypeList &types() const { return types_; }
 
     bool operator ==(const OptimizationTypeInfo &other) const;
     bool operator !=(const OptimizationTypeInfo &other) const;
 
     HashNumber hash() const;
 
     bool writeCompact(CompactBufferWriter &writer, UniqueTrackedTypes &uniqueTypes) const;
 };
@@ -416,17 +416,17 @@ class IonTrackedOptimizationsAttempts
         MOZ_ASSERT(start < end);
     }
 
     void forEach(JS::ForEachTrackedOptimizationAttemptOp &op);
 };
 
 struct IonTrackedTypeWithAddendum
 {
-    types::Type type;
+    TypeSet::Type type;
 
     enum HasAddendum {
         HasNothing,
         HasAllocationSite,
         HasConstructor
     };
     HasAddendum hasAddendum;
 
@@ -436,29 +436,29 @@ struct IonTrackedTypeWithAddendum
     union {
         struct {
             JSScript *script;
             uint32_t offset;
         };
         JSFunction *constructor;
     };
 
-    explicit IonTrackedTypeWithAddendum(types::Type type)
+    explicit IonTrackedTypeWithAddendum(TypeSet::Type type)
       : type(type),
         hasAddendum(HasNothing)
     { }
 
-    IonTrackedTypeWithAddendum(types::Type type, JSScript *script, uint32_t offset)
+    IonTrackedTypeWithAddendum(TypeSet::Type type, JSScript *script, uint32_t offset)
       : type(type),
         hasAddendum(HasAllocationSite),
         script(script),
         offset(offset)
     { }
 
-    IonTrackedTypeWithAddendum(types::Type type, JSFunction *constructor)
+    IonTrackedTypeWithAddendum(TypeSet::Type type, JSFunction *constructor)
       : type(type),
         hasAddendum(HasConstructor),
         constructor(constructor)
     { }
 
     bool hasAllocationSite() const { return hasAddendum == HasAllocationSite; }
     bool hasConstructor() const { return hasAddendum == HasConstructor; }
 };
@@ -477,17 +477,17 @@ class IonTrackedOptimizationsTypeInfo
         // Can be empty; i.e., no type info was tracked.
     }
 
     bool empty() const { return start_ == end_; }
 
     // Unlike IonTrackedOptimizationAttempts,
     // JS::ForEachTrackedOptimizaitonTypeInfoOp cannot be used directly. The
     // internal API needs to deal with engine-internal data structures (e.g.,
-    // types::Type) directly.
+    // TypeSet::Type) directly.
     struct ForEachOp
     {
         virtual void readType(const IonTrackedTypeWithAddendum &tracked) = 0;
         virtual void operator()(JS::TrackedTypeSite site, MIRType mirType) = 0;
     };
 
     void forEach(ForEachOp &op, const IonTrackedTypeVector *allTypes);
 };
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -94,17 +94,17 @@ InvokeFunction(JSContext *cx, HandleObje
     } else {
         if (!Invoke(cx, thisv, ObjectValue(*obj), argc, argvWithoutThis, &rv))
             return false;
     }
 
     if (obj->is<JSFunction>()) {
         jsbytecode *pc;
         RootedScript script(cx, cx->currentScript(&pc));
-        types::TypeScript::Monitor(cx, script, pc, rv.get());
+        TypeScript::Monitor(cx, script, pc, rv.get());
     }
 
     *rval = rv;
     return true;
 }
 
 JSObject *
 NewGCObject(JSContext *cx, gc::AllocKind allocKind, gc::InitialHeap initialHeap,
@@ -325,17 +325,17 @@ ArrayPopDense(JSContext *cx, HandleObjec
     argv[1].setObject(*obj);
     if (!js::array_pop(cx, 0, argv.begin()))
         return false;
 
     // If the result is |undefined|, the array was probably empty and we
     // have to monitor the return value.
     rval.set(argv[0]);
     if (rval.isUndefined())
-        types::TypeScript::Monitor(cx, rval);
+        TypeScript::Monitor(cx, rval);
     return true;
 }
 
 bool
 ArrayPushDense(JSContext *cx, HandleArrayObject obj, HandleValue v, uint32_t *length)
 {
     if (MOZ_LIKELY(obj->lengthIsWritable())) {
         uint32_t idx = obj->length();
@@ -375,17 +375,17 @@ ArrayShiftDense(JSContext *cx, HandleObj
     argv[1].setObject(*obj);
     if (!js::array_shift(cx, 0, argv.begin()))
         return false;
 
     // If the result is |undefined|, the array was probably empty and we
     // have to monitor the return value.
     rval.set(argv[0]);
     if (rval.isUndefined())
-        types::TypeScript::Monitor(cx, rval);
+        TypeScript::Monitor(cx, rval);
     return true;
 }
 
 JSObject *
 ArrayConcatDense(JSContext *cx, HandleObject obj1, HandleObject obj2, HandleObject objRes)
 {
     Rooted<ArrayObject*> arr1(cx, &obj1->as<ArrayObject>());
     Rooted<ArrayObject*> arr2(cx, &obj2->as<ArrayObject>());
@@ -578,17 +578,17 @@ GetIntrinsicValue(JSContext *cx, HandleP
     if (!GlobalObject::getIntrinsicValue(cx, cx->global(), name, rval))
         return false;
 
     // This function is called when we try to compile a cold getintrinsic
     // op. MCallGetIntrinsicValue has an AliasSet of None for optimization
     // purposes, as its side effect is not observable from JS. We are
     // guaranteed to bail out after this function, but because of its AliasSet,
     // type info will not be reflowed. Manually monitor here.
-    types::TypeScript::Monitor(cx, rval);
+    TypeScript::Monitor(cx, rval);
 
     return true;
 }
 
 bool
 CreateThis(JSContext *cx, HandleObject callee, MutableHandleValue rval)
 {
     rval.set(MagicValue(JS_IS_CONSTRUCTING));
--- a/js/src/jit/shared/CodeGenerator-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-shared.cpp
@@ -869,17 +869,17 @@ class ReadTempAttemptsVectorOp : public 
     void operator()(JS::TrackedStrategy strategy, JS::TrackedOutcome outcome) MOZ_OVERRIDE {
         MOZ_ALWAYS_TRUE(attempts_->append(OptimizationAttempt(strategy, outcome)));
     }
 };
 
 struct ReadTempTypeInfoVectorOp : public IonTrackedOptimizationsTypeInfo::ForEachOp
 {
     TempOptimizationTypeInfoVector *types_;
-    types::TypeSet::TypeList accTypes_;
+    TypeSet::TypeList accTypes_;
 
   public:
     explicit ReadTempTypeInfoVectorOp(TempOptimizationTypeInfoVector *types)
       : types_(types)
     { }
 
     void readType(const IonTrackedTypeWithAddendum &tracked) MOZ_OVERRIDE {
         MOZ_ALWAYS_TRUE(accTypes_.append(tracked.type));
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -92,17 +92,16 @@
 #include "jsscriptinlines.h"
 
 #include "vm/Interpreter-inl.h"
 #include "vm/NativeObject-inl.h"
 #include "vm/String-inl.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 
 using mozilla::Maybe;
 using mozilla::PodCopy;
 using mozilla::PodZero;
 using mozilla::UniquePtr;
 
 using JS::AutoGCRooter;
 using JS::ToInt32;
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -39,17 +39,16 @@
 #include "vm/ArgumentsObject-inl.h"
 #include "vm/ArrayObject-inl.h"
 #include "vm/Interpreter-inl.h"
 #include "vm/NativeObject-inl.h"
 #include "vm/Runtime-inl.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 
 using mozilla::Abs;
 using mozilla::ArrayLength;
 using mozilla::CeilingLog2;
 using mozilla::CheckedInt;
 using mozilla::DebugOnly;
 using mozilla::IsNaN;
 
@@ -1220,18 +1219,17 @@ InitArrayTypes(JSContext *cx, ObjectGrou
 
         HeapTypeSet *types = group->getProperty(cx, JSID_VOID);
         if (!types)
             return false;
 
         for (unsigned i = 0; i < count; i++) {
             if (vector[i].isMagic(JS_ELEMENTS_HOLE))
                 continue;
-            Type valtype = GetValueType(vector[i]);
-            types->addType(cx, valtype);
+            types->addType(cx, TypeSet::GetValueType(vector[i]));
         }
     }
     return true;
 }
 
 enum ShouldUpdateTypes
 {
     UpdateTypes = true,
--- a/js/src/jsbool.cpp
+++ b/js/src/jsbool.cpp
@@ -18,17 +18,16 @@
 
 #include "vm/GlobalObject.h"
 #include "vm/ProxyObject.h"
 #include "vm/StringBuffer.h"
 
 #include "vm/BooleanObject-inl.h"
 
 using namespace js;
-using namespace js::types;
 
 const Class BooleanObject::class_ = {
     "Boolean",
     JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean)
 };
 
 MOZ_ALWAYS_INLINE bool
 IsBoolean(HandleValue v)
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -248,17 +248,17 @@ js::DestroyContext(JSContext *cx, Destro
     cx->remove();
     bool last = !rt->hasContexts();
     if (last) {
         /*
          * Dump remaining type inference results while we still have a context.
          * This printing depends on atoms still existing.
          */
         for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next())
-            types::PrintTypes(cx, c, false);
+            PrintTypes(cx, c, false);
     }
     if (mode == DCM_FORCE_GC) {
         MOZ_ASSERT(!rt->isHeapBusy());
         JS::PrepareForFullGC(rt);
         rt->gc.gc(GC_NORMAL, JS::gcreason::DESTROY_CONTEXT);
     }
     js_delete_poison(cx);
 }
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -41,17 +41,16 @@
 #include "vm/GlobalObject.h"
 #include "vm/Interpreter.h"
 #include "vm/String.h"
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
 using namespace js;
-using namespace js::types;
 
 using mozilla::ArrayLength;
 using mozilla::IsFinite;
 using mozilla::IsNaN;
 
 using JS::AutoCheckCannotGC;
 using JS::GenericNaN;
 using JS::ToInteger;
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -32,17 +32,16 @@
 #include "vm/StringBuffer.h"
 
 #include "jsobjinlines.h"
 
 #include "vm/ErrorObject-inl.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 
 using mozilla::ArrayLength;
 using mozilla::PodArrayZero;
 
 static void
 exn_finalize(FreeOp *fop, JSObject *obj);
 
 bool
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -44,17 +44,16 @@
 
 #include "jsscriptinlines.h"
 
 #include "vm/Interpreter-inl.h"
 #include "vm/Stack-inl.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 using namespace js::frontend;
 
 using mozilla::ArrayLength;
 using mozilla::PodCopy;
 using mozilla::RangedPtr;
 
 static bool
 fun_enumerate(JSContext *cx, HandleObject obj)
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2213,17 +2213,17 @@ MovingTracer::Visit(JSTracer *jstrc, voi
 }
 
 void
 GCRuntime::sweepTypesAfterCompacting(Zone *zone)
 {
     FreeOp *fop = rt->defaultFreeOp();
     zone->beginSweepTypes(fop, rt->gc.releaseObservedTypes && !zone->isPreservingCode());
 
-    types::AutoClearTypeInferenceStateOnOOM oom(zone);
+    AutoClearTypeInferenceStateOnOOM oom(zone);
 
     for (ZoneCellIterUnderGC i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) {
         JSScript *script = i.get<JSScript>();
         script->maybeSweepTypes(&oom);
     }
 
     for (ZoneCellIterUnderGC i(zone, FINALIZE_OBJECT_GROUP); !i.done(); i.next()) {
         ObjectGroup *group = i.get<ObjectGroup>();
@@ -5186,23 +5186,23 @@ GCRuntime::drainMarkStack(SliceBudget &s
 static void
 SweepThing(Shape *shape)
 {
     if (!shape->isMarked())
         shape->sweep();
 }
 
 static void
-SweepThing(JSScript *script, types::AutoClearTypeInferenceStateOnOOM *oom)
+SweepThing(JSScript *script, AutoClearTypeInferenceStateOnOOM *oom)
 {
     script->maybeSweepTypes(oom);
 }
 
 static void
-SweepThing(ObjectGroup *group, types::AutoClearTypeInferenceStateOnOOM *oom)
+SweepThing(ObjectGroup *group, AutoClearTypeInferenceStateOnOOM *oom)
 {
     group->maybeSweep(oom);
 }
 
 template <typename T, typename... Args>
 static bool
 SweepArenaList(ArenaHeader **arenasToSweep, SliceBudget &sliceBudget, Args... args)
 {
@@ -5240,17 +5240,17 @@ GCRuntime::sweepPhase(SliceBudget &slice
         // to determine which things in the zone are live.
         if (sweepingTypes) {
             gcstats::AutoPhase ap1(stats, gcstats::PHASE_SWEEP_COMPARTMENTS);
             gcstats::AutoPhase ap2(stats, gcstats::PHASE_SWEEP_TYPES);
 
             for (; sweepZone; sweepZone = sweepZone->nextNodeInGroup()) {
                 ArenaLists &al = sweepZone->arenas;
 
-                types::AutoClearTypeInferenceStateOnOOM oom(sweepZone);
+                AutoClearTypeInferenceStateOnOOM oom(sweepZone);
 
                 if (!SweepArenaList<JSScript>(&al.gcScriptArenasToUpdate, sliceBudget, &oom))
                     return NotFinished;
 
                 if (!SweepArenaList<ObjectGroup>(
                         &al.gcObjectGroupArenasToUpdate, sliceBudget, &oom))
                 {
                     return NotFinished;
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -36,17 +36,16 @@
 #include "jsgcinlines.h"
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 
 #include "vm/NativeObject-inl.h"
 
 using namespace js;
 using namespace js::gc;
-using namespace js::types;
 
 using mozilla::DebugOnly;
 using mozilla::Maybe;
 using mozilla::PodArrayZero;
 using mozilla::PodCopy;
 using mozilla::PodZero;
 
 static inline jsid
@@ -71,17 +70,17 @@ id_constructor(JSContext *cx)
 
 static inline jsid
 id_caller(JSContext *cx)
 {
     return NameToId(cx->names().caller);
 }
 
 const char *
-types::TypeIdStringImpl(jsid id)
+js::TypeIdStringImpl(jsid id)
 {
     if (JSID_IS_VOID(id))
         return "(index)";
     if (JSID_IS_EMPTY(id))
         return "(new)";
     if (JSID_IS_SYMBOL(id))
         return "(symbol)";
     static char bufs[4][100];
@@ -92,18 +91,18 @@ types::TypeIdStringImpl(jsid id)
 }
 
 #endif
 
 /////////////////////////////////////////////////////////////////////
 // Logging
 /////////////////////////////////////////////////////////////////////
 
-const char *
-types::NonObjectTypeString(Type type)
+/* static */ const char *
+TypeSet::NonObjectTypeString(TypeSet::Type type)
 {
     if (type.isPrimitive()) {
         switch (type.primitive()) {
           case JSVAL_TYPE_UNDEFINED:
             return "void";
           case JSVAL_TYPE_NULL:
             return "null";
           case JSVAL_TYPE_BOOLEAN:
@@ -165,100 +164,100 @@ static bool InferSpewColorable()
             return false;
         if (strcmp(env, "xterm-color") == 0 || strcmp(env, "xterm-256color") == 0)
             colorable = true;
     }
     return colorable;
 }
 
 const char *
-types::InferSpewColorReset()
+js::InferSpewColorReset()
 {
     if (!InferSpewColorable())
         return "";
     return "\x1b[0m";
 }
 
 const char *
-types::InferSpewColor(TypeConstraint *constraint)
+js::InferSpewColor(TypeConstraint *constraint)
 {
     /* Type constraints are printed out using foreground colors. */
     static const char * const colors[] = { "\x1b[31m", "\x1b[32m", "\x1b[33m",
                                            "\x1b[34m", "\x1b[35m", "\x1b[36m",
                                            "\x1b[37m" };
     if (!InferSpewColorable())
         return "";
     return colors[DefaultHasher<TypeConstraint *>::hash(constraint) % 7];
 }
 
 const char *
-types::InferSpewColor(TypeSet *types)
+js::InferSpewColor(TypeSet *types)
 {
     /* Type sets are printed out using bold colors. */
     static const char * const colors[] = { "\x1b[1;31m", "\x1b[1;32m", "\x1b[1;33m",
                                            "\x1b[1;34m", "\x1b[1;35m", "\x1b[1;36m",
                                            "\x1b[1;37m" };
     if (!InferSpewColorable())
         return "";
     return colors[DefaultHasher<TypeSet *>::hash(types) % 7];
 }
 
-const char *
-types::TypeString(Type type)
+/* static */ const char *
+TypeSet::TypeString(TypeSet::Type type)
 {
     if (type.isPrimitive() || type.isUnknown() || type.isAnyObject())
         return NonObjectTypeString(type);
 
     static char bufs[4][40];
     static unsigned which = 0;
     which = (which + 1) & 3;
 
     if (type.isSingleton())
         JS_snprintf(bufs[which], 40, "<0x%p>", (void *) type.singleton());
     else
         JS_snprintf(bufs[which], 40, "[0x%p]", (void *) type.group());
 
     return bufs[which];
 }
 
-const char *
-types::ObjectGroupString(ObjectGroup *group)
+/* static */ const char *
+TypeSet::ObjectGroupString(ObjectGroup *group)
 {
-    return TypeString(Type::ObjectType(group));
+    return TypeString(TypeSet::ObjectType(group));
 }
 
 void
-types::InferSpew(SpewChannel channel, const char *fmt, ...)
+js::InferSpew(SpewChannel channel, const char *fmt, ...)
 {
     if (!InferSpewActive(channel))
         return;
 
     va_list ap;
     va_start(ap, fmt);
     fprintf(stderr, "[infer] ");
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
     va_end(ap);
 }
 
 bool
-types::TypeHasProperty(JSContext *cx, ObjectGroup *group, jsid id, const Value &value)
+js::ObjectGroupHasProperty(JSContext *cx, ObjectGroup *group, jsid id, const Value &value)
 {
     /*
      * Check the correctness of the type information in the object's property
      * against an actual value.
      */
     if (!group->unknownProperties() && !value.isUndefined()) {
         id = IdToTypeId(id);
 
         /* Watch for properties which inference does not monitor. */
         if (id == id___proto__(cx) || id == id_constructor(cx) || id == id_caller(cx))
             return true;
 
-        Type type = GetValueType(value);
+        TypeSet::Type type = TypeSet::GetValueType(value);
 
         // Type set guards might miss when an object's group changes and its
         // properties become unknown.
         if (value.isObject() &&
             !value.toObject().hasLazyGroup() &&
             value.toObject().group()->flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES)
         {
             return true;
@@ -272,26 +271,27 @@ types::TypeHasProperty(JSContext *cx, Ob
          * Don't do the property instantiation now.
          */
         TypeSet *types = group->maybeGetProperty(id);
         if (!types)
             return true;
 
         if (!types->hasType(type)) {
             TypeFailure(cx, "Missing type in object %s %s: %s",
-                        ObjectGroupString(group), TypeIdString(id), TypeString(type));
+                        TypeSet::ObjectGroupString(group), TypeIdString(id),
+                        TypeSet::TypeString(type));
         }
     }
     return true;
 }
 
 #endif
 
 void
-types::TypeFailure(JSContext *cx, const char *fmt, ...)
+js::TypeFailure(JSContext *cx, const char *fmt, ...)
 {
     char msgbuf[1024]; /* Larger error messages will be truncated */
     char errbuf[1024];
 
     va_list ap;
     va_start(ap, fmt);
     JS_vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
     va_end(ap);
@@ -318,22 +318,22 @@ TemporaryTypeSet::TemporaryTypeSet(LifoA
         if (flags == TYPE_FLAG_DOUBLE)
             flags |= TYPE_FLAG_INT32;
     } else if (type.isAnyObject()) {
         flags |= TYPE_FLAG_ANYOBJECT;
     } else  if (type.isGroup() && type.group()->unknownProperties()) {
         flags |= TYPE_FLAG_ANYOBJECT;
     } else {
         setBaseObjectCount(1);
-        objectSet = reinterpret_cast<TypeSetObjectKey**>(type.objectKey());
+        objectSet = reinterpret_cast<ObjectKey**>(type.objectKey());
 
         if (type.isGroup()) {
             ObjectGroup *ngroup = type.group();
             if (ngroup->newScript() && ngroup->newScript()->initializedGroup())
-                addType(Type::ObjectType(ngroup->newScript()->initializedGroup()), alloc);
+                addType(ObjectType(ngroup->newScript()->initializedGroup()), alloc);
         }
     }
 }
 
 bool
 TypeSet::mightBeMIRType(jit::MIRType type)
 {
     if (unknown())
@@ -382,73 +382,73 @@ TypeSet::objectsAreSubset(TypeSet *other
 {
     if (other->unknownObject())
         return true;
 
     if (unknownObject())
         return false;
 
     for (unsigned i = 0; i < getObjectCount(); i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (!key)
             continue;
-        if (!other->hasType(Type::ObjectType(key)))
+        if (!other->hasType(ObjectType(key)))
             return false;
     }
 
     return true;
 }
 
 bool
 TypeSet::isSubset(const TypeSet *other) const
 {
     if ((baseFlags() & other->baseFlags()) != baseFlags())
         return false;
 
     if (unknownObject()) {
         MOZ_ASSERT(other->unknownObject());
     } else {
         for (unsigned i = 0; i < getObjectCount(); i++) {
-            TypeSetObjectKey *key = getObject(i);
+            ObjectKey *key = getObject(i);
             if (!key)
                 continue;
-            if (!other->hasType(Type::ObjectType(key)))
+            if (!other->hasType(ObjectType(key)))
                 return false;
         }
     }
 
     return true;
 }
 
 bool
 TypeSet::enumerateTypes(TypeList *list) const
 {
     /* If any type is possible, there's no need to worry about specifics. */
     if (flags & TYPE_FLAG_UNKNOWN)
-        return list->append(Type::UnknownType());
+        return list->append(UnknownType());
 
     /* Enqueue type set members stored as bits. */
     for (TypeFlags flag = 1; flag < TYPE_FLAG_ANYOBJECT; flag <<= 1) {
         if (flags & flag) {
-            Type type = Type::PrimitiveType(TypeFlagPrimitive(flag));
+            Type type = PrimitiveType(TypeFlagPrimitive(flag));
             if (!list->append(type))
                 return false;
         }
     }
 
     /* If any object is possible, skip specifics. */
     if (flags & TYPE_FLAG_ANYOBJECT)
-        return list->append(Type::AnyObjectType());
+        return list->append(AnyObjectType());
 
     /* Enqueue specific object types. */
     unsigned count = getObjectCount();
     for (unsigned i = 0; i < count; i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (key) {
-            if (!list->append(Type::ObjectType(key)))
+            if (!list->append(ObjectType(key)))
                 return false;
         }
     }
 
     return true;
 }
 
 inline bool
@@ -527,19 +527,19 @@ TypeSet::addType(Type type, LifoAlloc *a
 
     if (flags & TYPE_FLAG_ANYOBJECT)
         return;
     if (type.isAnyObject())
         goto unknownObject;
 
     {
         uint32_t objectCount = baseObjectCount();
-        TypeSetObjectKey *key = type.objectKey();
-        TypeSetObjectKey **pentry = HashSetInsert<TypeSetObjectKey *,TypeSetObjectKey,TypeSetObjectKey>
-                                     (*alloc, objectSet, objectCount, key);
+        ObjectKey *key = type.objectKey();
+        ObjectKey **pentry = TypeHashSet::Insert<ObjectKey *, ObjectKey, ObjectKey>
+                                 (*alloc, objectSet, objectCount, key);
         if (!pentry)
             goto unknownObject;
         if (*pentry)
             return;
         *pentry = key;
 
         setBaseObjectCount(objectCount);
 
@@ -574,17 +574,17 @@ TypeSet::addType(Type type, LifoAlloc *a
         MOZ_ASSERT(!ngroup->singleton());
         if (ngroup->unknownProperties())
             goto unknownObject;
 
         // If we add a partially initialized group to a type set, add the
         // corresponding fully initialized group, as an object's group may change
         // from the former to the latter via the acquired properties analysis.
         if (ngroup->newScript() && ngroup->newScript()->initializedGroup())
-            addType(Type::ObjectType(ngroup->newScript()->initializedGroup()), alloc);
+            addType(ObjectType(ngroup->newScript()->initializedGroup()), alloc);
     }
 
     if (false) {
     unknownObject:
         flags |= TYPE_FLAG_ANYOBJECT;
         clearObjects();
     }
 }
@@ -595,17 +595,17 @@ ConstraintTypeSet::addType(ExclusiveCont
     MOZ_ASSERT(cxArg->zone()->types.activeAnalysis);
 
     if (hasType(type))
         return;
 
     TypeSet::addType(type, &cxArg->typeLifoAlloc());
 
     if (type.isObjectUnchecked() && unknownObject())
-        type = Type::AnyObjectType();
+        type = AnyObjectType();
 
     InferSpew(ISpewOps, "addType: %sT%p%s %s",
               InferSpewColor(this), this, InferSpewColorReset(),
               TypeString(type));
 
     /* Propagate the type to all constraints. */
     if (JSContext *cx = cxArg->maybeJSContext()) {
         TypeConstraint *constraint = constraintList;
@@ -658,50 +658,50 @@ TypeSet::print()
         fprintf(stderr, " lazyargs");
 
     uint32_t objectCount = baseObjectCount();
     if (objectCount) {
         fprintf(stderr, " object[%u]", objectCount);
 
         unsigned count = getObjectCount();
         for (unsigned i = 0; i < count; i++) {
-            TypeSetObjectKey *key = getObject(i);
+            ObjectKey *key = getObject(i);
             if (key)
-                fprintf(stderr, " %s", TypeString(Type::ObjectType(key)));
+                fprintf(stderr, " %s", TypeString(ObjectType(key)));
         }
     }
 }
 
 /* static */ void
 TypeSet::readBarrier(const TypeSet *types)
 {
     if (types->unknownObject())
         return;
 
     for (unsigned i = 0; i < types->getObjectCount(); i++) {
-        if (TypeSetObjectKey *key = types->getObject(i)) {
+        if (ObjectKey *key = types->getObject(i)) {
             if (key->isSingleton())
                 (void) key->singleton();
             else
                 (void) key->group();
         }
     }
 }
 
 bool
 TypeSet::clone(LifoAlloc *alloc, TemporaryTypeSet *result) const
 {
     MOZ_ASSERT(result->empty());
 
     unsigned objectCount = baseObjectCount();
-    unsigned capacity = (objectCount >= 2) ? HashSetCapacity(objectCount) : 0;
-
-    TypeSetObjectKey **newSet;
+    unsigned capacity = (objectCount >= 2) ? TypeHashSet::Capacity(objectCount) : 0;
+
+    ObjectKey **newSet;
     if (capacity) {
-        newSet = alloc->newArray<TypeSetObjectKey*>(capacity);
+        newSet = alloc->newArray<ObjectKey*>(capacity);
         if (!newSet)
             return false;
         PodCopy(newSet, objectSet, capacity);
     }
 
     new(result) TemporaryTypeSet(flags, capacity ? newSet : objectSet);
     return true;
 }
@@ -754,74 +754,74 @@ TypeSet::cloneWithoutObjects(LifoAlloc *
     res->setBaseObjectCount(0);
     return res;
 }
 
 /* static */ TemporaryTypeSet *
 TypeSet::unionSets(TypeSet *a, TypeSet *b, LifoAlloc *alloc)
 {
     TemporaryTypeSet *res = alloc->new_<TemporaryTypeSet>(a->baseFlags() | b->baseFlags(),
-                                                          static_cast<TypeSetObjectKey**>(nullptr));
+                                                          static_cast<ObjectKey**>(nullptr));
     if (!res)
         return nullptr;
 
     if (!res->unknownObject()) {
         for (size_t i = 0; i < a->getObjectCount() && !res->unknownObject(); i++) {
-            if (TypeSetObjectKey *key = a->getObject(i))
-                res->addType(Type::ObjectType(key), alloc);
+            if (ObjectKey *key = a->getObject(i))
+                res->addType(ObjectType(key), alloc);
         }
         for (size_t i = 0; i < b->getObjectCount() && !res->unknownObject(); i++) {
-            if (TypeSetObjectKey *key = b->getObject(i))
-                res->addType(Type::ObjectType(key), alloc);
+            if (ObjectKey *key = b->getObject(i))
+                res->addType(ObjectType(key), alloc);
         }
     }
 
     return res;
 }
 
 /* static */ TemporaryTypeSet *
 TypeSet::intersectSets(TemporaryTypeSet *a, TemporaryTypeSet *b, LifoAlloc *alloc)
 {
     TemporaryTypeSet *res;
     res = alloc->new_<TemporaryTypeSet>(a->baseFlags() & b->baseFlags(),
-                static_cast<TypeSetObjectKey**>(nullptr));
+                                        static_cast<ObjectKey**>(nullptr));
     if (!res)
         return nullptr;
 
     res->setBaseObjectCount(0);
     if (res->unknownObject())
         return res;
 
     MOZ_ASSERT(!a->unknownObject() || !b->unknownObject());
 
     if (a->unknownObject()) {
         for (size_t i = 0; i < b->getObjectCount(); i++) {
             if (b->getObject(i))
-                res->addType(Type::ObjectType(b->getObject(i)), alloc);
+                res->addType(ObjectType(b->getObject(i)), alloc);
         }
         return res;
     }
 
     if (b->unknownObject()) {
         for (size_t i = 0; i < a->getObjectCount(); i++) {
             if (b->getObject(i))
-                res->addType(Type::ObjectType(a->getObject(i)), alloc);
+                res->addType(ObjectType(a->getObject(i)), alloc);
         }
         return res;
     }
 
     MOZ_ASSERT(!a->unknownObject() && !b->unknownObject());
 
     for (size_t i = 0; i < a->getObjectCount(); i++) {
         for (size_t j = 0; j < b->getObjectCount(); j++) {
             if (b->getObject(j) != a->getObject(i))
                 continue;
             if (!b->getObject(j))
                 continue;
-            res->addType(Type::ObjectType(b->getObject(j)), alloc);
+            res->addType(ObjectType(b->getObject(j)), alloc);
             break;
         }
     }
 
     return res;
 }
 
 /////////////////////////////////////////////////////////////////////
@@ -864,17 +864,17 @@ class CompilerConstraint
         expected(property.maybeTypes() ? property.maybeTypes()->clone(alloc) : nullptr)
     {}
 
     // Generate the type constraint recording the assumption made by this
     // compilation. Returns true if the assumption originally made still holds.
     virtual bool generateTypeConstraint(JSContext *cx, RecompileInfo recompileInfo) = 0;
 };
 
-class types::CompilerConstraintList
+class js::CompilerConstraintList
 {
   public:
     struct FrozenScript
     {
         JSScript *script;
         TemporaryTypeSet *thisTypes;
         TemporaryTypeSet *argTypes;
         TemporaryTypeSet *bytecodeTypes;
@@ -944,17 +944,17 @@ class types::CompilerConstraintList
         failed_ = true;
     }
     LifoAlloc *alloc() const {
         return alloc_;
     }
 };
 
 CompilerConstraintList *
-types::NewCompilerConstraintList(jit::TempAllocator &alloc)
+js::NewCompilerConstraintList(jit::TempAllocator &alloc)
 {
     return alloc.lifoAlloc()->new_<CompilerConstraintList>(alloc);
 }
 
 /* static */ bool
 TypeScript::FreezeTypeSets(CompilerConstraintList *constraints, JSScript *script,
                            TemporaryTypeSet **pThisTypes,
                            TemporaryTypeSet **pArgTypes,
@@ -1010,17 +1010,17 @@ class TypeCompilerConstraint : public Ty
 
   public:
     TypeCompilerConstraint<T>(RecompileInfo compilation, const T &data)
       : compilation(compilation), data(data)
     {}
 
     const char *kind() { return data.kind(); }
 
-    void newType(JSContext *cx, TypeSet *source, Type type) {
+    void newType(JSContext *cx, TypeSet *source, TypeSet::Type type) {
         if (data.invalidateOnNewType(type))
             cx->zone()->types.addPendingRecompile(cx, compilation);
     }
 
     void newPropertyState(JSContext *cx, TypeSet *source) {
         if (data.invalidateOnNewPropertyState(source))
             cx->zone()->types.addPendingRecompile(cx, compilation);
     }
@@ -1056,69 +1056,69 @@ CompilerConstraintInstance<T>::generateT
 
     return property.maybeTypes()->addConstraint(cx, cx->typeLifoAlloc().new_<TypeCompilerConstraint<T> >(recompileInfo, data),
                                                 /* callExisting = */ false);
 }
 
 } /* anonymous namespace */
 
 const Class *
-TypeSetObjectKey::clasp()
+TypeSet::ObjectKey::clasp()
 {
     return isGroup() ? group()->clasp() : singleton()->getClass();
 }
 
 TaggedProto
-TypeSetObjectKey::proto()
+TypeSet::ObjectKey::proto()
 {
     return isGroup() ? group()->proto() : singleton()->getTaggedProto();
 }
 
 TypeNewScript *
-TypeSetObjectKey::newScript()
+TypeSet::ObjectKey::newScript()
 {
     if (isGroup() && group()->newScript())
         return group()->newScript();
     return nullptr;
 }
 
 ObjectGroup *
-TypeSetObjectKey::maybeGroup()
+TypeSet::ObjectKey::maybeGroup()
 {
     if (isGroup())
         return group();
     if (!singleton()->hasLazyGroup())
         return singleton()->group();
     return nullptr;
 }
 
 bool
-TypeSetObjectKey::unknownProperties()
+TypeSet::ObjectKey::unknownProperties()
 {
     if (ObjectGroup *group = maybeGroup())
         return group->unknownProperties();
     return false;
 }
 
 HeapTypeSetKey
-TypeSetObjectKey::property(jsid id)
+TypeSet::ObjectKey::property(jsid id)
 {
     MOZ_ASSERT(!unknownProperties());
 
     HeapTypeSetKey property;
     property.object_ = this;
     property.id_ = id;
     if (ObjectGroup *group = maybeGroup())
         property.maybeTypes_ = group->maybeGetProperty(id);
 
     return property;
 }
 
 void
-TypeSetObjectKey::ensureTrackedProperty(JSContext *cx, jsid id)
+TypeSet::ObjectKey::ensureTrackedProperty(JSContext *cx, jsid id)
 {
     // If we are accessing a lazily defined property which actually exists in
     // the VM and has not been instantiated yet, instantiate it now if we are
     // on the main thread and able to do so.
     if (!JSID_IS_VOID(id) && !JSID_IS_EMPTY(id)) {
         MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
         if (isSingleton()) {
             JSObject *obj = singleton();
@@ -1177,17 +1177,17 @@ class TypeConstraintFreezeStack : public
 
   public:
     explicit TypeConstraintFreezeStack(JSScript *script)
         : script_(script)
     {}
 
     const char *kind() { return "freezeStack"; }
 
-    void newType(JSContext *cx, TypeSet *source, Type type) {
+    void newType(JSContext *cx, TypeSet *source, TypeSet::Type type) {
         /*
          * Unlike TypeConstraintFreeze, triggering this constraint once does
          * not disable it on future changes to the type set.
          */
         cx->zone()->types.addPendingRecompile(cx, script_);
     }
 
     bool sweep(TypeZone &zone, TypeConstraint **res) {
@@ -1196,17 +1196,17 @@ class TypeConstraintFreezeStack : public
         *res = zone.typeLifoAlloc.new_<TypeConstraintFreezeStack>(script_);
         return true;
     }
 };
 
 } /* anonymous namespace */
 
 bool
-types::FinishCompilation(JSContext *cx, HandleScript script, CompilerConstraintList *constraints,
+js::FinishCompilation(JSContext *cx, HandleScript script, CompilerConstraintList *constraints,
                          RecompileInfo *precompileInfo)
 {
     if (constraints->failed())
         return false;
 
     CompilerOutput co(script);
 
     TypeZone &types = cx->zone()->types;
@@ -1249,23 +1249,23 @@ types::FinishCompilation(JSContext *cx, 
         // It could happen that one of the compiled scripts was made a
         // debuggee mid-compilation (e.g., via setting a breakpoint). If so,
         // throw away the compilation.
         if (entry.script->isDebuggee()) {
             succeeded = false;
             break;
         }
 
-        if (!CheckFrozenTypeSet(cx, entry.thisTypes, types::TypeScript::ThisTypes(entry.script)))
+        if (!CheckFrozenTypeSet(cx, entry.thisTypes, TypeScript::ThisTypes(entry.script)))
             succeeded = false;
         unsigned nargs = entry.script->functionNonDelazifying()
                          ? entry.script->functionNonDelazifying()->nargs()
                          : 0;
         for (size_t i = 0; i < nargs; i++) {
-            if (!CheckFrozenTypeSet(cx, &entry.argTypes[i], types::TypeScript::ArgTypes(entry.script, i)))
+            if (!CheckFrozenTypeSet(cx, &entry.argTypes[i], TypeScript::ArgTypes(entry.script, i)))
                 succeeded = false;
         }
         for (size_t i = 0; i < entry.script->nTypeSets(); i++) {
             if (!CheckFrozenTypeSet(cx, &entry.bytecodeTypes[i], &entry.script->types()->typeArray()[i]))
                 succeeded = false;
         }
 
         // If necessary, add constraints to trigger invalidation on the script
@@ -1305,17 +1305,17 @@ CheckDefinitePropertiesTypeSet(JSContext
         frozen->enumerateTypes(&list);
 
         for (size_t i = 0; i < list.length(); i++)
             actual->addType(cx, list[i]);
     }
 }
 
 void
-types::FinishDefinitePropertiesAnalysis(JSContext *cx, CompilerConstraintList *constraints)
+js::FinishDefinitePropertiesAnalysis(JSContext *cx, CompilerConstraintList *constraints)
 {
 #ifdef DEBUG
     // Assert no new types have been added to the StackTypeSets. Do this before
     // calling CheckDefinitePropertiesTypeSet, as it may add new types to the
     // StackTypeSets and break these invariants if a script is inlined more
     // than once. See also CheckDefinitePropertiesTypeSet.
     for (size_t i = 0; i < constraints->numFrozenScripts(); i++) {
         const CompilerConstraintList::FrozenScript &entry = constraints->frozenScript(i);
@@ -1359,17 +1359,17 @@ namespace {
 // Constraint which triggers recompilation of a script if any type is added to a type set. */
 class ConstraintDataFreeze
 {
   public:
     ConstraintDataFreeze() {}
 
     const char *kind() { return "freeze"; }
 
-    bool invalidateOnNewType(Type type) { return true; }
+    bool invalidateOnNewType(TypeSet::Type type) { return true; }
     bool invalidateOnNewPropertyState(TypeSet *property) { return true; }
     bool invalidateOnNewObjectState(ObjectGroup *group) { return false; }
 
     bool constraintHolds(JSContext *cx,
                          const HeapTypeSetKey &property, TemporaryTypeSet *expected)
     {
         return expected
                ? property.maybeTypes()->isSubset(expected)
@@ -1554,17 +1554,17 @@ class ConstraintDataFreezeObjectFlags
     explicit ConstraintDataFreezeObjectFlags(ObjectGroupFlags flags)
       : flags(flags)
     {
         MOZ_ASSERT(flags);
     }
 
     const char *kind() { return "freezeObjectFlags"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) { return false; }
     bool invalidateOnNewObjectState(ObjectGroup *group) {
         return group->hasAnyFlags(flags);
     }
 
     bool constraintHolds(JSContext *cx,
                          const HeapTypeSetKey &property, TemporaryTypeSet *expected)
     {
@@ -1572,17 +1572,17 @@ class ConstraintDataFreezeObjectFlags
     }
 
     bool shouldSweep() { return false; }
 };
 
 } /* anonymous namespace */
 
 bool
-TypeSetObjectKey::hasFlags(CompilerConstraintList *constraints, ObjectGroupFlags flags)
+TypeSet::ObjectKey::hasFlags(CompilerConstraintList *constraints, ObjectGroupFlags flags)
 {
     MOZ_ASSERT(flags);
 
     if (ObjectGroup *group = maybeGroup()) {
         if (group->hasAnyFlags(flags))
             return true;
     }
 
@@ -1590,17 +1590,17 @@ TypeSetObjectKey::hasFlags(CompilerConst
     LifoAlloc *alloc = constraints->alloc();
 
     typedef CompilerConstraintInstance<ConstraintDataFreezeObjectFlags> T;
     constraints->add(alloc->new_<T>(alloc, objectProperty, ConstraintDataFreezeObjectFlags(flags)));
     return false;
 }
 
 bool
-TypeSetObjectKey::hasStableClassAndProto(CompilerConstraintList *constraints)
+TypeSet::ObjectKey::hasStableClassAndProto(CompilerConstraintList *constraints)
 {
     return !hasFlags(constraints, OBJECT_FLAG_UNKNOWN_PROPERTIES);
 }
 
 bool
 TemporaryTypeSet::hasObjectFlags(CompilerConstraintList *constraints, ObjectGroupFlags flags)
 {
     if (unknownObject())
@@ -1610,17 +1610,17 @@ TemporaryTypeSet::hasObjectFlags(Compile
      * Treat type sets containing no objects as having all object flags,
      * to spare callers from having to check this.
      */
     if (baseObjectCount() == 0)
         return true;
 
     unsigned count = getObjectCount();
     for (unsigned i = 0; i < count; i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (key && key->hasFlags(constraints, flags))
             return true;
     }
 
     return false;
 }
 
 gc::InitialHeap
@@ -1631,17 +1631,17 @@ ObjectGroup::initialHeap(CompilerConstra
     // changes.
 
     if (shouldPreTenure())
         return gc::TenuredHeap;
 
     if (!canPreTenure())
         return gc::DefaultHeap;
 
-    HeapTypeSetKey objectProperty = TypeSetObjectKey::get(this)->property(JSID_EMPTY);
+    HeapTypeSetKey objectProperty = TypeSet::ObjectKey::get(this)->property(JSID_EMPTY);
     LifoAlloc *alloc = constraints->alloc();
 
     typedef CompilerConstraintInstance<ConstraintDataFreezeObjectFlags> T;
     constraints->add(alloc->new_<T>(alloc, objectProperty, ConstraintDataFreezeObjectFlags(OBJECT_FLAG_PRE_TENURE)));
 
     return gc::DefaultHeap;
 }
 
@@ -1654,17 +1654,17 @@ namespace {
 class ConstraintDataFreezeObjectForInlinedCall
 {
   public:
     ConstraintDataFreezeObjectForInlinedCall()
     {}
 
     const char *kind() { return "freezeObjectForInlinedCall"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) { return false; }
     bool invalidateOnNewObjectState(ObjectGroup *group) {
         // We don't keep track of the exact dependencies the caller has on its
         // inlined scripts' type sets, so always invalidate the caller.
         return true;
     }
 
     bool constraintHolds(JSContext *cx,
@@ -1686,17 +1686,17 @@ class ConstraintDataFreezeObjectForTyped
   public:
     explicit ConstraintDataFreezeObjectForTypedArrayData(TypedArrayObject &tarray)
       : viewData(tarray.viewData()),
         length(tarray.length())
     {}
 
     const char *kind() { return "freezeObjectForTypedArrayData"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) { return false; }
     bool invalidateOnNewObjectState(ObjectGroup *group) {
         TypedArrayObject &tarray = group->singleton()->as<TypedArrayObject>();
         return tarray.viewData() != viewData || tarray.length() != length;
     }
 
     bool constraintHolds(JSContext *cx,
                          const HeapTypeSetKey &property, TemporaryTypeSet *expected)
@@ -1708,27 +1708,27 @@ class ConstraintDataFreezeObjectForTyped
         // Note: |viewData| is only used for equality testing.
         return false;
     }
 };
 
 } /* anonymous namespace */
 
 void
-TypeSetObjectKey::watchStateChangeForInlinedCall(CompilerConstraintList *constraints)
+TypeSet::ObjectKey::watchStateChangeForInlinedCall(CompilerConstraintList *constraints)
 {
     HeapTypeSetKey objectProperty = property(JSID_EMPTY);
     LifoAlloc *alloc = constraints->alloc();
 
     typedef CompilerConstraintInstance<ConstraintDataFreezeObjectForInlinedCall> T;
     constraints->add(alloc->new_<T>(alloc, objectProperty, ConstraintDataFreezeObjectForInlinedCall()));
 }
 
 void
-TypeSetObjectKey::watchStateChangeForTypedArrayData(CompilerConstraintList *constraints)
+TypeSet::ObjectKey::watchStateChangeForTypedArrayData(CompilerConstraintList *constraints)
 {
     TypedArrayObject &tarray = singleton()->as<TypedArrayObject>();
     HeapTypeSetKey objectProperty = property(JSID_EMPTY);
     LifoAlloc *alloc = constraints->alloc();
 
     typedef CompilerConstraintInstance<ConstraintDataFreezeObjectForTypedArrayData> T;
     constraints->add(alloc->new_<T>(alloc, objectProperty,
                                     ConstraintDataFreezeObjectForTypedArrayData(tarray)));
@@ -1771,17 +1771,17 @@ class ConstraintDataFreezePropertyState
     } which;
 
     explicit ConstraintDataFreezePropertyState(Which which)
       : which(which)
     {}
 
     const char *kind() { return (which == NON_DATA) ? "freezeNonDataProperty" : "freezeNonWritableProperty"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) {
         return (which == NON_DATA)
                ? property->nonDataProperty()
                : property->nonWritableProperty();
     }
     bool invalidateOnNewObjectState(ObjectGroup *group) { return false; }
 
     bool constraintHolds(JSContext *cx,
@@ -1827,17 +1827,17 @@ namespace {
 
 class ConstraintDataConstantProperty
 {
   public:
     explicit ConstraintDataConstantProperty() {}
 
     const char *kind() { return "constantProperty"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) {
         return property->nonConstantProperty();
     }
     bool invalidateOnNewObjectState(ObjectGroup *group) { return false; }
 
     bool constraintHolds(JSContext *cx,
                          const HeapTypeSetKey &property, TemporaryTypeSet *expected)
     {
@@ -1889,17 +1889,17 @@ HeapTypeSetKey::constant(CompilerConstra
 // A constraint that never triggers recompilation.
 class ConstraintDataInert
 {
   public:
     explicit ConstraintDataInert() {}
 
     const char *kind() { return "inert"; }
 
-    bool invalidateOnNewType(Type type) { return false; }
+    bool invalidateOnNewType(TypeSet::Type type) { return false; }
     bool invalidateOnNewPropertyState(TypeSet *property) { return false; }
     bool invalidateOnNewObjectState(ObjectGroup *group) { return false; }
 
     bool constraintHolds(JSContext *cx,
                          const HeapTypeSetKey &property, TemporaryTypeSet *expected)
     {
         return true;
     }
@@ -1932,28 +1932,28 @@ HeapTypeSetKey::couldBeConstant(Compiler
 
 bool
 TemporaryTypeSet::filtersType(const TemporaryTypeSet *other, Type filteredType) const
 {
     if (other->unknown())
         return unknown();
 
     for (TypeFlags flag = 1; flag < TYPE_FLAG_ANYOBJECT; flag <<= 1) {
-        Type type = Type::PrimitiveType(TypeFlagPrimitive(flag));
+        Type type = PrimitiveType(TypeFlagPrimitive(flag));
         if (type != filteredType && other->hasType(type) && !hasType(type))
             return false;
     }
 
     if (other->unknownObject())
         return unknownObject();
 
     for (size_t i = 0; i < other->getObjectCount(); i++) {
-        TypeSetObjectKey *key = other->getObject(i);
+        ObjectKey *key = other->getObject(i);
         if (key) {
-            Type type = Type::ObjectType(key);
+            Type type = ObjectType(key);
             if (type != filteredType && !hasType(type))
                 return false;
         }
     }
 
     return true;
 }
 
@@ -1963,34 +1963,34 @@ TemporaryTypeSet::convertDoubleElements(
     if (unknownObject() || !getObjectCount())
         return AmbiguousDoubleConversion;
 
     bool alwaysConvert = true;
     bool maybeConvert = false;
     bool dontConvert = false;
 
     for (unsigned i = 0; i < getObjectCount(); i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties()) {
             alwaysConvert = false;
             continue;
         }
 
         HeapTypeSetKey property = key->property(JSID_VOID);
         property.freeze(constraints);
 
         // We can't convert to double elements for objects which do not have
         // double in their element types (as the conversion may render the type
         // information incorrect), nor for non-array objects (as their elements
         // may point to emptyObjectElements, which cannot be converted).
         if (!property.maybeTypes() ||
-            !property.maybeTypes()->hasType(Type::DoubleType()) ||
+            !property.maybeTypes()->hasType(DoubleType()) ||
             key->clasp() != &ArrayObject::class_)
         {
             dontConvert = true;
             alwaysConvert = false;
             continue;
         }
 
         // Only bother with converting known packed arrays whose possible
@@ -2035,17 +2035,17 @@ TemporaryTypeSet::getKnownClass(Compiler
 
         if (clasp && clasp != nclasp)
             return nullptr;
         clasp = nclasp;
     }
 
     if (clasp) {
         for (unsigned i = 0; i < count; i++) {
-            TypeSetObjectKey *key = getObject(i);
+            ObjectKey *key = getObject(i);
             if (key && !key->hasStableClassAndProto(constraints))
                 return nullptr;
         }
     }
 
     return clasp;
 }
 
@@ -2177,17 +2177,17 @@ TemporaryTypeSet::getCommonPrototype(Com
 {
     if (unknownObject())
         return nullptr;
 
     JSObject *proto = nullptr;
     unsigned count = getObjectCount();
 
     for (unsigned i = 0; i < count; i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties())
             return nullptr;
 
         TaggedProto nproto = key->proto();
         if (proto) {
@@ -2197,32 +2197,32 @@ TemporaryTypeSet::getCommonPrototype(Com
             if (!nproto.isObject())
                 return nullptr;
             proto = nproto.toObject();
         }
     }
 
     // Guard against mutating __proto__.
     for (unsigned i = 0; i < count; i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (key)
             JS_ALWAYS_TRUE(key->hasStableClassAndProto(constraints));
     }
 
     return proto;
 }
 
 bool
 TemporaryTypeSet::propertyNeedsBarrier(CompilerConstraintList *constraints, jsid id)
 {
     if (unknownObject())
         return true;
 
     for (unsigned i = 0; i < getObjectCount(); i++) {
-        TypeSetObjectKey *key = getObject(i);
+        ObjectKey *key = getObject(i);
         if (!key)
             continue;
 
         if (key->unknownProperties())
             return true;
 
         HeapTypeSetKey property = key->property(id);
         if (property.needsBarrier(constraints))
@@ -2236,45 +2236,45 @@ static inline bool
 ClassCanHaveExtraProperties(const Class *clasp)
 {
     return clasp->resolve
         || clasp->ops.lookupProperty
         || clasp->ops.getProperty
         || IsAnyTypedArrayClass(clasp);
 }
 
-static inline bool
+static bool
 PrototypeHasIndexedProperty(CompilerConstraintList *constraints, JSObject *obj)
 {
     do {
-        TypeSetObjectKey *key = TypeSetObjectKey::get(obj);
+        TypeSet::ObjectKey *key = TypeSet::ObjectKey::get(obj);
         if (ClassCanHaveExtraProperties(key->clasp()))
             return true;
         if (key->unknownProperties())
             return true;
         HeapTypeSetKey index = key->property(JSID_VOID);
         if (index.nonData(constraints) || index.isOwnProperty(constraints))
             return true;
         obj = obj->getProto();
     } while (obj);
 
     return false;
 }
 
 bool
-types::ArrayPrototypeHasIndexedProperty(CompilerConstraintList *constraints, JSScript *script)
+js::ArrayPrototypeHasIndexedProperty(CompilerConstraintList *constraints, JSScript *script)
 {
     if (JSObject *proto = script->global().maybeGetArrayPrototype())
         return PrototypeHasIndexedProperty(constraints, proto);
     return true;
 }
 
 bool
-types::TypeCanHaveExtraIndexedProperties(CompilerConstraintList *constraints,
-                                         TemporaryTypeSet *types)
+js::TypeCanHaveExtraIndexedProperties(CompilerConstraintList *constraints,
+                                      TemporaryTypeSet *types)
 {
     const Class *clasp = types->getKnownClass(constraints);
 
     // Note: typed arrays have indexed properties not accounted for by type
     // information, though these are all in bounds and will be accounted for
     // by JIT paths.
     if (!clasp || (ClassCanHaveExtraProperties(clasp) && !IsAnyTypedArrayClass(clasp)))
         return true;
@@ -2343,17 +2343,17 @@ TypeZone::addPendingRecompile(JSContext 
     // When one script is inlined into another the caller listens to state
     // changes on the callee's script, so trigger these to force recompilation
     // of any such callers.
     if (script->functionNonDelazifying() && !script->functionNonDelazifying()->hasLazyGroup())
         ObjectStateChange(cx, script->functionNonDelazifying()->group(), false);
 }
 
 void
-types::PrintTypes(JSContext *cx, JSCompartment *comp, bool force)
+js::PrintTypes(JSContext *cx, JSCompartment *comp, bool force)
 {
 #ifdef DEBUG
     gc::AutoSuppressGC suppressGC(cx);
     JSAutoRequest request(cx);
 
     Zone *zone = comp->zone();
     AutoEnterAnalysis enter(nullptr, zone);
 
@@ -2383,55 +2383,55 @@ UpdatePropertyType(ExclusiveContext *cx,
 {
     MOZ_ASSERT(obj->isSingleton() && !obj->hasLazyGroup());
 
     if (!shape->writable())
         types->setNonWritableProperty(cx);
 
     if (shape->hasGetterValue() || shape->hasSetterValue()) {
         types->setNonDataProperty(cx);
-        types->TypeSet::addType(Type::UnknownType(), &cx->typeLifoAlloc());
+        types->TypeSet::addType(TypeSet::UnknownType(), &cx->typeLifoAlloc());
     } else if (shape->hasDefaultGetter() && shape->hasSlot()) {
         if (!indexed && types->canSetDefinite(shape->slot()))
             types->setDefinite(shape->slot());
 
         const Value &value = obj->getSlot(shape->slot());
 
         /*
          * Don't add initial undefined types for properties of global objects
          * that are not collated into the JSID_VOID property (see propertySet
          * comment).
          *
          * Also don't add untracked values (initial uninitialized lexical
          * magic values and optimized out values) as appearing in CallObjects.
          */
-        MOZ_ASSERT_IF(IsUntrackedValue(value), obj->is<CallObject>());
+        MOZ_ASSERT_IF(TypeSet::IsUntrackedValue(value), obj->is<CallObject>());
         if ((indexed || !value.isUndefined() || !CanHaveEmptyPropertyTypesForOwnProperty(obj)) &&
-            !IsUntrackedValue(value))
+            !TypeSet::IsUntrackedValue(value))
         {
-            Type type = GetValueType(value);
+            TypeSet::Type type = TypeSet::GetValueType(value);
             types->TypeSet::addType(type, &cx->typeLifoAlloc());
         }
 
         if (indexed || shape->hadOverwrite()) {
             types->setNonConstantProperty(cx);
         } else {
             InferSpew(ISpewOps, "typeSet: %sT%p%s property %s %s - setConstant",
                       InferSpewColor(types), types, InferSpewColorReset(),
-                      ObjectGroupString(obj->group()), TypeIdString(shape->propid()));
+                      TypeSet::ObjectGroupString(obj->group()), TypeIdString(shape->propid()));
         }
     }
 }
 
 void
 ObjectGroup::updateNewPropertyTypes(ExclusiveContext *cx, jsid id, HeapTypeSet *types)
 {
     InferSpew(ISpewOps, "typeSet: %sT%p%s property %s %s",
               InferSpewColor(types), types, InferSpewColorReset(),
-              ObjectGroupString(this), TypeIdString(id));
+              TypeSet::ObjectGroupString(this), TypeIdString(id));
 
     if (!singleton() || !singleton()->isNative()) {
         types->setNonConstantProperty(cx);
         return;
     }
 
     NativeObject *obj = &singleton()->as<NativeObject>();
 
@@ -2450,17 +2450,17 @@ ObjectGroup::updateNewPropertyTypes(Excl
                 UpdatePropertyType(cx, types, obj, shape, true);
             shape = shape->previous();
         }
 
         /* Also get values of any dense elements in the object. */
         for (size_t i = 0; i < obj->getDenseInitializedLength(); i++) {
             const Value &value = obj->getDenseElement(i);
             if (!value.isMagic(JS_ELEMENTS_HOLE)) {
-                Type type = GetValueType(value);
+                TypeSet::Type type = TypeSet::GetValueType(value);
                 types->TypeSet::addType(type, &cx->typeLifoAlloc());
             }
         }
     } else if (!JSID_IS_EMPTY(id)) {
         RootedId rootedId(cx, id);
         Shape *shape = obj->lookup(cx, rootedId);
         if (shape)
             UpdatePropertyType(cx, types, obj, shape, false);
@@ -2526,59 +2526,59 @@ ObjectGroup::matchDefiniteProperties(Han
                 return false;
         }
     }
 
     return true;
 }
 
 void
-types::AddTypePropertyId(ExclusiveContext *cx, ObjectGroup *group, jsid id, Type type)
+js::AddTypePropertyId(ExclusiveContext *cx, ObjectGroup *group, jsid id, TypeSet::Type type)
 {
     MOZ_ASSERT(id == IdToTypeId(id));
 
     if (group->unknownProperties())
         return;
 
     AutoEnterAnalysis enter(cx);
 
     HeapTypeSet *types = group->getProperty(cx, id);
     if (!types)
         return;
 
     // Clear any constant flag if it exists.
     if (!types->empty() && !types->nonConstantProperty()) {
         InferSpew(ISpewOps, "constantMutated: %sT%p%s %s",
-                  InferSpewColor(types), types, InferSpewColorReset(), TypeString(type));
+                  InferSpewColor(types), types, InferSpewColorReset(), TypeSet::TypeString(type));
         types->setNonConstantProperty(cx);
     }
 
     if (types->hasType(type))
         return;
 
     InferSpew(ISpewOps, "externalType: property %s %s: %s",
-              ObjectGroupString(group), TypeIdString(id), TypeString(type));
+              TypeSet::ObjectGroupString(group), TypeIdString(id), TypeSet::TypeString(type));
     types->addType(cx, type);
 
     // Propagate new types from partially initialized groups to fully
     // initialized groups for the acquired properties analysis. Note that we
     // don't need to do this for other property changes, as these will also be
     // reflected via shape changes on the object that will prevent the object
     // from acquiring the fully initialized group.
     if (group->newScript() && group->newScript()->initializedGroup()) {
         if (type.isObjectUnchecked() && types->unknownObject())
-            type = Type::AnyObjectType();
+            type = TypeSet::AnyObjectType();
         AddTypePropertyId(cx, group->newScript()->initializedGroup(), id, type);
     }
 }
 
 void
-types::AddTypePropertyId(ExclusiveContext *cx, ObjectGroup *group, jsid id, const Value &value)
+js::AddTypePropertyId(ExclusiveContext *cx, ObjectGroup *group, jsid id, const Value &value)
 {
-    AddTypePropertyId(cx, group, id, GetValueType(value));
+    AddTypePropertyId(cx, group, id, TypeSet::GetValueType(value));
 }
 
 void
 ObjectGroup::markPropertyNonData(ExclusiveContext *cx, jsid id)
 {
     AutoEnterAnalysis enter(cx);
 
     id = IdToTypeId(id);
@@ -2650,17 +2650,17 @@ ObjectGroup::setFlags(ExclusiveContext *
     if (singleton()) {
         /* Make sure flags are consistent with persistent object state. */
         MOZ_ASSERT_IF(flags & OBJECT_FLAG_ITERATED,
                       singleton()->lastProperty()->hasObjectFlag(BaseShape::ITERATED_SINGLETON));
     }
 
     addFlags(flags);
 
-    InferSpew(ISpewOps, "%s: setFlags 0x%x", ObjectGroupString(this), flags);
+    InferSpew(ISpewOps, "%s: setFlags 0x%x", TypeSet::ObjectGroupString(this), flags);
 
     ObjectStateChange(cx, this, false);
 
     // Propagate flag changes from partially to fully initialized groups for the
     // acquired properties analysis.
     if (newScript() && newScript()->initializedGroup())
         newScript()->initializedGroup()->setFlags(cx, flags);
 }
@@ -2668,17 +2668,17 @@ ObjectGroup::setFlags(ExclusiveContext *
 void
 ObjectGroup::markUnknown(ExclusiveContext *cx)
 {
     AutoEnterAnalysis enter(cx);
 
     MOZ_ASSERT(cx->zone()->types.activeAnalysis);
     MOZ_ASSERT(!unknownProperties());
 
-    InferSpew(ISpewOps, "UnknownProperties: %s", ObjectGroupString(this));
+    InferSpew(ISpewOps, "UnknownProperties: %s", TypeSet::ObjectGroupString(this));
 
     clearNewScript(cx);
     ObjectStateChange(cx, this, true);
 
     /*
      * Existing constraints may have already been added to this object, which we need
      * to do the right thing for. We can't ensure that we will mark all unknown
      * objects before they have been accessed, as the __proto__ of a known object
@@ -2686,17 +2686,17 @@ ObjectGroup::markUnknown(ExclusiveContex
      * properties of an object during analysis (i.e. hashmaps). Adding unknown for
      * any properties accessed already accounts for possible values read from them.
      */
 
     unsigned count = getPropertyCount();
     for (unsigned i = 0; i < count; i++) {
         Property *prop = getProperty(i);
         if (prop) {
-            prop->types.addType(cx, Type::UnknownType());
+            prop->types.addType(cx, TypeSet::UnknownType());
             prop->types.setNonDataProperty(cx);
         }
     }
 }
 
 TypeNewScript *
 ObjectGroup::anyNewScript()
 {
@@ -2795,18 +2795,18 @@ ObjectGroup::clearNewScript(ExclusiveCon
     markStateChange(cx);
 }
 
 void
 ObjectGroup::print()
 {
     TaggedProto tagged(proto());
     fprintf(stderr, "%s : %s",
-            ObjectGroupString(this),
-            tagged.isObject() ? TypeString(Type::ObjectType(tagged.toObject()))
+            TypeSet::ObjectGroupString(this),
+            tagged.isObject() ? TypeSet::TypeString(TypeSet::ObjectType(tagged.toObject()))
                               : (tagged.isLazy() ? "(lazy)" : "(null)"));
 
     if (unknownProperties()) {
         fprintf(stderr, " unknown");
     } else {
         if (!hasAnyFlags(OBJECT_FLAG_SPARSE_INDEXES))
             fprintf(stderr, " dense");
         if (!hasAnyFlags(OBJECT_FLAG_NON_PACKED))
@@ -2876,28 +2876,28 @@ class TypeConstraintClearDefiniteGetterS
          * Clear out the newScript shape and definite property information from
          * an object if the source type set could be a setter or could be
          * non-writable.
          */
         if (source->nonDataProperty() || source->nonWritableProperty())
             group->clearNewScript(cx);
     }
 
-    void newType(JSContext *cx, TypeSet *source, Type type) {}
+    void newType(JSContext *cx, TypeSet *source, TypeSet::Type type) {}
 
     bool sweep(TypeZone &zone, TypeConstraint **res) {
         if (IsObjectGroupAboutToBeFinalized(&group))
             return false;
         *res = zone.typeLifoAlloc.new_<TypeConstraintClearDefiniteGetterSetter>(group);
         return true;
     }
 };
 
 bool
-types::AddClearDefiniteGetterSetterForPrototypeChain(JSContext *cx, ObjectGroup *group, HandleId id)
+js::AddClearDefiniteGetterSetterForPrototypeChain(JSContext *cx, ObjectGroup *group, HandleId id)
 {
     /*
      * Ensure that if the properties named here could have a getter, setter or
      * a permanent property in any transitive prototype, the definite
      * properties get cleared from the group.
      */
     RootedObject proto(cx, group->proto().toObjectOrNull());
     while (proto) {
@@ -2924,42 +2924,43 @@ class TypeConstraintClearDefiniteSingle 
     ObjectGroup *group;
 
     explicit TypeConstraintClearDefiniteSingle(ObjectGroup *group)
       : group(group)
     {}
 
     const char *kind() { return "clearDefiniteSingle"; }
 
-    void newType(JSContext *cx, TypeSet *source, Type type) {
+    void newType(JSContext *cx, TypeSet *source, TypeSet::Type type) {
         if (source->baseFlags() || source->getObjectCount() > 1)
             group->clearNewScript(cx);
     }
 
     bool sweep(TypeZone &zone, TypeConstraint **res) {
         if (IsObjectGroupAboutToBeFinalized(&group))
             return false;
         *res = zone.typeLifoAlloc.new_<TypeConstraintClearDefiniteSingle>(group);
         return true;
     }
 };
 
 bool
-types::AddClearDefiniteFunctionUsesInScript(JSContext *cx, ObjectGroup *group,
+js::AddClearDefiniteFunctionUsesInScript(JSContext *cx, ObjectGroup *group,
                                             JSScript *script, JSScript *calleeScript)
 {
     // Look for any uses of the specified calleeScript in type sets for
     // |script|, and add constraints to ensure that if the type sets' contents
     // change then the definite properties are cleared from the type.
     // This ensures that the inlining performed when the definite properties
     // analysis was done is stable. We only need to look at type sets which
     // contain a single object, as IonBuilder does not inline polymorphic sites
     // during the definite properties analysis.
 
-    TypeSetObjectKey *calleeKey = Type::ObjectType(calleeScript->functionNonDelazifying()).objectKey();
+    TypeSet::ObjectKey *calleeKey =
+        TypeSet::ObjectType(calleeScript->functionNonDelazifying()).objectKey();
 
     unsigned count = TypeScript::NumTypeSets(script);
     StackTypeSet *typeArray = script->types()->typeArray();
 
     for (unsigned i = 0; i < count; i++) {
         StackTypeSet *types = &typeArray[i];
         if (!types->unknownObject() && types->getObjectCount() == 1) {
             if (calleeKey != types->getObject(0)) {
@@ -2985,18 +2986,17 @@ types::AddClearDefiniteFunctionUsesInScr
     return true;
 }
 
 /////////////////////////////////////////////////////////////////////
 // Interface functions
 /////////////////////////////////////////////////////////////////////
 
 void
-types::TypeMonitorCallSlow(JSContext *cx, JSObject *callee, const CallArgs &args,
-                           bool constructing)
+js::TypeMonitorCallSlow(JSContext *cx, JSObject *callee, const CallArgs &args, bool constructing)
 {
     unsigned nargs = callee->as<JSFunction>().nargs();
     JSScript *script = callee->as<JSFunction>().nonLazyScript();
 
     if (!constructing)
         TypeScript::SetThis(cx, script, args.thisv());
 
     /*
@@ -3009,60 +3009,60 @@ types::TypeMonitorCallSlow(JSContext *cx
         TypeScript::SetArgument(cx, script, arg, args[arg]);
 
     /* Watch for fewer actuals than formals to the call. */
     for (; arg < nargs; arg++)
         TypeScript::SetArgument(cx, script, arg, UndefinedValue());
 }
 
 static inline bool
-IsAboutToBeFinalized(TypeSetObjectKey **keyp)
+IsAboutToBeFinalized(TypeSet::ObjectKey **keyp)