diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index d602e91f997..d5b582e8655 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -1014,11 +1014,11 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle obj) JSObjWrapperTable::AddPtr p = sJSObjWrappers.lookupForAdd(key); - if (p/* && p->value*/) { - MOZ_ASSERT(p->value); + if (p/* && p->value()*/) { + MOZ_ASSERT(p->value()); // Found a live nsJSObjWrapper, return it. - return _retainobject(p->value); + return _retainobject(p->value()); } // No existing nsJSObjWrapper, create one. @@ -1873,7 +1873,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp) { if (sJSObjWrappers.initialized()) { for (JSObjWrapperTable::Enum e(sJSObjWrappers); !e.empty(); e.popFront()) { - nsJSObjWrapper *npobj = e.front().value; + nsJSObjWrapper *npobj = e.front().value(); MOZ_ASSERT(npobj->_class == &nsJSObjWrapper::sJSObjWrapperNPClass); if (npobj->mNpp == npp) { npobj->ClearJSObject(); diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index 2262a0ea1cb..0023126459c 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -30,9 +30,9 @@ void ObjectStore::trace(JSTracer *trc) { for (ObjectTable::Range r(table_.all()); !r.empty(); r.popFront()) { - DebugOnly prior = r.front().value.get(); - JS_CallHeapObjectTracer(trc, &r.front().value, "ipc-object"); - MOZ_ASSERT(r.front().value == prior); + DebugOnly prior = r.front().value().get(); + JS_CallHeapObjectTracer(trc, &r.front().value(), "ipc-object"); + MOZ_ASSERT(r.front().value() == prior); } } @@ -42,7 +42,7 @@ ObjectStore::find(ObjectId id) ObjectTable::Ptr p = table_.lookup(id); if (!p) return nullptr; - return p->value; + return p->value(); } bool @@ -82,9 +82,9 @@ void ObjectIdCache::trace(JSTracer *trc) { for (ObjectIdTable::Range r(table_->all()); !r.empty(); r.popFront()) { - JSObject *obj = r.front().key; + JSObject *obj = r.front().key(); JS_CallObjectTracer(trc, &obj, "ipc-id"); - MOZ_ASSERT(obj == r.front().key); + MOZ_ASSERT(obj == r.front().key()); } } @@ -94,7 +94,7 @@ ObjectIdCache::find(JSObject *obj) ObjectIdTable::Ptr p = table_->lookup(obj); if (!p) return 0; - return p->value; + return p->value(); } bool diff --git a/js/public/HashTable.h b/js/public/HashTable.h index 03265f5d1b8..f650af7569b 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -60,8 +60,8 @@ class HashMap struct MapHashPolicy : HashPolicy { typedef Key KeyType; - static const Key &getKey(TableEntry &e) { return e.key; } - static void setKey(TableEntry &e, Key &k) { HashPolicy::rekey(const_cast(e.key), k); } + static const Key &getKey(TableEntry &e) { return e.key(); } + static void setKey(TableEntry &e, Key &k) { HashPolicy::rekey(e.mutableKey(), k); } }; typedef detail::HashTable Impl; @@ -151,7 +151,7 @@ class HashMap template bool relookupOrAdd(AddPtr &p, KeyInput &&k, ValueInput &&v) { Entry e(mozilla::Forward(k), mozilla::Forward(v)); - return impl.relookupOrAdd(p, e.key, mozilla::Move(e)); + return impl.relookupOrAdd(p, e.key(), mozilla::Move(e)); } // |all()| returns a Range containing |count()| elements. E.g.: @@ -223,7 +223,7 @@ class HashMap bool put(KeyInput &&k, ValueInput &&v) { AddPtr p = lookupForAdd(k); if (p) { - p->value = mozilla::Forward(v); + p->value() = mozilla::Forward(v); return true; } return add(p, mozilla::Forward(k), mozilla::Forward(v)); @@ -233,7 +233,7 @@ class HashMap template bool putNew(KeyInput &&k, ValueInput &&v) { Entry e(mozilla::Forward(k), mozilla::Forward(v)); - return impl.putNew(e.key, mozilla::Move(e)); + return impl.putNew(e.key(), mozilla::Move(e)); } // Add (k,defaultValue) if |k| is not found. Return a false-y Ptr on oom. @@ -616,25 +616,37 @@ struct DefaultHasher template class HashMapEntry { + Key key_; + Value value_; + template friend class detail::HashTable; template friend class detail::HashTableEntry; + template friend class HashMap; - HashMapEntry(const HashMapEntry &) MOZ_DELETE; - void operator=(const HashMapEntry &) MOZ_DELETE; + Key & mutableKey() { return key_; } public: template HashMapEntry(KeyInput &&k, ValueInput &&v) - : key(mozilla::Forward(k)), value(mozilla::Forward(v)) { } + : key_(mozilla::Forward(k)), + value_(mozilla::Forward(v)) + {} HashMapEntry(HashMapEntry &&rhs) - : key(mozilla::Move(const_cast(rhs.key))), value(mozilla::Move(rhs.value)) { } + : key_(mozilla::Move(rhs.key_)), + value_(mozilla::Move(rhs.value_)) + {} typedef Key KeyType; typedef Value ValueType; - const Key key; - Value value; + const Key & key() const { return key_; } + const Value & value() const { return value_; } + Value & value() { return value_; } + + private: + HashMapEntry(const HashMapEntry &) MOZ_DELETE; + void operator=(const HashMapEntry &) MOZ_DELETE; }; } // namespace js diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index f758f52a96e..d4d21050932 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -343,13 +343,13 @@ struct ZoneStats : js::ZoneStatsPod MOZ_ASSERT(other.notableStrings.empty()); for (StringsHashMap::Range r = other.strings.all(); !r.empty(); r.popFront()) { - StringsHashMap::AddPtr p = strings.lookupForAdd(r.front().key); + StringsHashMap::AddPtr p = strings.lookupForAdd(r.front().key()); if (p) { // We've seen this string before; add its size to our tally. - p->value.add(r.front().value); + p->value().add(r.front().value()); } else { // We haven't seen this string before; add it to the hashtable. - strings.add(p, r.front().key, r.front().value); + strings.add(p, r.front().key(), r.front().value()); } } } diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index fe9bdba78a0..c331c4a2a33 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -2923,14 +2923,14 @@ BuildTypeSource(JSContext* cx, break; for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) - fieldsArray[r.front().value.mIndex] = &r.front(); + fieldsArray[r.front().value().mIndex] = &r.front(); for (size_t i = 0; i < length; ++i) { const FieldInfoHash::Entry* entry = fieldsArray[i]; AppendString(result, "{ \""); - AppendString(result, entry->key); + AppendString(result, entry->key()); AppendString(result, "\": "); - BuildTypeSource(cx, entry->value.mType, true, result); + BuildTypeSource(cx, entry->value().mType, true, result); AppendString(result, " }"); if (i != length - 1) AppendString(result, ", "); @@ -3073,19 +3073,19 @@ BuildDataSource(JSContext* cx, return false; for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) - fieldsArray[r.front().value.mIndex] = &r.front(); + fieldsArray[r.front().value().mIndex] = &r.front(); for (size_t i = 0; i < length; ++i) { const FieldInfoHash::Entry* entry = fieldsArray[i]; if (isImplicit) { AppendString(result, "\""); - AppendString(result, entry->key); + AppendString(result, entry->key()); AppendString(result, "\": "); } - char* fieldData = static_cast(data) + entry->value.mOffset; - RootedObject entryType(cx, entry->value.mType); + char* fieldData = static_cast(data) + entry->value().mOffset; + RootedObject entryType(cx, entry->value().mType); if (!BuildDataSource(cx, entryType, fieldData, true, result)) return false; @@ -3352,11 +3352,11 @@ CType::Trace(JSTracer* trc, JSObject* obj) FieldInfoHash* fields = static_cast(JSVAL_TO_PRIVATE(slot)); for (FieldInfoHash::Enum e(*fields); !e.empty(); e.popFront()) { - JSString *key = e.front().key; + JSString *key = e.front().key(); JS_CallStringTracer(trc, &key, "fieldName"); - if (key != e.front().key) + if (key != e.front().key()) e.rekeyFront(JS_ASSERT_STRING_IS_FLAT(key)); - JS_CallHeapObjectTracer(trc, &e.front().value.mType, "fieldType"); + JS_CallHeapObjectTracer(trc, &e.front().value().mType, "fieldType"); } break; @@ -4931,10 +4931,10 @@ StructType::BuildFFIType(JSContext* cx, JSObject* obj) for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { const FieldInfoHash::Entry& entry = r.front(); - ffi_type* fieldType = CType::GetFFIType(cx, entry.value.mType); + ffi_type* fieldType = CType::GetFFIType(cx, entry.value().mType); if (!fieldType) return nullptr; - elements[entry.value.mIndex] = fieldType; + elements[entry.value().mIndex] = fieldType; } } else { @@ -5072,7 +5072,7 @@ StructType::ConstructData(JSContext* cx, // ImplicitConvert each field. if (args.length() == fields->count()) { for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { - const FieldInfo& field = r.front().value; + const FieldInfo& field = r.front().value(); STATIC_ASSUME(field.mIndex < fields->count()); /* Quantified invariant */ if (!ImplicitConvert(cx, args[field.mIndex], field.mType, buffer + field.mOffset, @@ -5108,7 +5108,7 @@ StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) FieldInfoHash::Ptr ptr = GetFieldInfo(obj)->lookup(name); if (ptr) - return &ptr->value; + return &ptr->value(); JSAutoByteString bytes(cx, name); if (!bytes) @@ -5136,8 +5136,8 @@ StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { const FieldInfoHash::Entry& entry = r.front(); // Add the field descriptor to the array. - if (!AddFieldToArray(cx, &fieldsVec[entry.value.mIndex], - entry.key, entry.value.mType)) + if (!AddFieldToArray(cx, &fieldsVec[entry.value().mIndex], + entry.key(), entry.value().mType)) return nullptr; } diff --git a/js/src/ds/InlineMap.h b/js/src/ds/InlineMap.h index 4d623d2c971..41938e2c265 100644 --- a/js/src/ds/InlineMap.h +++ b/js/src/ds/InlineMap.h @@ -134,12 +134,12 @@ class InlineMap K &key() { JS_ASSERT(found()); - return isInlinePtr ? inlPtr->key : mapPtr->key; + return isInlinePtr ? inlPtr->key : mapPtr->key(); } V &value() { JS_ASSERT(found()); - return isInlinePtr ? inlPtr->value : mapPtr->value; + return isInlinePtr ? inlPtr->value : mapPtr->value(); } }; /* class Ptr */ @@ -178,7 +178,7 @@ class InlineMap JS_ASSERT(found()); if (isInlinePtr) return inlAddPtr->value; - return mapAddPtr->value; + return mapAddPtr->value(); } }; /* class AddPtr */ @@ -356,7 +356,7 @@ class InlineMap JS_ASSERT(!empty()); if (isInlineRange()) return Entry(cur->key, cur->value); - return Entry(mapRange.front().key, mapRange.front().value); + return Entry(mapRange.front().key(), mapRange.front().value()); } void popFront() { diff --git a/js/src/frontend/ParseMaps.cpp b/js/src/frontend/ParseMaps.cpp index b86da8ab8e0..ec670eaa490 100644 --- a/js/src/frontend/ParseMaps.cpp +++ b/js/src/frontend/ParseMaps.cpp @@ -115,8 +115,8 @@ frontend::InitAtomMap(frontend::AtomIndexMap *indices, HeapPtrAtom *atoms) typedef AtomIndexMap::WordMap WordMap; const WordMap &wm = indices->asMap(); for (WordMap::Range r = wm.all(); !r.empty(); r.popFront()) { - JSAtom *atom = r.front().key; - jsatomid index = r.front().value; + JSAtom *atom = r.front().key(); + jsatomid index = r.front().value(); JS_ASSERT(index < indices->count()); atoms[index].init(atom); } diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index d6ceb8b6ab6..0f7ba5f4443 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -474,11 +474,11 @@ AutoGCRooter::trace(JSTracer *trc) case OBJOBJHASHMAP: { AutoObjectObjectHashMap::HashMapImpl &map = static_cast(this)->map; for (AutoObjectObjectHashMap::Enum e(map); !e.empty(); e.popFront()) { - MarkObjectRoot(trc, &e.front().value, "AutoObjectObjectHashMap value"); - JS_SET_TRACING_LOCATION(trc, (void *)&e.front().key); - JSObject *key = e.front().key; + MarkObjectRoot(trc, &e.front().value(), "AutoObjectObjectHashMap value"); + JS_SET_TRACING_LOCATION(trc, (void *)&e.front().key()); + JSObject *key = e.front().key(); MarkObjectRoot(trc, &key, "AutoObjectObjectHashMap key"); - if (key != e.front().key) + if (key != e.front().key()) e.rekeyFront(key); } return; @@ -488,9 +488,9 @@ AutoGCRooter::trace(JSTracer *trc) AutoObjectUnsigned32HashMap *self = static_cast(this); AutoObjectUnsigned32HashMap::HashMapImpl &map = self->map; for (AutoObjectUnsigned32HashMap::Enum e(map); !e.empty(); e.popFront()) { - JSObject *key = e.front().key; + JSObject *key = e.front().key(); MarkObjectRoot(trc, &key, "AutoObjectUnsignedHashMap key"); - if (key != e.front().key) + if (key != e.front().key()) e.rekeyFront(key); } return; @@ -684,16 +684,18 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) for (RootRange r = rt->gcRootsHash.all(); !r.empty(); r.popFront()) { const RootEntry &entry = r.front(); - const char *name = entry.value.name ? entry.value.name : "root"; - if (entry.value.type == JS_GC_ROOT_VALUE_PTR) { - MarkValueRoot(trc, reinterpret_cast(entry.key), name); - } else if (*reinterpret_cast(entry.key)){ - if (entry.value.type == JS_GC_ROOT_STRING_PTR) - MarkStringRoot(trc, reinterpret_cast(entry.key), name); - else if (entry.value.type == JS_GC_ROOT_OBJECT_PTR) - MarkObjectRoot(trc, reinterpret_cast(entry.key), name); - else if (entry.value.type == JS_GC_ROOT_SCRIPT_PTR) - MarkScriptRoot(trc, reinterpret_cast(entry.key), name); + const char *name = entry.value().name ? entry.value().name : "root"; + JSGCRootType type = entry.value().type; + void *key = entry.key(); + if (type == JS_GC_ROOT_VALUE_PTR) { + MarkValueRoot(trc, reinterpret_cast(key), name); + } else if (*reinterpret_cast(key)){ + if (type == JS_GC_ROOT_STRING_PTR) + MarkStringRoot(trc, reinterpret_cast(key), name); + else if (type == JS_GC_ROOT_OBJECT_PTR) + MarkObjectRoot(trc, reinterpret_cast(key), name); + else if (type == JS_GC_ROOT_SCRIPT_PTR) + MarkScriptRoot(trc, reinterpret_cast(key), name); else MOZ_ASSUME_UNREACHABLE("unexpected js::RootInfo::type value"); } diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 90d04f6a908..f1e1af20586 100644 --- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -1396,13 +1396,14 @@ class MOZ_STACK_CLASS ModuleCompiler const Global *lookupGlobal(PropertyName *name) const { if (GlobalMap::Ptr p = globals_.lookup(name)) - return p->value; + return p->value(); return nullptr; } Func *lookupFunction(PropertyName *name) { if (GlobalMap::Ptr p = globals_.lookup(name)) { - if (p->value->which() == Global::Function) - return functions_[p->value->funcIndex()]; + Global *value = p->value(); + if (value->which() == Global::Function) + return functions_[value->funcIndex()]; } return nullptr; } @@ -1420,7 +1421,7 @@ class MOZ_STACK_CLASS ModuleCompiler } bool lookupStandardLibraryMathName(PropertyName *name, AsmJSMathBuiltin *mathBuiltin) const { if (MathNameMap::Ptr p = standardLibraryMathNames_.lookup(name)) { - *mathBuiltin = p->value; + *mathBuiltin = p->value(); return true; } return false; @@ -1551,7 +1552,7 @@ class MOZ_STACK_CLASS ModuleCompiler ExitDescriptor exitDescriptor(name, Move(sig)); ExitMap::AddPtr p = exits_.lookupForAdd(exitDescriptor); if (p) { - *exitIndex = p->value; + *exitIndex = p->value(); return true; } if (!module_->addExit(ffiIndex, exitIndex)) @@ -1979,7 +1980,7 @@ class FunctionCompiler const Local *lookupLocal(PropertyName *name) const { if (LocalMap::Ptr p = locals_.lookup(name)) - return &p->value; + return &p->value(); return nullptr; } @@ -2536,7 +2537,7 @@ class FunctionCompiler { bool createdJoinBlock = false; if (UnlabeledBlockMap::Ptr p = unlabeledContinues_.lookup(pn)) { - if (!bindBreaksOrContinues(&p->value, &createdJoinBlock, pn)) + if (!bindBreaksOrContinues(&p->value(), &createdJoinBlock, pn)) return false; unlabeledContinues_.remove(p); } @@ -2698,7 +2699,7 @@ class FunctionCompiler const LabelVector &labels = *maybeLabels; for (unsigned i = 0; i < labels.length(); i++) { if (LabeledBlockMap::Ptr p = map->lookup(labels[i])) { - if (!bindBreaksOrContinues(&p->value, createdJoinBlock, pn)) + if (!bindBreaksOrContinues(&p->value(), createdJoinBlock, pn)) return false; map->remove(p); } @@ -2717,7 +2718,7 @@ class FunctionCompiler if (!map->add(p, key, Move(empty))) return false; } - if (!p->value.append(curBlock_)) + if (!p->value().append(curBlock_)) return false; curBlock_ = nullptr; return true; @@ -2727,7 +2728,7 @@ class FunctionCompiler { bool createdJoinBlock = false; if (UnlabeledBlockMap::Ptr p = unlabeledBreaks_.lookup(pn)) { - if (!bindBreaksOrContinues(&p->value, &createdJoinBlock, pn)) + if (!bindBreaksOrContinues(&p->value(), &createdJoinBlock, pn)) return false; unlabeledBreaks_.remove(p); } @@ -6373,7 +6374,7 @@ GenerateStubs(ModuleCompiler &m) // The order of the iterations here is non-deterministic, since // m.allExits() is a hash keyed by pointer values! for (ModuleCompiler::ExitMap::Range r = m.allExits(); !r.empty(); r.popFront()) { - GenerateFFIExit(m, r.front().key, r.front().value, &throwLabel); + GenerateFFIExit(m, r.front().key(), r.front().value(), &throwLabel); if (m.masm().oom()) return false; } diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index 3a67e888db3..44ed04a7989 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -891,7 +891,7 @@ void jit::JitCompartment::toggleBaselineStubBarriers(bool enabled) { for (ICStubCodeMap::Enum e(*stubCodes_); !e.empty(); e.popFront()) { - IonCode *code = *e.front().value.unsafeGet(); + IonCode *code = *e.front().value().unsafeGet(); code->togglePreBarriers(enabled); } } diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index b2cace2c786..f2ef810ad1f 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -603,7 +603,7 @@ JitRuntime::getVMWrapper(const VMFunction &f) const JitRuntime::VMWrapperMap::Ptr p = functionWrappers_->readonlyThreadsafeLookup(&f); JS_ASSERT(p); - return p->value; + return p->value(); } template diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index 8d293a9c44d..5b148aa8f6c 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1377,7 +1377,7 @@ FindDominatingBoundsCheck(BoundsCheckMap &checks, MBoundsCheck *check, size_t in // See the comment in ValueNumberer::findDominatingDef. HashNumber hash = BoundsCheckHashIgnoreOffset(check); BoundsCheckMap::Ptr p = checks.lookup(hash); - if (!p || index > p->value.validUntil) { + if (!p || index > p->value().validUntil) { // We didn't find a dominating bounds check. BoundsCheckInfo info; info.check = check; @@ -1389,7 +1389,7 @@ FindDominatingBoundsCheck(BoundsCheckMap &checks, MBoundsCheck *check, size_t in return check; } - return p->value.check; + return p->value().check; } // Extract a linear sum from ins, if possible (otherwise giving the sum 'ins + 0'). diff --git a/js/src/jit/JitCompartment.h b/js/src/jit/JitCompartment.h index b83cd8747ed..5ed17f32e8b 100644 --- a/js/src/jit/JitCompartment.h +++ b/js/src/jit/JitCompartment.h @@ -368,7 +368,7 @@ class JitCompartment IonCode *getStubCode(uint32_t key) { ICStubCodeMap::AddPtr p = stubCodes_->lookupForAdd(key); if (p) - return p->value; + return p->value(); return nullptr; } bool putStubCode(uint32_t key, Handle stubCode) { diff --git a/js/src/jit/ValueNumbering.cpp b/js/src/jit/ValueNumbering.cpp index 0fb3662101d..de967ee1545 100644 --- a/js/src/jit/ValueNumbering.cpp +++ b/js/src/jit/ValueNumbering.cpp @@ -35,14 +35,14 @@ ValueNumberer::lookupValue(MDefinition *ins) if (p) { // make sure this is in the correct group - setClass(ins, p->key); + setClass(ins, p->key()); } else { if (!values.add(p, ins, ins->id())) return 0; breakClass(ins); } - return p->value; + return p->value(); } MDefinition * @@ -309,7 +309,7 @@ ValueNumberer::findDominatingDef(InstructionMap &defs, MDefinition *ins, size_t JS_ASSERT(ins->valueNumber() != 0); InstructionMap::Ptr p = defs.lookup(ins->valueNumber()); MDefinition *dom; - if (!p || index > p->value.validUntil) { + if (!p || index > p->value().validUntil) { DominatingValue value; value.def = ins; // Since we are traversing the dominator tree in pre-order, when we @@ -326,7 +326,7 @@ ValueNumberer::findDominatingDef(InstructionMap &defs, MDefinition *ins, size_t dom = ins; } else { - dom = p->value.def; + dom = p->value().def; } return dom; diff --git a/js/src/jit/arm/Trampoline-arm.cpp b/js/src/jit/arm/Trampoline-arm.cpp index 0b19d004c95..89a7b7b4188 100644 --- a/js/src/jit/arm/Trampoline-arm.cpp +++ b/js/src/jit/arm/Trampoline-arm.cpp @@ -660,7 +660,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) JS_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) - return p->value; + return p->value(); // Generate a separated code for the wrapper. MacroAssembler masm(cx); diff --git a/js/src/jit/x64/MacroAssembler-x64.cpp b/js/src/jit/x64/MacroAssembler-x64.cpp index cf95d88d7f5..4586b3f0167 100644 --- a/js/src/jit/x64/MacroAssembler-x64.cpp +++ b/js/src/jit/x64/MacroAssembler-x64.cpp @@ -28,7 +28,7 @@ MacroAssemblerX64::loadConstantDouble(double d, const FloatRegister &dest) } size_t doubleIndex; if (DoubleMap::AddPtr p = doubleMap_.lookupForAdd(d)) { - doubleIndex = p->value; + doubleIndex = p->value(); } else { doubleIndex = doubles_.length(); enoughMemory_ &= doubles_.append(Double(d)); @@ -62,7 +62,7 @@ MacroAssemblerX64::loadConstantFloat32(float f, const FloatRegister &dest) } size_t floatIndex; if (FloatMap::AddPtr p = floatMap_.lookupForAdd(f)) { - floatIndex = p->value; + floatIndex = p->value(); } else { floatIndex = floats_.length(); enoughMemory_ &= floats_.append(Float(f)); diff --git a/js/src/jit/x64/Trampoline-x64.cpp b/js/src/jit/x64/Trampoline-x64.cpp index c73d4d31bdc..d41d42bea39 100644 --- a/js/src/jit/x64/Trampoline-x64.cpp +++ b/js/src/jit/x64/Trampoline-x64.cpp @@ -510,7 +510,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) JS_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) - return p->value; + return p->value(); // Generate a separated code for the wrapper. MacroAssembler masm; diff --git a/js/src/jit/x86/MacroAssembler-x86.cpp b/js/src/jit/x86/MacroAssembler-x86.cpp index 77b9a16ccf5..ace3e98d36a 100644 --- a/js/src/jit/x86/MacroAssembler-x86.cpp +++ b/js/src/jit/x86/MacroAssembler-x86.cpp @@ -29,7 +29,7 @@ MacroAssemblerX86::getDouble(double d) size_t doubleIndex; DoubleMap::AddPtr p = doubleMap_.lookupForAdd(d); if (p) { - doubleIndex = p->value; + doubleIndex = p->value(); } else { doubleIndex = doubles_.length(); enoughMemory_ &= doubles_.append(Double(d)); @@ -75,7 +75,7 @@ MacroAssemblerX86::getFloat(float f) size_t floatIndex; FloatMap::AddPtr p = floatMap_.lookupForAdd(f); if (p) { - floatIndex = p->value; + floatIndex = p->value(); } else { floatIndex = floats_.length(); enoughMemory_ &= floats_.append(Float(f)); diff --git a/js/src/jit/x86/Trampoline-x86.cpp b/js/src/jit/x86/Trampoline-x86.cpp index 30f601835fe..c6de13cdd6a 100644 --- a/js/src/jit/x86/Trampoline-x86.cpp +++ b/js/src/jit/x86/Trampoline-x86.cpp @@ -545,7 +545,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) JS_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) - return p->value; + return p->value(); // Generate a separated code for the wrapper. MacroAssembler masm; diff --git a/js/src/jsapi-tests/testHashTable.cpp b/js/src/jsapi-tests/testHashTable.cpp index a20fd590abe..a335e62b4ba 100644 --- a/js/src/jsapi-tests/testHashTable.cpp +++ b/js/src/jsapi-tests/testHashTable.cpp @@ -61,15 +61,15 @@ MapsAreEqual(IntMap &am, IntMap &bm) fprintf(stderr, "A.count() == %u and B.count() == %u\n", am.count(), bm.count()); } for (IntMap::Range r = am.all(); !r.empty(); r.popFront()) { - if (!bm.has(r.front().key)) { + if (!bm.has(r.front().key())) { equal = false; - fprintf(stderr, "B does not have %x which is in A\n", r.front().key); + fprintf(stderr, "B does not have %x which is in A\n", r.front().key()); } } for (IntMap::Range r = bm.all(); !r.empty(); r.popFront()) { - if (!am.has(r.front().key)) { + if (!am.has(r.front().key())) { equal = false; - fprintf(stderr, "A does not have %x which is in B\n", r.front().key); + fprintf(stderr, "A does not have %x which is in B\n", r.front().key()); } } return equal; @@ -141,17 +141,17 @@ SlowRekey(IntMap *m) { tmp.init(); for (IntMap::Range r = m->all(); !r.empty(); r.popFront()) { - if (NewKeyFunction::shouldBeRemoved(r.front().key)) + if (NewKeyFunction::shouldBeRemoved(r.front().key())) continue; - uint32_t hi = NewKeyFunction::rekey(r.front().key); + uint32_t hi = NewKeyFunction::rekey(r.front().key()); if (tmp.has(hi)) return false; - tmp.putNew(hi, r.front().value); + tmp.putNew(hi, r.front().value()); } m->clear(); for (IntMap::Range r = tmp.all(); !r.empty(); r.popFront()) { - m->putNew(r.front().key, r.front().value); + m->putNew(r.front().key(), r.front().value()); } return true; @@ -193,8 +193,8 @@ BEGIN_TEST(testHashRekeyManual) CHECK(MapsAreEqual(am, bm)); for (IntMap::Enum e(am); !e.empty(); e.popFront()) { - uint32_t tmp = LowToHigh::rekey(e.front().key); - if (tmp != e.front().key) + uint32_t tmp = LowToHigh::rekey(e.front().key()); + if (tmp != e.front().key()) e.rekeyFront(tmp); } CHECK(SlowRekey(&bm)); @@ -243,11 +243,11 @@ BEGIN_TEST(testHashRekeyManualRemoval) CHECK(MapsAreEqual(am, bm)); for (IntMap::Enum e(am); !e.empty(); e.popFront()) { - if (LowToHighWithRemoval::shouldBeRemoved(e.front().key)) { + if (LowToHighWithRemoval::shouldBeRemoved(e.front().key())) { e.removeFront(); } else { - uint32_t tmp = LowToHighWithRemoval::rekey(e.front().key); - if (tmp != e.front().key) + uint32_t tmp = LowToHighWithRemoval::rekey(e.front().key()); + if (tmp != e.front().key()) e.rekeyFront(tmp); } } diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 6b865e3bc48..913c7a7d0b3 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -1095,7 +1095,7 @@ JS_TransplantObject(JSContext *cx, HandleObject origobj, HandleObject target) // There might already be a wrapper for the original object in // the new compartment. If there is, we use its identity and swap // in the contents of |target|. - newIdentity = &p->value.toObject(); + newIdentity = &p->value().toObject(); // When we remove origv from the wrapper map, its wrapper, newIdentity, // must immediately cease to be a cross-compartment wrapper. Neuter it. diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 86e6936efd6..dcbbaae079b 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -101,8 +101,8 @@ JSCompartment::sweepCallsiteClones() { if (callsiteClones.initialized()) { for (CallsiteCloneTable::Enum e(callsiteClones); !e.empty(); e.popFront()) { - CallsiteCloneKey key = e.front().key; - JSFunction *fun = e.front().value; + CallsiteCloneKey key = e.front().key(); + JSFunction *fun = e.front().value(); if (!IsScriptMarked(&key.script) || !IsObjectMarked(&fun)) e.removeFront(); } @@ -128,7 +128,7 @@ js::ExistingCloneFunctionAtCallsite(const CallsiteCloneTable &table, JSFunction CallsiteCloneTable::Ptr p = table.lookup(CallsiteCloneKey(fun, script, script->pcToOffset(pc))); if (p) - return p->value; + return p->value(); return nullptr; } diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index c4995d89fce..a4132018c96 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -229,7 +229,7 @@ JSCompartment::wrap(JSContext *cx, JSString **strp) /* Check the cache. */ RootedValue key(cx, StringValue(str)); if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(key)) { - *strp = p->value.get().toString(); + *strp = p->value().get().toString(); return true; } @@ -333,7 +333,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin /* If we already have a wrapper for this value, use it. */ RootedValue key(cx, ObjectValue(*obj)); if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(key)) { - obj.set(&p->value.get().toObject()); + obj.set(&p->value().get().toObject()); JS_ASSERT(obj->is()); JS_ASSERT(obj->getParent() == global); return true; @@ -449,8 +449,8 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer *trc) JS_ASSERT(!zone()->isCollecting()); for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { - Value v = e.front().value; - if (e.front().key.kind == CrossCompartmentKey::ObjectWrapper) { + Value v = e.front().value(); + if (e.front().key().kind == CrossCompartmentKey::ObjectWrapper) { ProxyObject *wrapper = &v.toObject().as(); /* @@ -474,12 +474,12 @@ void JSCompartment::markAllCrossCompartmentWrappers(JSTracer *trc) { for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { - CrossCompartmentKey key = e.front().key; + CrossCompartmentKey key = e.front().key(); MarkGCThingRoot(trc, (void **)&key.wrapped, "CrossCompartmentKey::wrapped"); if (key.debugger) MarkObjectRoot(trc, &key.debugger, "CrossCompartmentKey::debugger"); - MarkValueRoot(trc, e.front().value.unsafeGet(), "CrossCompartmentWrapper"); - if (key.wrapped != e.front().key.wrapped || key.debugger != e.front().key.debugger) + MarkValueRoot(trc, e.front().value().unsafeGet(), "CrossCompartmentWrapper"); + if (key.wrapped != e.front().key().wrapped || key.debugger != e.front().key().debugger) e.rekeyFront(key); } } @@ -577,14 +577,16 @@ JSCompartment::sweepCrossCompartmentWrappers() /* Remove dead wrappers from the table. */ for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { - CrossCompartmentKey key = e.front().key; + CrossCompartmentKey key = e.front().key(); bool keyDying = IsCellAboutToBeFinalized(&key.wrapped); - bool valDying = IsValueAboutToBeFinalized(e.front().value.unsafeGet()); + bool valDying = IsValueAboutToBeFinalized(e.front().value().unsafeGet()); bool dbgDying = key.debugger && IsObjectAboutToBeFinalized(&key.debugger); if (keyDying || valDying || dbgDying) { JS_ASSERT(key.kind != CrossCompartmentKey::StringWrapper); e.removeFront(); - } else if (key.wrapped != e.front().key.wrapped || key.debugger != e.front().key.debugger) { + } else if (key.wrapped != e.front().key().wrapped || + key.debugger != e.front().key().debugger) + { e.rekeyFront(key); } } diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index e358b3066e5..d6bd84004a3 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -610,11 +610,11 @@ struct WrapperValue * is in use, the AutoWrapper rooter will ensure the wrapper gets marked. */ explicit WrapperValue(const WrapperMap::Ptr &ptr) - : value(*ptr->value.unsafeGet()) + : value(*ptr->value().unsafeGet()) {} explicit WrapperValue(const WrapperMap::Enum &e) - : value(*e.front().value.unsafeGet()) + : value(*e.front().value().unsafeGet()) {} Value &get() { return value; } diff --git a/js/src/jscompartmentinlines.h b/js/src/jscompartmentinlines.h index c2a6c5ca118..70cdfc72375 100644 --- a/js/src/jscompartmentinlines.h +++ b/js/src/jscompartmentinlines.h @@ -91,9 +91,9 @@ JSCompartment::wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject e JS::RootedValue v(cx, vp); if (js::WrapperMap::Ptr p = crossCompartmentWrappers.lookup(v)) { #ifdef DEBUG - cacheResult = &p->value.get().toObject(); + cacheResult = &p->value().get().toObject(); #else - vp.set(p->value); + vp.set(p->value()); return true; #endif } diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index db2d56cdbd4..1d3bdab16a2 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -660,7 +660,7 @@ js::VisitGrayWrapperTargets(Zone *zone, GCThingCallback callback, void *closure) JSRuntime *rt = zone->runtimeFromMainThread(); for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next()) { for (JSCompartment::WrapperEnum e(comp); !e.empty(); e.popFront()) { - gc::Cell *thing = e.front().key.wrapped; + gc::Cell *thing = e.front().key().wrapped; if (!IsInsideNursery(rt, thing) && thing->isMarked(gc::GRAY)) callback(closure, thing); } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index da695cfa899..2055eaae455 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -2881,7 +2881,7 @@ InCrossCompartmentMap(JSObject *src, Cell *dst, JSGCTraceKind dstKind) if (dstKind == JSTRACE_OBJECT) { Value key = ObjectValue(*static_cast(dst)); if (WrapperMap::Ptr p = srccomp->lookupWrapper(key)) { - if (*p->value.unsafeGet() == ObjectValue(*src)) + if (*p->value().unsafeGet() == ObjectValue(*src)) return true; } } @@ -2891,7 +2891,7 @@ InCrossCompartmentMap(JSObject *src, Cell *dst, JSGCTraceKind dstKind) * know the right hashtable key, so we have to iterate. */ for (JSCompartment::WrapperEnum e(srccomp); !e.empty(); e.popFront()) { - if (e.front().key.wrapped == dst && ToMarkable(e.front().value) == src) + if (e.front().key().wrapped == dst && ToMarkable(e.front().value()) == src) return true; } @@ -3124,7 +3124,7 @@ BeginMarkPhase(JSRuntime *rt) /* Set the maybeAlive flag based on cross-compartment edges. */ for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { - Cell *dst = e.front().key.wrapped; + Cell *dst = e.front().key().wrapped; dst->tenuredZone()->maybeAlive = true; } } @@ -3252,7 +3252,7 @@ js::gc::MarkingValidator::~MarkingValidator() return; for (BitmapMap::Range r(map.all()); !r.empty(); r.popFront()) - js_delete(r.front().value); + js_delete(r.front().value()); } void @@ -3358,7 +3358,7 @@ js::gc::MarkingValidator::nonIncrementalMark() for (GCChunkSet::Range r(runtime->gcChunkSet.all()); !r.empty(); r.popFront()) { Chunk *chunk = r.front(); ChunkBitmap *bitmap = &chunk->bitmap; - ChunkBitmap *entry = map.lookup(chunk)->value; + ChunkBitmap *entry = map.lookup(chunk)->value(); Swap(*entry, *bitmap); } @@ -3390,7 +3390,7 @@ js::gc::MarkingValidator::validate() if (!ptr) continue; /* Allocated after we did the non-incremental mark. */ - ChunkBitmap *bitmap = ptr->value; + ChunkBitmap *bitmap = ptr->value(); ChunkBitmap *incBitmap = &chunk->bitmap; for (size_t i = 0; i < ArenasPerChunk; i++) { @@ -3482,7 +3482,7 @@ DropStringWrappers(JSRuntime *rt) */ for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { - if (e.front().key.kind == CrossCompartmentKey::StringWrapper) + if (e.front().key().kind == CrossCompartmentKey::StringWrapper) e.removeFront(); } } @@ -3507,9 +3507,9 @@ void JSCompartment::findOutgoingEdges(ComponentFinder &finder) { for (js::WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { - CrossCompartmentKey::Kind kind = e.front().key.kind; + CrossCompartmentKey::Kind kind = e.front().key().kind; JS_ASSERT(kind != CrossCompartmentKey::StringWrapper); - Cell *other = e.front().key.wrapped; + Cell *other = e.front().key().wrapped; if (kind == CrossCompartmentKey::ObjectWrapper) { /* * Add edge to wrapped object compartment if wrapped object is not @@ -4033,8 +4033,8 @@ BeginSweepPhase(JSRuntime *rt, bool lastGC) for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { JS_ASSERT(!c->gcIncomingGrayPointers); for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { - if (e.front().key.kind != CrossCompartmentKey::StringWrapper) - AssertNotOnGrayList(&e.front().value.get().toObject()); + if (e.front().key().kind != CrossCompartmentKey::StringWrapper) + AssertNotOnGrayList(&e.front().value().get().toObject()); } } #endif @@ -4256,8 +4256,8 @@ EndSweepPhase(JSRuntime *rt, JSGCInvocationKind gckind, bool lastGC) JS_ASSERT(!c->gcLiveArrayBuffers); for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { - if (e.front().key.kind != CrossCompartmentKey::StringWrapper) - AssertNotOnGrayList(&e.front().value.get().toObject()); + if (e.front().key().kind != CrossCompartmentKey::StringWrapper) + AssertNotOnGrayList(&e.front().value().get().toObject()); } } #endif diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 6b0d072d916..ae560d58286 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -1822,7 +1822,7 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke AllocationSiteTable::Ptr p = cx->compartment()->types.allocationSiteTable->lookup(nkey); if (p) - res = p->value; + res = p->value(); } if (!res) { @@ -2303,7 +2303,7 @@ TypeCompartment::setTypeToHomogenousArray(ExclusiveContext *cx, ArrayTableKey key(elementType, obj->getProto()); DependentAddPtr p(cx, *arrayTypeTable, key); if (p) { - obj->setType(p->value); + obj->setType(p->value()); } else { /* Make a new type to use for future arrays with the same elements. */ RootedObject objProto(cx, obj->getProto()); @@ -2492,11 +2492,11 @@ TypeCompartment::fixObjectType(ExclusiveContext *cx, JSObject *obj) ObjectTypeTable::AddPtr p = objectTypeTable->lookupForAdd(lookup); if (p) { - JS_ASSERT(obj->getProto() == p->value.object->proto); - JS_ASSERT(obj->lastProperty() == p->value.shape); + JS_ASSERT(obj->getProto() == p->value().object->proto); + JS_ASSERT(obj->lastProperty() == p->value().shape); - UpdateObjectTableEntryTypes(cx, p->value, properties.begin(), properties.length()); - obj->setType(p->value.object); + UpdateObjectTableEntryTypes(cx, p->value(), properties.begin(), properties.length()); + obj->setType(p->value().object); return; } @@ -2595,20 +2595,20 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n cx->clearPendingException(); return nullptr; } - JS_ASSERT(obj->getProto() == p->value.object->proto); + JS_ASSERT(obj->getProto() == p->value().object->proto); - RootedShape shape(cx, p->value.shape); + RootedShape shape(cx, p->value().shape); if (!JSObject::setLastProperty(cx, obj, shape)) { cx->clearPendingException(); return nullptr; } - UpdateObjectTableEntryTypes(cx, p->value, properties, nproperties); + UpdateObjectTableEntryTypes(cx, p->value(), properties, nproperties); for (size_t i = 0; i < nproperties; i++) obj->setSlot(i, properties[i].value); - obj->setType(p->value.object); + obj->setType(p->value().object); return obj; } @@ -4026,7 +4026,7 @@ TypeCompartment::sweep(FreeOp *fop) if (arrayTypeTable) { for (ArrayTypeTable::Enum e(*arrayTypeTable); !e.empty(); e.popFront()) { - const ArrayTableKey &key = e.front().key; + const ArrayTableKey &key = e.front().key(); JS_ASSERT(key.type.isUnknown() || !key.type.isSingleObject()); bool remove = false; @@ -4036,7 +4036,7 @@ TypeCompartment::sweep(FreeOp *fop) if (IsTypeObjectAboutToBeFinalized(&typeObject)) remove = true; } - if (IsTypeObjectAboutToBeFinalized(e.front().value.unsafeGet())) + if (IsTypeObjectAboutToBeFinalized(e.front().value().unsafeGet())) remove = true; if (remove) { @@ -4052,8 +4052,8 @@ TypeCompartment::sweep(FreeOp *fop) if (objectTypeTable) { for (ObjectTypeTable::Enum e(*objectTypeTable); !e.empty(); e.popFront()) { - const ObjectTableKey &key = e.front().key; - ObjectTableEntry &entry = e.front().value; + const ObjectTableKey &key = e.front().key(); + ObjectTableEntry &entry = e.front().value(); bool remove = false; if (IsTypeObjectAboutToBeFinalized(entry.object.unsafeGet())) @@ -4088,12 +4088,12 @@ TypeCompartment::sweep(FreeOp *fop) if (allocationSiteTable) { for (AllocationSiteTable::Enum e(*allocationSiteTable); !e.empty(); e.popFront()) { - AllocationSiteKey key = e.front().key; + AllocationSiteKey key = e.front().key(); bool keyDying = IsScriptAboutToBeFinalized(&key.script); - bool valDying = IsTypeObjectAboutToBeFinalized(e.front().value.unsafeGet()); + bool valDying = IsTypeObjectAboutToBeFinalized(e.front().value().unsafeGet()); if (keyDying || valDying) e.removeFront(); - else if (key.script != e.front().key.script) + else if (key.script != e.front().key().script) e.rekeyFront(key); } } @@ -4118,8 +4118,8 @@ TypeCompartment::sweepShapes(FreeOp *fop) */ if (objectTypeTable) { for (ObjectTypeTable::Enum e(*objectTypeTable); !e.empty(); e.popFront()) { - const ObjectTableKey &key = e.front().key; - ObjectTableEntry &entry = e.front().value; + const ObjectTableKey &key = e.front().key(); + ObjectTableEntry &entry = e.front().value(); if (IsShapeAboutToBeFinalized(entry.shape.unsafeGet())) { fop->free_(key.properties); @@ -4233,8 +4233,8 @@ TypeCompartment::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, !e.empty(); e.popFront()) { - const ObjectTableKey &key = e.front().key; - const ObjectTableEntry &value = e.front().value; + const ObjectTableKey &key = e.front().key(); + const ObjectTableEntry &value = e.front().value(); /* key.ids and values.types have the same length. */ *objectTypeTables += mallocSizeOf(key.properties) + mallocSizeOf(value.types); diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index 607b7c5c898..992abd5a960 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -721,7 +721,7 @@ TypeScript::InitObject(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoK AllocationSiteTable::Ptr p = cx->compartment()->types.allocationSiteTable->lookup(key); if (p) - return p->value; + return p->value(); return cx->compartment()->types.addAllocationSiteTypeObject(cx, key); } diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 3b1f3de8b35..89345e8b62e 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -3008,7 +3008,7 @@ ProxyObject::trace(JSTracer *trc, JSObject *obj) */ Value key = ObjectValue(*referent); WrapperMap::Ptr p = proxy->compartment()->lookupWrapper(key); - JS_ASSERT(*p->value.unsafeGet() == ObjectValue(*proxy)); + JS_ASSERT(*p->value().unsafeGet() == ObjectValue(*proxy)); } } #endif diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index dd717dad9b3..40c18b08964 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -912,30 +912,30 @@ js::PCCounts JSScript::getPCCounts(jsbytecode *pc) { JS_ASSERT(containsPC(pc)); ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this); - return p->value.pcCountsVector[pcToOffset(pc)]; + return p->value().pcCountsVector[pcToOffset(pc)]; } void JSScript::addIonCounts(jit::IonScriptCounts *ionCounts) { ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this); - if (p->value.ionCounts) - ionCounts->setPrevious(p->value.ionCounts); - p->value.ionCounts = ionCounts; + if (p->value().ionCounts) + ionCounts->setPrevious(p->value().ionCounts); + p->value().ionCounts = ionCounts; } jit::IonScriptCounts * JSScript::getIonCounts() { ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this); - return p->value.ionCounts; + return p->value().ionCounts; } ScriptCounts JSScript::releaseScriptCounts() { ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this); - ScriptCounts counts = p->value; + ScriptCounts counts = p->value(); compartment()->scriptCountsMap->remove(p); hasScriptCounts = false; return counts; @@ -1082,7 +1082,7 @@ SourceDataCache::lookup(ScriptSource *ss, const AutoSuppressPurge &asp) if (!map_) return nullptr; if (Map::Ptr p = map_->lookup(ss)) - return p->value; + return p->value(); return nullptr; } @@ -1113,7 +1113,7 @@ SourceDataCache::purge() return; for (Map::Range r = map_->all(); !r.empty(); r.popFront()) - js_delete(const_cast(r.front().value)); + js_delete(const_cast(r.front().value())); js_delete(map_); map_ = nullptr; @@ -2164,7 +2164,7 @@ js::GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc) if (cache.code == script->code()) { JS_ASSERT(cache.map.initialized()); GSNCache::Map::Ptr p = cache.map.lookup(pc); - return p ? p->value : nullptr; + return p ? p->value() : nullptr; } size_t offset = 0; @@ -2591,7 +2591,7 @@ JSScript::debugScript() JS_ASSERT(map); DebugScriptMap::Ptr p = map->lookup(this); JS_ASSERT(p); - return p->value; + return p->value(); } DebugScript * @@ -2602,7 +2602,7 @@ JSScript::releaseDebugScript() JS_ASSERT(map); DebugScriptMap::Ptr p = map->lookup(this); JS_ASSERT(p); - DebugScript *debug = p->value; + DebugScript *debug = p->value(); map->remove(p); hasDebugScript = false; return debug; diff --git a/js/src/jswatchpoint.cpp b/js/src/jswatchpoint.cpp index 0a3d42d9a68..3488dac5af0 100644 --- a/js/src/jswatchpoint.cpp +++ b/js/src/jswatchpoint.cpp @@ -35,16 +35,17 @@ class AutoEntryHolder { public: AutoEntryHolder(JSContext *cx, Map &map, Map::Ptr p) - : map(map), p(p), gen(map.generation()), obj(cx, p->key.object), id(cx, p->key.id) { - JS_ASSERT(!p->value.held); - p->value.held = true; + : map(map), p(p), gen(map.generation()), obj(cx, p->key().object), id(cx, p->key().id) + { + JS_ASSERT(!p->value().held); + p->value().held = true; } ~AutoEntryHolder() { if (gen != map.generation()) p = map.lookup(WatchKey(obj, id)); if (p) - p->value.held = false; + p->value().held = false; } }; @@ -84,12 +85,12 @@ WatchpointMap::unwatch(JSObject *obj, jsid id, { if (Map::Ptr p = map.lookup(WatchKey(obj, id))) { if (handlerp) - *handlerp = p->value.handler; + *handlerp = p->value().handler; if (closurep) { // Read barrier to prevent an incorrectly gray closure from escaping the // watchpoint. See the comment before UnmarkGrayChildren in gc/Marking.cpp - JS::ExposeGCThingToActiveJS(p->value.closure, JSTRACE_OBJECT); - *closurep = p->value.closure; + JS::ExposeGCThingToActiveJS(p->value().closure, JSTRACE_OBJECT); + *closurep = p->value().closure; } map.remove(p); } @@ -100,7 +101,7 @@ WatchpointMap::unwatchObject(JSObject *obj) { for (Map::Enum e(map); !e.empty(); e.popFront()) { Map::Entry &entry = e.front(); - if (entry.key.object == obj) + if (entry.key().object == obj) e.removeFront(); } } @@ -115,14 +116,14 @@ bool WatchpointMap::triggerWatchpoint(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) { Map::Ptr p = map.lookup(WatchKey(obj, id)); - if (!p || p->value.held) + if (!p || p->value().held) return true; AutoEntryHolder holder(cx, map, p); /* Copy the entry, since GC would invalidate p. */ - JSWatchPointHandler handler = p->value.handler; - RootedObject closure(cx, p->value.closure); + JSWatchPointHandler handler = p->value().handler; + RootedObject closure(cx, p->value().closure); /* Determine the property's old value. */ Value old; @@ -156,27 +157,28 @@ WatchpointMap::markIteratively(JSTracer *trc) bool marked = false; for (Map::Enum e(map); !e.empty(); e.popFront()) { Map::Entry &entry = e.front(); - JSObject *priorKeyObj = entry.key.object; - jsid priorKeyId(entry.key.id.get()); - bool objectIsLive = IsObjectMarked(const_cast(&entry.key.object)); - if (objectIsLive || entry.value.held) { + JSObject *priorKeyObj = entry.key().object; + jsid priorKeyId(entry.key().id.get()); + bool objectIsLive = + IsObjectMarked(const_cast(&entry.key().object)); + if (objectIsLive || entry.value().held) { if (!objectIsLive) { - MarkObject(trc, const_cast(&entry.key.object), + MarkObject(trc, const_cast(&entry.key().object), "held Watchpoint object"); marked = true; } JS_ASSERT(JSID_IS_STRING(priorKeyId) || JSID_IS_INT(priorKeyId)); - MarkId(trc, const_cast(&entry.key.id), "WatchKey::id"); + MarkId(trc, const_cast(&entry.key().id), "WatchKey::id"); - if (entry.value.closure && !IsObjectMarked(&entry.value.closure)) { - MarkObject(trc, &entry.value.closure, "Watchpoint::closure"); + if (entry.value().closure && !IsObjectMarked(&entry.value().closure)) { + MarkObject(trc, &entry.value().closure, "Watchpoint::closure"); marked = true; } /* We will sweep this entry in sweepAll if !objectIsLive. */ - if (priorKeyObj != entry.key.object || priorKeyId != entry.key.id) - e.rekeyFront(WatchKey(entry.key.object, entry.key.id)); + if (priorKeyObj != entry.key().object || priorKeyId != entry.key().id) + e.rekeyFront(WatchKey(entry.key().object, entry.key().id)); } } return marked; @@ -187,14 +189,14 @@ WatchpointMap::markAll(JSTracer *trc) { for (Map::Enum e(map); !e.empty(); e.popFront()) { Map::Entry &entry = e.front(); - WatchKey key = entry.key; + WatchKey key = entry.key(); WatchKey prior = key; JS_ASSERT(JSID_IS_STRING(prior.id) || JSID_IS_INT(prior.id)); MarkObject(trc, const_cast(&key.object), "held Watchpoint object"); MarkId(trc, const_cast(&key.id), "WatchKey::id"); - MarkObject(trc, &entry.value.closure, "Watchpoint::closure"); + MarkObject(trc, &entry.value().closure, "Watchpoint::closure"); if (prior.object != key.object || prior.id != key.id) e.rekeyFront(key); @@ -215,12 +217,12 @@ WatchpointMap::sweep() { for (Map::Enum e(map); !e.empty(); e.popFront()) { Map::Entry &entry = e.front(); - JSObject *obj(entry.key.object); + JSObject *obj(entry.key().object); if (IsObjectAboutToBeFinalized(&obj)) { - JS_ASSERT(!entry.value.held); + JS_ASSERT(!entry.value().held); e.removeFront(); - } else if (obj != entry.key.object) { - e.rekeyFront(WatchKey(obj, entry.key.id)); + } else if (obj != entry.key().object) { + e.rekeyFront(WatchKey(obj, entry.key().id)); } } } @@ -241,7 +243,7 @@ WatchpointMap::trace(WeakMapTracer *trc) for (Map::Range r = map.all(); !r.empty(); r.popFront()) { Map::Entry &entry = r.front(); trc->callback(trc, nullptr, - entry.key.object.get(), JSTRACE_OBJECT, - entry.value.closure.get(), JSTRACE_OBJECT); + entry.key().object.get(), JSTRACE_OBJECT, + entry.value().closure.get(), JSTRACE_OBJECT); } } diff --git a/js/src/jsweakcache.h b/js/src/jsweakcache.h index 93629acd252..08637d3edec 100644 --- a/js/src/jsweakcache.h +++ b/js/src/jsweakcache.h @@ -89,7 +89,7 @@ class WeakValueCache : public HashMap void sweep(FreeOp *fop) { // Remove all entries whose values remain unmarked. for (Enum e(*this); !e.empty(); e.popFront()) { - if (gc::IsAboutToBeFinalized(e.front().value)) + if (gc::IsAboutToBeFinalized(e.front().value())) e.removeFront(); } @@ -97,7 +97,7 @@ class WeakValueCache : public HashMap // Once we've swept, all remaining edges should stay within the // known-live part of the graph. for (Range r = Base::all(); !r.empty(); r.popFront()) - JS_ASSERT(!gc::IsAboutToBeFinalized(r.front().value)); + JS_ASSERT(!gc::IsAboutToBeFinalized(r.front().value())); #endif } }; diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 3888f2d8976..9a052c3f611 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -200,9 +200,9 @@ WeakMap_get_impl(JSContext *cx, CallArgs args) if (ObjectValueMap::Ptr ptr = map->lookup(key)) { // Read barrier to prevent an incorrectly gray value from escaping the // weak map. See the comment before UnmarkGrayChildren in gc/Marking.cpp - ExposeValueToActiveJS(ptr->value.get()); + ExposeValueToActiveJS(ptr->value().get()); - args.rval().set(ptr->value); + args.rval().set(ptr->value()); return true; } } @@ -357,7 +357,7 @@ JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *objArg, JSObject **re // Prevent GC from mutating the weakmap while iterating. gc::AutoSuppressGC suppress(cx); for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) { - RootedObject key(cx, r.front().key); + RootedObject key(cx, r.front().key()); if (!cx->compartment()->wrap(cx, &key)) return false; if (!js_NewbornArrayPush(cx, arr, ObjectValue(*key))) diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h index fed7c05ed49..4b4c829beee 100644 --- a/js/src/jsweakmap.h +++ b/js/src/jsweakmap.h @@ -148,16 +148,16 @@ class WeakMap : public HashMap, publ void nonMarkingTraceKeys(JSTracer *trc) { for (Enum e(*this); !e.empty(); e.popFront()) { - Key key(e.front().key); + Key key(e.front().key()); gc::Mark(trc, &key, "WeakMap entry key"); - if (key != e.front().key) + if (key != e.front().key()) entryMoved(e, key); } } void nonMarkingTraceValues(JSTracer *trc) { for (Range r = Base::all(); !r.empty(); r.popFront()) - gc::Mark(trc, &r.front().value, "WeakMap entry value"); + gc::Mark(trc, &r.front().value(), "WeakMap entry value"); } bool keyNeedsMark(JSObject *key) { @@ -181,17 +181,17 @@ class WeakMap : public HashMap, publ bool markedAny = false; for (Enum e(*this); !e.empty(); e.popFront()) { /* If the entry is live, ensure its key and value are marked. */ - Key key(e.front().key); + Key key(e.front().key()); if (gc::IsMarked(const_cast(&key))) { - if (markValue(trc, &e.front().value)) + if (markValue(trc, &e.front().value())) markedAny = true; - if (e.front().key != key) + if (e.front().key() != key) entryMoved(e, key); } else if (keyNeedsMark(key)) { - gc::Mark(trc, const_cast(&key), "proxy-preserved WeakMap entry key"); - if (e.front().key != key) + gc::Mark(trc, &key, "proxy-preserved WeakMap entry key"); + if (e.front().key() != key) entryMoved(e, key); - gc::Mark(trc, &e.front().value, "WeakMap entry value"); + gc::Mark(trc, &e.front().value(), "WeakMap entry value"); markedAny = true; } key.unsafeSet(nullptr); @@ -202,10 +202,10 @@ class WeakMap : public HashMap, publ void sweep() { /* Remove all entries whose keys remain unmarked. */ for (Enum e(*this); !e.empty(); e.popFront()) { - Key k(e.front().key); + Key k(e.front().key()); if (gc::IsAboutToBeFinalized(&k)) e.removeFront(); - else if (k != e.front().key) + else if (k != e.front().key()) entryMoved(e, k); } /* @@ -218,12 +218,12 @@ class WeakMap : public HashMap, publ /* memberOf can be nullptr, which means that the map is not part of a JSObject. */ void traceMappings(WeakMapTracer *tracer) { for (Range r = Base::all(); !r.empty(); r.popFront()) { - gc::Cell *key = gc::ToMarkable(r.front().key); - gc::Cell *value = gc::ToMarkable(r.front().value); + gc::Cell *key = gc::ToMarkable(r.front().key()); + gc::Cell *value = gc::ToMarkable(r.front().value()); if (key && value) { tracer->callback(tracer, memberOf, - key, gc::TraceKind(r.front().key), - value, gc::TraceKind(r.front().value)); + key, gc::TraceKind(r.front().key()), + value, gc::TraceKind(r.front().value())); } } } @@ -242,10 +242,10 @@ protected: void assertEntriesNotAboutToBeFinalized() { #if DEBUG for (Range r = Base::all(); !r.empty(); r.popFront()) { - Key k(r.front().key); + Key k(r.front().key()); JS_ASSERT(!gc::IsAboutToBeFinalized(&k)); - JS_ASSERT(!gc::IsAboutToBeFinalized(&r.front().value)); - JS_ASSERT(k == r.front().key); + JS_ASSERT(!gc::IsAboutToBeFinalized(&r.front().value())); + JS_ASSERT(k == r.front().key()); } #endif } diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index 72f120e9f06..53e29f60bd4 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -893,7 +893,7 @@ js::NukeCrossCompartmentWrappers(JSContext* cx, for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { // Some cross-compartment wrappers are for strings. We're not // interested in those. - const CrossCompartmentKey &k = e.front().key; + const CrossCompartmentKey &k = e.front().key(); if (k.kind != CrossCompartmentKey::ObjectWrapper) continue; @@ -941,7 +941,7 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg) // The old value should still be in the cross-compartment wrapper map, and // the lookup should return wobj. WrapperMap::Ptr p = wcompartment->lookupWrapper(origv); - JS_ASSERT(&p->value.unsafeGet()->toObject() == wobj); + JS_ASSERT(&p->value().unsafeGet()->toObject() == wobj); wcompartment->removeWrapper(p); // When we remove origv from the wrapper map, its wrapper, wobj, must @@ -1025,7 +1025,7 @@ js::RecomputeWrappers(JSContext *cx, const CompartmentFilter &sourceFilter, // Iterate over the wrappers, filtering appropriately. for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { // Filter out non-objects. - const CrossCompartmentKey &k = e.front().key; + const CrossCompartmentKey &k = e.front().key(); if (k.kind != CrossCompartmentKey::ObjectWrapper) continue; diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index ded94ab193b..3bdb618a435 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -246,8 +246,8 @@ class HeapReverser : public JSTracer, public JS::CustomAutoRooter if (!map.initialized()) return; for (Map::Enum e(map); !e.empty(); e.popFront()) { - gc::MarkGCThingRoot(trc, const_cast(&e.front().key), "HeapReverser::map::key"); - e.front().value.trace(trc); + gc::MarkGCThingRoot(trc, const_cast(&e.front().key()), "HeapReverser::map::key"); + e.front().value().trace(trc); } for (Child *c = work.begin(); c != work.end(); ++c) gc::MarkGCThingRoot(trc, &c->cell, "HeapReverser::Child"); @@ -281,7 +281,7 @@ HeapReverser::traverseEdge(void *cell, JSGCTraceKind kind) } /* Add this edge to the reversed map. */ - return a->value.incoming.append(Move(e)); + return a->value().incoming.append(Move(e)); } bool @@ -427,7 +427,7 @@ ReferenceFinder::visit(void *cell, Path *path) HeapReverser::Map::Ptr p = reverser.map.lookup(cell); JS_ASSERT(p); - HeapReverser::Node *node = &p->value; + HeapReverser::Node *node = &p->value(); /* Is |cell| a representable cell, reached via a non-empty path? */ if (path != nullptr) { diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 9711155e2c6..c426d29fa0d 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -211,7 +211,7 @@ class Debugger::FrameRange JSObject *frontFrame() const { JS_ASSERT(!empty()); - return entry->value; + return entry->value(); } Debugger *frontDebugger() const { @@ -468,7 +468,7 @@ Debugger::getScriptFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleVal return false; } } - vp.setObject(*p->value); + vp.setObject(*p->value()); return true; } @@ -501,7 +501,7 @@ Debugger::hasAnyLiveHooks() const } for (FrameMap::Range r = frames.all(); !r.empty(); r.popFront()) { - JSObject *frameObj = r.front().value; + JSObject *frameObj = r.front().value(); if (!frameObj->getReservedSlot(JSSLOT_DEBUGFRAME_ONSTEP_HANDLER).isUndefined() || !frameObj->getReservedSlot(JSSLOT_DEBUGFRAME_ONPOP_HANDLER).isUndefined()) return true; @@ -674,7 +674,7 @@ Debugger::wrapEnvironment(JSContext *cx, Handle env, MutableHandleValue rv JSObject *envobj; DependentAddPtr p(cx, environments, env); if (p) { - envobj = p->value; + envobj = p->value(); } else { /* Create a new Debugger.Environment for env. */ JSObject *proto = &object->getReservedSlot(JSSLOT_DEBUG_ENV_PROTO).toObject(); @@ -715,7 +715,7 @@ Debugger::wrapDebuggeeValue(JSContext *cx, MutableHandleValue vp) DependentAddPtr p(cx, objects, obj); if (p) { - vp.setObject(*p->value); + vp.setObject(*p->value()); } else { /* Create a new Debugger.Object for obj. */ JSObject *proto = &object->getReservedSlot(JSSLOT_DEBUG_OBJECT_PROTO).toObject(); @@ -1267,8 +1267,8 @@ Debugger::onSingleStep(JSContext *cx, MutableHandleValue vp) for (Debugger **p = debuggers->begin(); p != debuggers->end(); p++) { Debugger *dbg = *p; for (FrameMap::Range r = dbg->frames.all(); !r.empty(); r.popFront()) { - AbstractFramePtr frame = r.front().key; - JSObject *frameobj = r.front().value; + AbstractFramePtr frame = r.front().key(); + JSObject *frameobj = r.front().value(); if (frame.script() == trappingScript && !frameobj->getReservedSlot(JSSLOT_DEBUGFRAME_ONSTEP_HANDLER).isUndefined()) { @@ -1594,7 +1594,7 @@ Debugger::trace(JSTracer *trc) * frames.) */ for (FrameMap::Range r = frames.all(); !r.empty(); r.popFront()) { - RelocatablePtrObject &frameobj = r.front().value; + RelocatablePtrObject &frameobj = r.front().value(); JS_ASSERT(frameobj->getPrivate()); MarkObject(trc, &frameobj, "live Debugger.Frame"); } @@ -2272,9 +2272,9 @@ Debugger::removeDebuggeeGlobal(FreeOp *fop, GlobalObject *global, * which slowPathOnLeaveFrame would have to examine. */ for (FrameMap::Enum e(frames); !e.empty(); e.popFront()) { - AbstractFramePtr frame = e.front().key; + AbstractFramePtr frame = e.front().key(); if (&frame.script()->global() == global) { - DebuggerFrame_freeScriptFrameIterData(fop, e.front().value); + DebuggerFrame_freeScriptFrameIterData(fop, e.front().value()); e.removeFront(); } } @@ -2454,7 +2454,7 @@ class Debugger::ScriptQuery { for (CompartmentToScriptMap::Range r = innermostForCompartment.all(); !r.empty(); r.popFront()) { - if (!v->append(r.front().value)) { + if (!v->append(r.front().value())) { js_ReportOutOfMemory(cx); return false; } @@ -2599,9 +2599,9 @@ class Debugger::ScriptQuery { CompartmentToScriptMap::AddPtr p = innermostForCompartment.lookupForAdd(compartment); if (p) { /* Is our newly found script deeper than the last one we found? */ - JSScript *incumbent = p->value; + JSScript *incumbent = p->value(); if (script->staticLevel > incumbent->staticLevel) - p->value = script; + p->value() = script; } else { /* * This is the first matching script we've encountered for this @@ -2818,8 +2818,8 @@ Debugger::wrapScript(JSContext *cx, HandleScript script) } } - JS_ASSERT(GetScriptReferent(p->value) == script); - return p->value; + JS_ASSERT(GetScriptReferent(p->value()) == script); + return p->value(); } static JSObject * @@ -3711,8 +3711,8 @@ Debugger::wrapSource(JSContext *cx, HandleScriptSource source) } } - JS_ASSERT(GetSourceReferent(p->value) == source); - return p->value; + JS_ASSERT(GetSourceReferent(p->value()) == source); + return p->value(); } static bool diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 323998805b2..b10df4e42de 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -107,9 +107,9 @@ class DebuggerWeakMap : private WeakMap > public: void markKeys(JSTracer *tracer) { for (Enum e(*static_cast(this)); !e.empty(); e.popFront()) { - Key key = e.front().key; + Key key = e.front().key(); gc::Mark(tracer, &key, "Debugger WeakMap key"); - if (key != e.front().key) + if (key != e.front().key()) e.rekeyFront(key); key.unsafeSet(nullptr); } @@ -117,7 +117,7 @@ class DebuggerWeakMap : private WeakMap > bool hasKeyInZone(JS::Zone *zone) { CountMap::Ptr p = zoneCounts.lookup(zone); - JS_ASSERT_IF(p, p->value > 0); + JS_ASSERT_IF(p, p->value() > 0); return p; } @@ -125,7 +125,7 @@ class DebuggerWeakMap : private WeakMap > /* Override sweep method to also update our edge cache. */ void sweep() { for (Enum e(*static_cast(this)); !e.empty(); e.popFront()) { - Key k(e.front().key); + Key k(e.front().key()); if (gc::IsAboutToBeFinalized(&k)) { e.removeFront(); decZoneCount(k->zone()); @@ -138,16 +138,16 @@ class DebuggerWeakMap : private WeakMap > CountMap::Ptr p = zoneCounts.lookupWithDefault(zone, 0); if (!p) return false; - ++p->value; + ++p->value(); return true; } void decZoneCount(JS::Zone *zone) { CountMap::Ptr p = zoneCounts.lookup(zone); JS_ASSERT(p); - JS_ASSERT(p->value > 0); - --p->value; - if (p->value == 0) + JS_ASSERT(p->value() > 0); + --p->value(); + if (p->value() == 0) zoneCounts.remove(zone); } }; diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 3175beeb994..ef93142822e 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -289,7 +289,7 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin normalStringThingSize, strCharsSize); zStats->strings.add(p, str, info); } else { - p->value.add(shortStringThingSize, normalStringThingSize, strCharsSize); + p->value().add(shortStringThingSize, normalStringThingSize, strCharsSize); } } @@ -393,8 +393,8 @@ FindNotableStrings(ZoneStats &zStats) for (ZoneStats::StringsHashMap::Range r = zStats.strings.all(); !r.empty(); r.popFront()) { - JSString *str = r.front().key; - StringInfo &info = r.front().value; + JSString *str = r.front().key(); + StringInfo &info = r.front().value(); // If this string is too small, or if we can't grow the notableStrings // vector, skip this string. diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 1152ba3552f..5c42bc2b0ce 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -669,7 +669,7 @@ RegExpCompartment::sweep(JSRuntime *rt) { #ifdef DEBUG for (Map::Range r = map_.all(); !r.empty(); r.popFront()) - JS_ASSERT(inUse_.has(r.front().value)); + JS_ASSERT(inUse_.has(r.front().value())); #endif map_.clear(); @@ -696,7 +696,7 @@ RegExpCompartment::get(ExclusiveContext *cx, JSAtom *source, RegExpFlag flags, R Key key(source, flags); Map::AddPtr p = map_.lookupForAdd(key); if (p) { - g->init(*p->value); + g->init(*p->value()); return true; } diff --git a/js/src/vm/SPSProfiler.cpp b/js/src/vm/SPSProfiler.cpp index e3d19ea1160..a968778a00d 100644 --- a/js/src/vm/SPSProfiler.cpp +++ b/js/src/vm/SPSProfiler.cpp @@ -33,7 +33,7 @@ SPSProfiler::~SPSProfiler() { if (strings.initialized()) { for (ProfileStringMap::Enum e(strings); !e.empty(); e.popFront()) - js_free(const_cast(e.front().value)); + js_free(const_cast(e.front().value())); } } @@ -80,7 +80,7 @@ SPSProfiler::profileString(JSContext *cx, JSScript *script, JSFunction *maybeFun JS_ASSERT(strings.initialized()); ProfileStringMap::AddPtr s = strings.lookupForAdd(script); if (s) - return s->value; + return s->value(); const char *str = allocProfileString(cx, script, maybeFun); if (str == nullptr) return nullptr; @@ -104,7 +104,7 @@ SPSProfiler::onScriptFinalized(JSScript *script) if (!strings.initialized()) return; if (ProfileStringMap::Ptr entry = strings.lookup(script)) { - const char *tofree = entry->value; + const char *tofree = entry->value(); strings.remove(entry); js_free(const_cast(tofree)); } diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 740df8ff9ec..8e0aa3365a2 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -94,7 +94,7 @@ js::ScopeCoordinateName(ScopeCoordinateNameCache &cache, JSScript *script, jsbyt ScopeCoordinate sc(pc); if (shape == cache.shape) { ScopeCoordinateNameCache::Map::Ptr p = cache.map.lookup(sc.slot); - id = p->value; + id = p->value(); } else { Shape::Range r(shape); while (r.front().slot() != sc.slot) @@ -1592,13 +1592,13 @@ DebugScopes::sweep(JSRuntime *rt) * creating an uncollectable cycle with suspended generator frames. */ for (MissingScopeMap::Enum e(missingScopes); !e.empty(); e.popFront()) { - if (IsObjectAboutToBeFinalized(e.front().value.unsafeGet())) + if (IsObjectAboutToBeFinalized(e.front().value().unsafeGet())) e.removeFront(); } for (LiveScopeMap::Enum e(liveScopes); !e.empty(); e.popFront()) { - ScopeObject *scope = e.front().key; - AbstractFramePtr frame = e.front().value; + ScopeObject *scope = e.front().key(); + AbstractFramePtr frame = e.front().value(); /* * Scopes can be finalized when a debugger-synthesized ScopeObject is @@ -1661,7 +1661,7 @@ DebugScopes::hasDebugScope(JSContext *cx, ScopeObject &scope) if (ObjectWeakMap::Ptr p = scopes->proxiedScopes.lookup(&scope)) { JS_ASSERT(CanUseDebugScopeMaps(cx)); - return &p->value->as(); + return &p->value()->as(); } return nullptr; @@ -1701,7 +1701,7 @@ DebugScopes::hasDebugScope(JSContext *cx, const ScopeIter &si) if (MissingScopeMap::Ptr p = scopes->missingScopes.lookup(si)) { JS_ASSERT(CanUseDebugScopeMaps(cx)); - return p->value; + return p->value(); } return nullptr; } @@ -1758,11 +1758,11 @@ DebugScopes::onPopCall(AbstractFramePtr frame, JSContext *cx) CallObject &callobj = frame.scopeChain()->as(); scopes->liveScopes.remove(&callobj); if (ObjectWeakMap::Ptr p = scopes->proxiedScopes.lookup(&callobj)) - debugScope = &p->value->as(); + debugScope = &p->value()->as(); } else { ScopeIter si(frame, cx); if (MissingScopeMap::Ptr p = scopes->missingScopes.lookup(si)) { - debugScope = p->value; + debugScope = p->value(); scopes->liveScopes.remove(&debugScope->scope().as()); scopes->missingScopes.remove(p); } @@ -1831,7 +1831,7 @@ DebugScopes::onPopBlock(JSContext *cx, AbstractFramePtr frame) } else { ScopeIter si(frame, cx); if (MissingScopeMap::Ptr p = scopes->missingScopes.lookup(si)) { - ClonedBlockObject &clone = p->value->scope().as(); + ClonedBlockObject &clone = p->value()->scope().as(); clone.copyUnaliasedValues(frame); scopes->liveScopes.remove(&clone); scopes->missingScopes.remove(p); @@ -1881,7 +1881,7 @@ DebugScopes::onGeneratorFrameChange(AbstractFramePtr from, AbstractFramePtr to, JS_ASSERT(toIter.scope().compartment() == cx->compartment()); LiveScopeMap::AddPtr livePtr = scopes->liveScopes.lookupForAdd(&toIter.scope()); if (livePtr) { - livePtr->value = to; + livePtr->value() = to; } else { scopes->liveScopes.add(livePtr, &toIter.scope(), to); // OOM here? liveScopesPostWriteBarrier(cx->runtime(), &scopes->liveScopes, &toIter.scope()); @@ -1890,8 +1890,8 @@ DebugScopes::onGeneratorFrameChange(AbstractFramePtr from, AbstractFramePtr to, ScopeIter si(toIter, from, cx); JS_ASSERT(si.frame().scopeChain()->compartment() == cx->compartment()); if (MissingScopeMap::Ptr p = scopes->missingScopes.lookup(si)) { - DebugScopeObject &debugScope = *p->value; - scopes->liveScopes.lookup(&debugScope.scope())->value = to; + DebugScopeObject &debugScope = *p->value(); + scopes->liveScopes.lookup(&debugScope.scope())->value() = to; scopes->missingScopes.remove(p); scopes->missingScopes.put(toIter, &debugScope); // OOM here? } @@ -1967,7 +1967,7 @@ DebugScopes::hasLiveFrame(ScopeObject &scope) return NullFramePtr(); if (LiveScopeMap::Ptr p = scopes->liveScopes.lookup(&scope)) { - AbstractFramePtr frame = p->value; + AbstractFramePtr frame = p->value(); /* * Since liveScopes is effectively a weak pointer, we need a read diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 82e43976456..e518e00f759 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -891,7 +891,7 @@ CloneObject(JSContext *cx, HandleObject srcObj, CloneMemory &clonedObjects) { DependentAddPtr p(cx, clonedObjects, srcObj.get()); if (p) - return p->value; + return p->value(); RootedObject clone(cx); if (srcObj->is()) { if (srcObj->as().isWrappable()) { diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index c174955e410..171cf9238b1 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -829,7 +829,7 @@ JSStructuredCloneWriter::startObject(HandleObject obj, bool *backref) /* Handle cycles in the object graph. */ CloneMemory::AddPtr p = memory.lookupForAdd(obj); if ((*backref = p)) - return out.writePair(SCTAG_BACK_REFERENCE_OBJECT, p->value); + return out.writePair(SCTAG_BACK_REFERENCE_OBJECT, p->value()); if (!memory.add(p, obj, memory.count())) return false; diff --git a/js/xpconnect/src/XPCMaps.cpp b/js/xpconnect/src/XPCMaps.cpp index 152d0041b73..ebde7ef0152 100644 --- a/js/xpconnect/src/XPCMaps.cpp +++ b/js/xpconnect/src/XPCMaps.cpp @@ -85,7 +85,7 @@ void JSObject2WrappedJSMap::FindDyingJSObjects(nsTArray* dying) { for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) { - nsXPCWrappedJS* wrapper = r.front().value; + nsXPCWrappedJS* wrapper = r.front().value(); MOZ_ASSERT(wrapper, "found a null JS wrapper!"); // walk the wrapper chain and find any whose JSObject is to be finalized @@ -101,7 +101,7 @@ void JSObject2WrappedJSMap::ShutdownMarker() { for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) { - nsXPCWrappedJS* wrapper = r.front().value; + nsXPCWrappedJS* wrapper = r.front().value(); MOZ_ASSERT(wrapper, "found a null JS wrapper!"); MOZ_ASSERT(wrapper->IsValid(), "found an invalid JS wrapper!"); wrapper->SystemIsBeingShutDown(); diff --git a/js/xpconnect/src/XPCMaps.h b/js/xpconnect/src/XPCMaps.h index 0cc7c358eae..0c44bcd3f00 100644 --- a/js/xpconnect/src/XPCMaps.h +++ b/js/xpconnect/src/XPCMaps.h @@ -41,7 +41,7 @@ public: inline nsXPCWrappedJS* Find(JSObject* Obj) { NS_PRECONDITION(Obj,"bad param"); Map::Ptr p = mTable.lookup(Obj); - return p ? p->value : nullptr; + return p ? p->value() : nullptr; } inline nsXPCWrappedJS* Add(JSContext* cx, nsXPCWrappedJS* wrapper) { @@ -49,7 +49,7 @@ public: JSObject* obj = wrapper->GetJSObjectPreserveColor(); Map::AddPtr p = mTable.lookupForAdd(obj); if (p) - return p->value; + return p->value(); if (!mTable.add(p, obj, wrapper)) return nullptr; JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, obj, this); @@ -65,7 +65,7 @@ public: inline void Dump(int16_t depth) { for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) - r.front().value->DebugDump(depth); + r.front().value()->DebugDump(depth); } void FindDyingJSObjects(nsTArray* dying); @@ -634,7 +634,7 @@ public: inline JSObject* Find(JSObject* key) { NS_PRECONDITION(key, "bad param"); if (Map::Ptr p = mTable.lookup(key)) - return p->value; + return p->value(); return nullptr; } @@ -643,7 +643,7 @@ public: NS_PRECONDITION(key,"bad param"); Map::AddPtr p = mTable.lookupForAdd(key); if (p) - return p->value; + return p->value(); if (!mTable.add(p, key, value)) return nullptr; MOZ_ASSERT(xpc::GetCompartmentPrivate(key)->scope->mWaiverWrapperMap == this); @@ -660,10 +660,10 @@ public: void Sweep() { for (Map::Enum e(mTable); !e.empty(); e.popFront()) { - JSObject *updated = e.front().key; - if (JS_IsAboutToBeFinalizedUnbarriered(&updated) || JS_IsAboutToBeFinalized(&e.front().value)) + JSObject *updated = e.front().key(); + if (JS_IsAboutToBeFinalizedUnbarriered(&updated) || JS_IsAboutToBeFinalized(&e.front().value())) e.removeFront(); - else if (updated != e.front().key) + else if (updated != e.front().key()) e.rekeyFront(updated); } } @@ -675,12 +675,12 @@ public: * We reparent wrappers that have as their parent an inner window * whose outer has the new inner window as its current inner. */ - JS::RootedObject parent(aCx, JS_GetParent(e.front().value)); + JS::RootedObject parent(aCx, JS_GetParent(e.front().value())); JS::RootedObject outer(aCx, JS_ObjectToOuterObject(aCx, parent)); if (outer) { JSObject *inner = JS_ObjectToInnerObject(aCx, outer); if (inner == aNewInner && inner != parent) - JS_SetParent(aCx, e.front().value, aNewInner); + JS_SetParent(aCx, e.front().value(), aNewInner); } else { JS_ClearPendingException(aCx); } diff --git a/layout/style/nsNthIndexCache.cpp b/layout/style/nsNthIndexCache.cpp index 63e2c8d9985..07ac7c1d2f1 100644 --- a/layout/style/nsNthIndexCache.cpp +++ b/layout/style/nsNthIndexCache.cpp @@ -48,7 +48,7 @@ nsNthIndexCache::IndexDeterminedFromPreviousSibling(nsIContent* aSibling, if (SiblingMatchesElement(aSibling, aChild, aIsOfType)) { Cache::Ptr siblingEntry = aCache.lookup(aSibling); if (siblingEntry) { - int32_t siblingIndex = siblingEntry->value; + int32_t siblingIndex = siblingEntry->value(); NS_ASSERTION(siblingIndex != 0, "How can a non-anonymous node have an anonymous sibling?"); if (siblingIndex > 0) { @@ -93,7 +93,7 @@ nsNthIndexCache::GetNthIndex(Element* aChild, bool aIsOfType, return 0; } - int32_t &slot = entry->value; + int32_t &slot = entry->value(); if (slot != -2 && (slot != -1 || aCheckEdgeOnly)) { return slot; }