Commit 2a680c59 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Convert CONSTANT_FUNCTION to CONSTANT

Port r15858 (e3a6d2a)

BUG=

Review URL: https://codereview.chromium.org/19847003
Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15864 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a95fcb99
...@@ -411,11 +411,7 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { ...@@ -411,11 +411,7 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) {
Abort("EmitLoadRegister: Unsupported double immediate."); Abort("EmitLoadRegister: Unsupported double immediate.");
} else { } else {
ASSERT(r.IsTagged()); ASSERT(r.IsTagged());
if (literal->IsSmi()) { __ LoadObject(scratch, literal);
__ li(scratch, Operand(literal));
} else {
__ LoadHeapObject(scratch, Handle<HeapObject>::cast(literal));
}
} }
return scratch; return scratch;
} else if (op->IsStackSlot() || op->IsArgument()) { } else if (op->IsStackSlot() || op->IsArgument()) {
...@@ -1628,12 +1624,7 @@ void LCodeGen::DoConstantD(LConstantD* instr) { ...@@ -1628,12 +1624,7 @@ void LCodeGen::DoConstantD(LConstantD* instr) {
void LCodeGen::DoConstantT(LConstantT* instr) { void LCodeGen::DoConstantT(LConstantT* instr) {
Handle<Object> value = instr->value(); Handle<Object> value = instr->value();
AllowDeferredHandleDereference smi_check; AllowDeferredHandleDereference smi_check;
if (value->IsSmi()) { __ LoadObject(ToRegister(instr->result()), value);
__ li(ToRegister(instr->result()), Operand(value));
} else {
__ LoadHeapObject(ToRegister(instr->result()),
Handle<HeapObject>::cast(value));
}
} }
...@@ -2886,9 +2877,9 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, ...@@ -2886,9 +2877,9 @@ void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
__ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
__ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize)); __ lw(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
} }
} else if (lookup.IsConstantFunction()) { } else if (lookup.IsConstant()) {
Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type)); Handle<Object> constant(lookup.GetConstantFromMap(*type), isolate());
__ LoadHeapObject(result, function); __ LoadObject(result, constant);
} else { } else {
// Negative lookup. // Negative lookup.
// Check prototypes. // Check prototypes.
......
...@@ -470,10 +470,9 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, ...@@ -470,10 +470,9 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
Representation representation = details.representation(); Representation representation = details.representation();
ASSERT(!representation.IsNone()); ASSERT(!representation.IsNone());
if (details.type() == CONSTANT_FUNCTION) { if (details.type() == CONSTANT) {
Handle<HeapObject> constant( Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate());
HeapObject::cast(descriptors->GetValue(descriptor))); __ LoadObject(scratch1, constant);
__ LoadHeapObject(scratch1, constant);
__ Branch(miss_label, ne, value_reg, Operand(scratch1)); __ Branch(miss_label, ne, value_reg, Operand(scratch1));
} else if (FLAG_track_fields && representation.IsSmi()) { } else if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_label); __ JumpIfNotSmi(value_reg, miss_label);
...@@ -532,7 +531,7 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, ...@@ -532,7 +531,7 @@ void BaseStoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
OMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK); OMIT_SMI_CHECK);
if (details.type() == CONSTANT_FUNCTION) { if (details.type() == CONSTANT) {
ASSERT(value_reg.is(a0)); ASSERT(value_reg.is(a0));
__ Ret(USE_DELAY_SLOT); __ Ret(USE_DELAY_SLOT);
__ mov(v0, a0); __ mov(v0, a0);
...@@ -1404,9 +1403,9 @@ void BaseLoadStubCompiler::GenerateLoadField(Register reg, ...@@ -1404,9 +1403,9 @@ void BaseLoadStubCompiler::GenerateLoadField(Register reg,
} }
void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
// Return the constant value. // Return the constant value.
__ LoadHeapObject(v0, value); __ LoadObject(v0, value);
__ Ret(); __ Ret();
} }
...@@ -2709,7 +2708,7 @@ Handle<Code> CallStubCompiler::CompileCallConstant( ...@@ -2709,7 +2708,7 @@ Handle<Code> CallStubCompiler::CompileCallConstant(
Handle<Code> code = CompileCustomCall(object, holder, Handle<Code> code = CompileCustomCall(object, holder,
Handle<Cell>::null(), Handle<Cell>::null(),
function, Handle<String>::cast(name), function, Handle<String>::cast(name),
Code::CONSTANT_FUNCTION); Code::CONSTANT);
// A null handle means bail out to the regular compiler code below. // A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code; if (!code.is_null()) return code;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment