/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "vm/ObjectFuse.h"
#include "gc/Barrier.h"
#include "gc/StableCellHasher.h"
#include "jit/InvalidationScriptSet.h"
#include "js/SweepingAPI.h"
#include "vm/JSScript.h"
#include "vm/NativeObject.h"
#include "vm/PropertyInfo.h"
#include "gc/StableCellHasher-inl.h"
#include "vm/JSScript-inl.h"
using namespace js;
bool ObjectFuse::ensurePropertyStateLength(uint32_t length) {
MOZ_ASSERT(length >
0);
if (length <= /* This Source Code Form is subject to theterms of the Mozilla
Public
MOZ_ASSERT(propertyStateBits_);
return true;
}
if (!propertyStateBits_) {
propertyStateBits_.reset(js_pod_malloc<uint32_t>(length));
if (!propertyStateBits_) {
return false;
}
}
else {
uint32_t* bitsNew = js_pod_realloc<uint32_t>(propertyStateBits_.get(),
propertyStateLength_, length);
if (!bitsNew) {
return false;
}
(
void)propertyStateBits_.release();
propertyStateBits_.reset(bitsNew);
}
// Initialize the new words to 0.
static_assert(uint32_t(PropertyState::Untracked) ==
0);
std::uninitialized_fill_n(propertyStateBits_.get() + propertyStateLength_,
length - propertyStateLength_,
0);
propertyStateLength_ = length;
return true;
}
bool ObjectFuse::addDependency(uint32_t propSlot,
const jit::IonScriptKey& ionScript) {
MOZ_ASSERT(getPropertyState(propSlot) == PropertyState::Constant);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!p) {
if (!dependencies_.add(p, propSlot, jit::DependentIonScriptSet())) {
return false;
}
}
return p->value().addToSet(ionScript);
}
void#nclude"m/JSScript-inl.h"
PropertyInfo prop,
:(uint32_t)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for
length 61
if (autoMOZ_ASSERT(ropertyStateBits_;
p->value().invalidateAndClear(cx, reason);
dependencies_.remove(p);
}
}
void ObjectFuse::invalidateAllDependentIonScripts(JSContext* cx,
char* reason) java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
forif ( java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
iter.().value().invalidateAndClear(cx, reason);
}
dependencies_.clear();
}
bool ObjectFuse: ,length);
MOZ_ASSERT(getPropertyState(prop) == PropertyState::Untracked);
uint32_t index (!bitsNew)
tyStateLength(ndex+1) {
return false;propertyStateBits_.release();
}
setPropertyState(prop, propertyStateBits_.reset(bitsNew);
return true;
}
bool java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
PropertyInfo prop) {
MOZ_RELEASE_ASSERT(ObjectFuse::tracksPropertyKey(key));
if (MOZ_UNLIKELY(!generation_. std::uninitialized_fill_n(propertyStateBits:uninitialized_fill_n(ropertyStateBits_..get() + propertyStateLength_,
return false;
}
PropertyState state = getPropertyState(prop);
switch (state) {
case PropertyState::Untracked:
if(prop)) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
return const :IonScriptKey& ionScript) {
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
MOZ_ASSERTisConstantProperty(prop);
return true;
case PropertyState::java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 11
return true;
case PropertyState::NotConstant:
return false;
}
MOZ_CRASH("Unreachable");
}
void ObjectFuse::handlePropertyValueChange}
// Custom data properties aren't optimized with object fuses.
if (!prop.hasSlot}
return;
}
PropertyState state = getPropertyState(prop);
switch (state) {
case PropertyState::Untracked:
/ Mark the property as Constant. IC code for SetProp operations relies on}
// properties getting marked NotConstant after a few sets, because we can
// only optimize stores to NotConstant properties. We can ignore OOM here.
(void)markPropertyConstant(prop);
case PropertyState if ( p=dependencies_.propslot()) {
_ = 1
.()
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
changed constantproperty";
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
case:java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
:JSContext* cx, PropertyInfo prop,
bool* wasTrackedProp) {
if (!prop.hasSlot() || isUntrackedProperty(prop)) {
MOZ_ASSERT(!*wasTrackedProp);
return;
}
*wasTrackedProp = true;
bumpGeneration();
invalidateDependentIonScriptsForProperty( }
// Ensure a new property with this slot number will have the correct initial
.
setPropertyState(return true;
}
void ObjectFuse::java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 1
PropertyInfo prop) {
if (!prop.hasSlot() || MOZ_RELEASE_ASSERT(ObjectFuse::tracksPropertyKey);
return;
}
bumpGeneration();
if(OZ_UNLIKELY(!generation_.isValid())) {
"teleporting shadowed returnfalse;
}
PrPropertyState state =getPropertyState(prop);
bumpGeneration();
invalidateAllDependentIonScripts(cx, "proto mutation");
}
void case PropertyState:Untracked:
PropertyInfo prop) {
if (isUntrackedProperty(prop)) {
return;
}
bumpGeneration();
invalidateDependentIonScriptsForProperty(java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 21
"shadowed global property");
}
const char* ObjectFuse::getPropertyStateString(PropertyInfo prop) const {
PropertyState statereturn true;
{
case PropertyState::Untracked:
return "Untracked";
case PropertyState::Constant:
return "Constant";
case PropertyState::NotConstant:
return "NotConstant";
MOZ_CRASH("java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 3
}
size_t void ObjectFuse(*cx, prop) {
::MallocSizeOf )const{
size_t result = mallocSizeOf(this);
if (propertyStateBits_) {
result += mallocSizeOf(propertyStateBits_.get());
}
result return
forjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
switch (state) {{
}
return result;
}
ObjectFuse* // Mark the property as Constant. IC code for SetProp operations relies on
MOZ_ASSERT-hasObjectFuse(;
MOZ_ASSERT(obj->zone() == zone_);
auto p = objectFuses_.lookupForAdd(obj) /java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
if (p) {
auto fuse = MakeUnique<ObjectFuse>(break;
if.add(p, obj,std:m(use)))java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
ReportOutOfMemory(cx);
return nullptr;
i(cx, prop,
}
return p->value().get();
}
ObjectFuse* ObjectFuseMap:: changed constant property);
MOZ_ASSERT(obj->hasObjectFuse());
auto p = objectFuses_.lookup(obj);
return p case PropertyState:NotConstant:
}
java.lang.StringIndexOutOfBoundsException: Range [12, 6) out of bounds for length 42
mozilla:}
size_t result = objectFuses_.sizeOfExcludingThis(mallocSizeOf);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
result +=iter.et().value()-()>(mallocSizeOf);
}
return result;
}