Remove Unboxed Object code from jit, Part 3.

This commit is contained in:
wolfbeast 2019-06-23 21:30:34 +00:00 • committed by Roy Tam
commit bc5121a769
6 changed files with 10 additions and 85 deletions

View file

@ -42,8 +42,8 @@
#include "jit/shared/Lowering-shared-inl.h" #include "jit/shared/Lowering-shared-inl.h"
#include "vm/EnvironmentObject-inl.h" #include "vm/EnvironmentObject-inl.h"
#include "vm/Interpreter-inl.h" #include "vm/Interpreter-inl.h"
#include "vm/NativeObject-inl.h"
#include "vm/StringObject-inl.h" #include "vm/StringObject-inl.h"
#include "vm/UnboxedObject-inl.h"
using mozilla::DebugOnly; using mozilla::DebugOnly;
@ -732,11 +732,6 @@ LastPropertyForSetProp(JSObject* obj)
if (obj->isNative()) if (obj->isNative())
return obj->as<NativeObject>().lastProperty(); return obj->as<NativeObject>().lastProperty();
if (obj->is<UnboxedPlainObject>()) {
UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando();
return expando ? expando->lastProperty() : nullptr;
}
return nullptr; return nullptr;
} }
@ -2666,18 +2661,6 @@ BaselineScript::noteArrayWriteHole(uint32_t pcOffset)
// SetElem_DenseOrUnboxedArray // SetElem_DenseOrUnboxedArray
// //
template <typename T>
void
EmitUnboxedPreBarrierForBaseline(MacroAssembler &masm, T address, JSValueType type)
{
if (type == JSVAL_TYPE_OBJECT)
EmitPreBarrier(masm, address, MIRType::Object);
else if (type == JSVAL_TYPE_STRING)
EmitPreBarrier(masm, address, MIRType::String);
else
MOZ_ASSERT(!UnboxedTypeNeedsPreBarrier(type));
}
bool bool
ICSetElem_DenseOrUnboxedArray::Compiler::generateStubCode(MacroAssembler& masm) ICSetElem_DenseOrUnboxedArray::Compiler::generateStubCode(MacroAssembler& masm)
{ {
@ -4124,18 +4107,7 @@ TryAttachSetValuePropStub(JSContext* cx, HandleScript script, jsbytecode* pc, IC
return true; return true;
if (!obj->isNative()) { if (!obj->isNative()) {
if (obj->is<UnboxedPlainObject>()) {
UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando();
if (expando) {
shape = expando->lookup(cx, name);
if (!shape)
return true; return true;
} else {
return true;
}
} else {
return true;
}
} }
size_t chainDepth; size_t chainDepth;
@ -4368,12 +4340,6 @@ DoSetPropFallback(JSContext* cx, BaselineFrame* frame, ICSetProp_Fallback* stub_
return false; return false;
RootedReceiverGuard oldGuard(cx, ReceiverGuard(obj)); RootedReceiverGuard oldGuard(cx, ReceiverGuard(obj));
if (obj->is<UnboxedPlainObject>()) {
MOZ_ASSERT(!oldShape);
if (UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando())
oldShape = expando->lastProperty();
}
bool attached = false; bool attached = false;
// There are some reasons we can fail to attach a stub that are temporary. // There are some reasons we can fail to attach a stub that are temporary.
// We want to avoid calling noteUnoptimizableAccess() if the reason we // We want to avoid calling noteUnoptimizableAccess() if the reason we
@ -5538,7 +5504,7 @@ TryAttachCallStub(JSContext* cx, ICCall_Fallback* stub, HandleScript script, jsb
if (!thisObject) if (!thisObject)
return false; return false;
if (thisObject->is<PlainObject>() || thisObject->is<UnboxedPlainObject>()) if (thisObject->is<PlainObject>())
templateObject = thisObject; templateObject = thisObject;
} }

View file

@ -22,7 +22,6 @@
#include "jit/SharedICRegisters.h" #include "jit/SharedICRegisters.h"
#include "js/GCVector.h" #include "js/GCVector.h"
#include "vm/ArrayObject.h" #include "vm/ArrayObject.h"
#include "vm/UnboxedObject.h"
namespace js { namespace js {
namespace jit { namespace jit {
@ -1823,8 +1822,7 @@ class ICSetProp_Native : public ICUpdatedStub
virtual int32_t getKey() const { virtual int32_t getKey() const {
return static_cast<int32_t>(engine_) | return static_cast<int32_t>(engine_) |
(static_cast<int32_t>(kind) << 1) | (static_cast<int32_t>(kind) << 1) |
(static_cast<int32_t>(isFixedSlot_) << 17) | (static_cast<int32_t>(isFixedSlot_) << 17);
(static_cast<int32_t>(obj_->is<UnboxedPlainObject>()) << 18);
} }
MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm); MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm);
@ -1929,7 +1927,6 @@ class ICSetPropNativeAddCompiler : public ICStubCompiler
return static_cast<int32_t>(engine_) | return static_cast<int32_t>(engine_) |
(static_cast<int32_t>(kind) << 1) | (static_cast<int32_t>(kind) << 1) |
(static_cast<int32_t>(isFixedSlot_) << 17) | (static_cast<int32_t>(isFixedSlot_) << 17) |
(static_cast<int32_t>(obj_->is<UnboxedPlainObject>()) << 18) |
(static_cast<int32_t>(protoChainDepth_) << 19); (static_cast<int32_t>(protoChainDepth_) << 19);
} }
@ -1954,10 +1951,7 @@ class ICSetPropNativeAddCompiler : public ICStubCompiler
newGroup = nullptr; newGroup = nullptr;
RootedShape newShape(cx); RootedShape newShape(cx);
if (obj_->isNative())
newShape = obj_->as<NativeObject>().lastProperty(); newShape = obj_->as<NativeObject>().lastProperty();
else
newShape = obj_->as<UnboxedPlainObject>().maybeExpando()->lastProperty();
return newStub<ICSetProp_NativeAddImpl<ProtoChainDepth>>( return newStub<ICSetProp_NativeAddImpl<ProtoChainDepth>>(
space, getStubCode(), oldGroup_, shapes, newShape, newGroup, offset_); space, getStubCode(), oldGroup_, shapes, newShape, newGroup, offset_);

View file

@ -3384,11 +3384,6 @@ SetPropertyIC::update(JSContext* cx, HandleScript outerScript, size_t cacheIndex
return false; return false;
oldShape = obj->maybeShape(); oldShape = obj->maybeShape();
if (obj->is<UnboxedPlainObject>()) {
MOZ_ASSERT(!oldShape);
if (UnboxedExpandoObject* expando = obj->as<UnboxedPlainObject>().maybeExpando())
oldShape = expando->lastProperty();
}
} }
RootedId id(cx); RootedId id(cx);

View file

@ -30,7 +30,6 @@
#include "jit/shared/Lowering-shared-inl.h" #include "jit/shared/Lowering-shared-inl.h"
#include "vm/NativeObject-inl.h" #include "vm/NativeObject-inl.h"
#include "vm/StringObject-inl.h" #include "vm/StringObject-inl.h"
#include "vm/UnboxedObject-inl.h"
using mozilla::ArrayLength; using mozilla::ArrayLength;
using mozilla::AssertedCast; using mozilla::AssertedCast;

View file

@ -15,11 +15,9 @@
#include "jit/JitcodeMap.h" #include "jit/JitcodeMap.h"
#include "jit/JitSpewer.h" #include "jit/JitSpewer.h"
#include "js/TrackedOptimizationInfo.h" #include "js/TrackedOptimizationInfo.h"
#include "vm/UnboxedObject.h"
#include "vm/ObjectGroup-inl.h" #include "vm/ObjectGroup-inl.h"
#include "vm/TypeInference-inl.h" #include "vm/TypeInference-inl.h"
#include "vm/UnboxedObject-inl.h"
using namespace js; using namespace js;
using namespace js::jit; using namespace js::jit;
@ -846,8 +844,6 @@ MaybeConstructorFromType(TypeSet::Type ty)
return nullptr; return nullptr;
ObjectGroup* obj = ty.group(); ObjectGroup* obj = ty.group();
TypeNewScript* newScript = obj->newScript(); TypeNewScript* newScript = obj->newScript();
if (!newScript && obj->maybeUnboxedLayout())
newScript = obj->unboxedLayout().newScript();
return newScript ? newScript->function() : nullptr; return newScript ? newScript->function() : nullptr;
} }

View file

@ -1540,30 +1540,6 @@ RObjectState::recover(JSContext* cx, SnapshotIterator& iter) const
RootedObject object(cx, &iter.read().toObject()); RootedObject object(cx, &iter.read().toObject());
RootedValue val(cx); RootedValue val(cx);
if (object->is<UnboxedPlainObject>()) {
const UnboxedLayout& layout = object->as<UnboxedPlainObject>().layout();
RootedId id(cx);
RootedValue receiver(cx, ObjectValue(*object));
const UnboxedLayout::PropertyVector& properties = layout.properties();
for (size_t i = 0; i < properties.length(); i++) {
val = iter.read();
// This is the default placeholder value of MObjectState, when no
// properties are defined yet.
if (val.isUndefined())
continue;
id = NameToId(properties[i].name);
ObjectOpResult result;
// SetProperty can only fail due to OOM.
if (!SetProperty(cx, object, id, val, receiver, result))
return false;
if (!result)
return result.reportError(cx, object, id);
}
} else {
RootedNativeObject nativeObject(cx, &object->as<NativeObject>()); RootedNativeObject nativeObject(cx, &object->as<NativeObject>());
MOZ_ASSERT(nativeObject->slotSpan() == numSlots()); MOZ_ASSERT(nativeObject->slotSpan() == numSlots());
@ -1571,7 +1547,6 @@ RObjectState::recover(JSContext* cx, SnapshotIterator& iter) const
val = iter.read(); val = iter.read();
nativeObject->setSlot(i, val); nativeObject->setSlot(i, val);
} }
}
val.setObject(*object); val.setObject(*object);
iter.storeInstructionResult(val); iter.storeInstructionResult(val);