| Index: src/arm/lithium-codegen-arm.cc
|
| ===================================================================
|
| --- src/arm/lithium-codegen-arm.cc (revision 9574)
|
| +++ src/arm/lithium-codegen-arm.cc (working copy)
|
| @@ -352,7 +352,22 @@
|
| if (op->IsRegister()) {
|
| return ToRegister(op->index());
|
| } else if (op->IsConstantOperand()) {
|
| - __ mov(scratch, ToOperand(op));
|
| + LConstantOperand* const_op = LConstantOperand::cast(op);
|
| + Handle<Object> literal = chunk_->LookupLiteral(const_op);
|
| + Representation r = chunk_->LookupLiteralRepresentation(const_op);
|
| + if (r.IsInteger32()) {
|
| + ASSERT(literal->IsNumber());
|
| + __ mov(scratch, Operand(static_cast<int32_t>(literal->Number())));
|
| + } else if (r.IsDouble()) {
|
| + Abort("EmitLoadRegister: Unsupported double immediate.");
|
| + } else {
|
| + ASSERT(r.IsTagged());
|
| + if (literal->IsSmi()) {
|
| + __ mov(scratch, Operand(literal));
|
| + } else {
|
| + __ LoadHeapObject(scratch, Handle<HeapObject>::cast(literal));
|
| + }
|
| + }
|
| return scratch;
|
| } else if (op->IsStackSlot() || op->IsArgument()) {
|
| __ ldr(scratch, ToMemOperand(op));
|
| @@ -1377,8 +1392,13 @@
|
|
|
|
|
| void LCodeGen::DoConstantT(LConstantT* instr) {
|
| - ASSERT(instr->result()->IsRegister());
|
| - __ mov(ToRegister(instr->result()), Operand(instr->value()));
|
| + Handle<Object> value = instr->value();
|
| + if (value->IsSmi()) {
|
| + __ mov(ToRegister(instr->result()), Operand(value));
|
| + } else {
|
| + __ LoadHeapObject(ToRegister(instr->result()),
|
| + Handle<HeapObject>::cast(value));
|
| + }
|
| }
|
|
|
|
|
| @@ -2130,7 +2150,7 @@
|
| // offset to the location of the map check.
|
| Register temp = ToRegister(instr->TempAt(0));
|
| ASSERT(temp.is(r4));
|
| - __ mov(InstanceofStub::right(), Operand(instr->function()));
|
| + __ LoadHeapObject(InstanceofStub::right(), instr->function());
|
| static const int kAdditionalDelta = 4;
|
| int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
|
| Label before_push_delta;
|
| @@ -2330,7 +2350,7 @@
|
| }
|
| } else {
|
| Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
| - LoadHeapObject(result, Handle<HeapObject>::cast(function));
|
| + __ LoadHeapObject(result, function);
|
| }
|
| }
|
|
|
| @@ -2846,7 +2866,7 @@
|
|
|
| void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
| - __ mov(r1, Operand(instr->function()));
|
| + __ LoadHeapObject(r1, instr->function());
|
| CallKnownFunction(instr->function(),
|
| instr->arity(),
|
| instr,
|
| @@ -3263,7 +3283,7 @@
|
|
|
| void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
| - __ mov(r1, Operand(instr->target()));
|
| + __ LoadHeapObject(r1, instr->target());
|
| CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
|
| }
|
|
|
| @@ -4090,9 +4110,18 @@
|
|
|
|
|
| void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
|
| - ASSERT(instr->InputAt(0)->IsRegister());
|
| - Register reg = ToRegister(instr->InputAt(0));
|
| - __ cmp(reg, Operand(instr->hydrogen()->target()));
|
| + Register reg = ToRegister(instr->value());
|
| + Handle<JSFunction> target = instr->hydrogen()->target();
|
| + if (isolate()->heap()->InNewSpace(*target)) {
|
| + Register reg = ToRegister(instr->value());
|
| + Handle<JSGlobalPropertyCell> cell =
|
| + isolate()->factory()->NewJSGlobalPropertyCell(target);
|
| + __ mov(ip, Operand(Handle<Object>(cell)));
|
| + __ ldr(ip, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset));
|
| + __ cmp(reg, ip);
|
| + } else {
|
| + __ cmp(reg, Operand(target));
|
| + }
|
| DeoptimizeIf(ne, instr->environment());
|
| }
|
|
|
| @@ -4161,19 +4190,6 @@
|
| }
|
|
|
|
|
| -void LCodeGen::LoadHeapObject(Register result,
|
| - Handle<HeapObject> object) {
|
| - if (heap()->InNewSpace(*object)) {
|
| - Handle<JSGlobalPropertyCell> cell =
|
| - factory()->NewJSGlobalPropertyCell(object);
|
| - __ mov(result, Operand(cell));
|
| - __ ldr(result, FieldMemOperand(result, JSGlobalPropertyCell::kValueOffset));
|
| - } else {
|
| - __ mov(result, Operand(object));
|
| - }
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
|
| Register temp1 = ToRegister(instr->TempAt(0));
|
| Register temp2 = ToRegister(instr->TempAt(1));
|
| @@ -4182,7 +4198,7 @@
|
| Handle<JSObject> current_prototype = instr->prototype();
|
|
|
| // Load prototype object.
|
| - LoadHeapObject(temp1, current_prototype);
|
| + __ LoadHeapObject(temp1, current_prototype);
|
|
|
| // Check prototype maps up to the holder.
|
| while (!current_prototype.is_identical_to(holder)) {
|
| @@ -4192,7 +4208,7 @@
|
| current_prototype =
|
| Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
|
| // Load next prototype object.
|
| - LoadHeapObject(temp1, current_prototype);
|
| + __ LoadHeapObject(temp1, current_prototype);
|
| }
|
|
|
| // Check the holder map.
|
|
|