Backed out changeset f1a9592618ec due to orange

This commit is contained in:
Hannes Verschore 2012-12-10 00:48:59 +01:00
Родитель efa586e5eb
Коммит 5f0b9ead28
10 изменённых файлов: 46 добавлений и 108 удалений

Просмотреть файл

@ -1842,8 +1842,10 @@ static const VMFunction NewGCThingInfo =
FunctionInfo<NewGCThingFn>(js::ion::NewGCThing);
bool
CodeGenerator::visitCreateThisWithTemplate(LCreateThisWithTemplate *lir)
CodeGenerator::visitCreateThis(LCreateThis *lir)
{
JS_ASSERT(lir->mir()->hasTemplateObject());
JSObject *templateObject = lir->mir()->getTemplateObject();
gc::AllocKind allocKind = templateObject->getAllocKind();
int thingSize = (int)gc::Arena::thingSize(allocKind);
@ -1870,24 +1872,11 @@ static const VMFunction CreateThisInfo =
FunctionInfo<CreateThisFn>(js_CreateThisForFunctionWithProto);
bool
CodeGenerator::visitCreateThis(LCreateThis *lir)
CodeGenerator::visitCreateThisVM(LCreateThisVM *lir)
{
Label done, vm;
const LAllocation *proto = lir->getPrototype();
const LAllocation *callee = lir->getCallee();
// When callee could be a native, put MagicValue in return operand.
// Use the VMCall when callee turns out to not be a native.
if (lir->mir()->needNativeCheck()) {
JS_ASSERT(lir->mir()->type() == MIRType_Value);
masm.branchIfInterpreted(ToRegister(callee), &vm);
masm.moveValue(MagicValue(JS_IS_CONSTRUCTING), GetValueOutput(lir));
masm.jump(&done);
}
masm.bind(&vm);
// Push arguments.
if (proto->isConstant())
pushArg(ImmGCPtr(&proto->toConstant()->toObject()));
@ -1901,9 +1890,6 @@ CodeGenerator::visitCreateThis(LCreateThis *lir)
if (!callVM(CreateThisInfo, lir))
return false;
masm.bind(&done);
return true;
}

Просмотреть файл

@ -97,7 +97,7 @@ class CodeGenerator : public CodeGeneratorSpecific
bool visitNewStringObject(LNewStringObject *lir);
bool visitInitProp(LInitProp *lir);
bool visitCreateThis(LCreateThis *lir);
bool visitCreateThisWithTemplate(LCreateThisWithTemplate *lir);
bool visitCreateThisVM(LCreateThisVM *lir);
bool visitReturnFromCtor(LReturnFromCtor *lir);
bool visitArrayLength(LArrayLength *lir);
bool visitTypedArrayLength(LTypedArrayLength *lir);

Просмотреть файл

@ -3864,7 +3864,7 @@ IonBuilder::createThisScripted(MDefinition *callee)
current->add(getProto);
// Create this from prototype
MCreateThis *createThis = MCreateThis::New(callee, getProto);
MCreateThis *createThis = MCreateThis::New(callee, getProto, NULL);
current->add(createThis);
return createThis;
@ -3905,7 +3905,10 @@ IonBuilder::createThisScriptedSingleton(HandleFunction target, HandleObject prot
if (templateObject->type()->newScript)
types::HeapTypeSet::WatchObjectStateChange(cx, templateObject->type());
MCreateThisWithTemplate *createThis = MCreateThisWithTemplate::New(templateObject);
MConstant *protoDef = MConstant::New(ObjectValue(*proto));
current->add(protoDef);
MCreateThis *createThis = MCreateThis::New(callee, protoDef, templateObject);
current->add(createThis);
return createThis;

Просмотреть файл

@ -284,16 +284,6 @@ class MacroAssembler : public MacroAssemblerSpecific
uint32_t bit = JSFunction::INTERPRETED << 16;
branchTest32(Assembler::Zero, address, Imm32(bit), label);
}
void branchIfInterpreted(Register fun, Label *label) {
// 16-bit loads are slow and unaligned 32-bit loads may be too so
// perform an aligned 32-bit load and adjust the bitmask accordingly.
JS_STATIC_ASSERT(offsetof(JSFunction, nargs) % sizeof(uint32_t) == 0);
JS_STATIC_ASSERT(offsetof(JSFunction, flags) == offsetof(JSFunction, nargs) + 2);
JS_STATIC_ASSERT(IS_LITTLE_ENDIAN);
Address address(fun, offsetof(JSFunction, nargs));
uint32_t bit = JSFunction::INTERPRETED << 16;
branchTest32(Assembler::NonZero, address, Imm32(bit), label);
}
using MacroAssemblerSpecific::Push;

Просмотреть файл

@ -420,26 +420,26 @@ class LToIdV : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 0>
// Allocate an object for |new| on the caller-side.
// Always performs object initialization with a fast path.
class LCreateThisWithTemplate : public LInstructionHelper<1, 0, 0>
{
public:
LIR_HEADER(CreateThisWithTemplate)
LCreateThisWithTemplate()
{ }
MCreateThisWithTemplate *mir() const {
return mir_->toCreateThisWithTemplate();
}
};
// Allocate an object for |new| on the caller-side, when there is no templateObject.
class LCreateThis : public LCallInstructionHelper<1, 2, 0>
class LCreateThis : public LInstructionHelper<1, 0, 0>
{
public:
LIR_HEADER(CreateThis)
LCreateThis(const LAllocation &callee, const LAllocation &prototype)
LCreateThis()
{ }
MCreateThis *mir() const {
return mir_->toCreateThis();
}
};
// Allocate an object for |new| on the caller-side, when there is no templateObject.
class LCreateThisVM : public LCallInstructionHelper<1, 2, 0>
{
public:
LIR_HEADER(CreateThisVM)
LCreateThisVM(const LAllocation &callee, const LAllocation &prototype)
{
setOperand(0, callee);
setOperand(1, prototype);

Просмотреть файл

@ -40,7 +40,7 @@
_(StackArgT) \
_(StackArgV) \
_(CreateThis) \
_(CreateThisWithTemplate) \
_(CreateThisVM) \
_(ReturnFromCtor) \
_(BitNotI) \
_(BitNotV) \

Просмотреть файл

@ -235,24 +235,17 @@ LIRGenerator::visitPassArg(MPassArg *arg)
return add(stack);
}
bool
LIRGenerator::visitCreateThisWithTemplate(MCreateThisWithTemplate *ins)
{
LCreateThisWithTemplate *lir = new LCreateThisWithTemplate();
return define(lir, ins) && assignSafepoint(lir, ins);
}
bool
LIRGenerator::visitCreateThis(MCreateThis *ins)
{
LAllocation callee = useRegisterOrConstantAtStart(ins->getCallee());
LAllocation prototype = useRegisterOrConstantAtStart(ins->getPrototype());
// Template objects permit fast initialization.
if (ins->hasTemplateObject()) {
LCreateThis *lir = new LCreateThis();
return define(lir, ins) && assignSafepoint(lir, ins);
}
// For the native check we need the callee in a register.
if (ins->needNativeCheck())
callee = useRegisterAtStart(ins->getCallee());
LCreateThis *lir = new LCreateThis(callee, prototype);
LCreateThisVM *lir = new LCreateThisVM(useRegisterOrConstantAtStart(ins->getCallee()),
useRegisterOrConstantAtStart(ins->getPrototype()));
return defineReturn(lir, ins) && assignSafepoint(lir, ins);
}

Просмотреть файл

@ -89,7 +89,6 @@ class LIRGenerator : public LIRGeneratorSpecific
bool visitDefVar(MDefVar *ins);
bool visitPrepareCall(MPrepareCall *ins);
bool visitPassArg(MPassArg *arg);
bool visitCreateThisWithTemplate(MCreateThisWithTemplate *ins);
bool visitCreateThis(MCreateThis *ins);
bool visitReturnFromCtor(MReturnFromCtor *ins);
bool visitCall(MCall *call);

Просмотреть файл

@ -1569,36 +1569,6 @@ class MGuardString
}
};
// Caller-side allocation of |this| for |new|:
// Given a templateobject, construct |this| for JSOP_NEW
class MCreateThisWithTemplate
: public MNullaryInstruction
{
// Template for |this|, provided by TI
CompilerRootObject templateObject_;
MCreateThisWithTemplate(JSObject *templateObject)
: templateObject_(templateObject)
{
setResultType(MIRType_Object);
}
public:
INSTRUCTION_HEADER(CreateThisWithTemplate);
static MCreateThisWithTemplate *New(JSObject *templateObject)
{
return new MCreateThisWithTemplate(templateObject);
}
JSObject *getTemplateObject() const {
return templateObject_;
}
// Although creation of |this| modifies global state, it is safely repeatable.
AliasSet getAliasSet() const {
return AliasSet::None();
}
};
// Caller-side allocation of |this| for |new|:
// Given a prototype operand, construct |this| for JSOP_NEW.
// For native constructors, returns MagicValue(JS_IS_CONSTRUCTING).
@ -1606,24 +1576,22 @@ class MCreateThis
: public MAryInstruction<2>,
public MixPolicy<ObjectPolicy<0>, ObjectPolicy<1> >
{
bool needNativeCheck_;
// Template for |this|, provided by TI, or NULL.
CompilerRootObject templateObject_;
MCreateThis(MDefinition *callee, MDefinition *prototype)
: needNativeCheck_(true)
MCreateThis(MDefinition *callee, MDefinition *prototype, JSObject *templateObject)
: templateObject_(templateObject)
{
initOperand(0, callee);
initOperand(1, prototype);
// Type is mostly object, except for native constructors
// therefore the need of Value type.
setResultType(MIRType_Value);
setResultType(MIRType_Object);
}
public:
INSTRUCTION_HEADER(CreateThis)
static MCreateThis *New(MDefinition *callee, MDefinition *prototype)
static MCreateThis *New(MDefinition *callee, MDefinition *prototype, JSObject *templateObject)
{
return new MCreateThis(callee, prototype);
return new MCreateThis(callee, prototype, templateObject);
}
MDefinition *getCallee() const {
@ -1632,12 +1600,12 @@ class MCreateThis
MDefinition *getPrototype() const {
return getOperand(1);
}
void removeNativeCheck() {
needNativeCheck_ = false;
setResultType(MIRType_Object);
bool hasTemplateObject() const {
return !!templateObject_;
}
bool needNativeCheck() const {
return needNativeCheck_;
JSObject *getTemplateObject() const {
JS_ASSERT(hasTemplateObject());
return templateObject_;
}
// Although creation of |this| modifies global state, it is safely repeatable.

Просмотреть файл

@ -30,7 +30,6 @@ namespace ion {
_(RecompileCheck) \
_(DefVar) \
_(CreateThis) \
_(CreateThisWithTemplate) \
_(PrepareCall) \
_(PassArg) \
_(Call) \