| Index: src/ia32/lithium-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-codegen-ia32.cc (revision 9574)
|
| +++ src/ia32/lithium-codegen-ia32.cc (working copy)
|
| @@ -355,6 +355,13 @@
|
| }
|
|
|
|
|
| +Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const {
|
| + Handle<Object> literal = chunk_->LookupLiteral(op);
|
| + ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged());
|
| + return literal;
|
| +}
|
| +
|
| +
|
| Immediate LCodeGen::ToImmediate(LOperand* op) {
|
| LConstantOperand* const_op = LConstantOperand::cast(op);
|
| Handle<Object> literal = chunk_->LookupLiteral(const_op);
|
| @@ -528,7 +535,7 @@
|
| } else if (context->IsConstantOperand()) {
|
| Handle<Object> literal =
|
| chunk_->LookupLiteral(LConstantOperand::cast(context));
|
| - LoadHeapObject(esi, Handle<Context>::cast(literal));
|
| + __ LoadHeapObject(esi, Handle<Context>::cast(literal));
|
| } else {
|
| UNREACHABLE();
|
| }
|
| @@ -1245,7 +1252,7 @@
|
| Register reg = ToRegister(instr->result());
|
| Handle<Object> handle = instr->value();
|
| if (handle->IsHeapObject()) {
|
| - LoadHeapObject(reg, Handle<HeapObject>::cast(handle));
|
| + __ LoadHeapObject(reg, Handle<HeapObject>::cast(handle));
|
| } else {
|
| __ Set(reg, Immediate(handle));
|
| }
|
| @@ -1988,7 +1995,7 @@
|
| // the stub.
|
| Register temp = ToRegister(instr->TempAt(0));
|
| ASSERT(MacroAssembler::SafepointRegisterStackIndex(temp) == 0);
|
| - __ mov(InstanceofStub::right(), Immediate(instr->function()));
|
| + __ LoadHeapObject(InstanceofStub::right(), instr->function());
|
| static const int kAdditionalDelta = 13;
|
| int delta = masm_->SizeOfCodeGeneratedSince(map_check) + kAdditionalDelta;
|
| __ mov(temp, Immediate(delta));
|
| @@ -2191,11 +2198,28 @@
|
| }
|
| } else {
|
| Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
| - LoadHeapObject(result, Handle<HeapObject>::cast(function));
|
| + __ LoadHeapObject(result, function);
|
| }
|
| }
|
|
|
|
|
| +void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
|
| + ASSERT(!operand->IsDoubleRegister());
|
| + if (operand->IsConstantOperand()) {
|
| + Handle<Object> object = ToHandle(LConstantOperand::cast(operand));
|
| + if (object->IsSmi()) {
|
| + __ Push(Handle<Smi>::cast(object));
|
| + } else {
|
| + __ PushHeapObject(Handle<HeapObject>::cast(object));
|
| + }
|
| + } else if (operand->IsRegister()) {
|
| + __ push(ToRegister(operand));
|
| + } else {
|
| + __ push(ToOperand(operand));
|
| + }
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
|
| Register object = ToRegister(instr->object());
|
| Register result = ToRegister(instr->result());
|
| @@ -2604,11 +2628,7 @@
|
|
|
| void LCodeGen::DoPushArgument(LPushArgument* instr) {
|
| LOperand* argument = instr->InputAt(0);
|
| - if (argument->IsConstantOperand()) {
|
| - __ push(ToImmediate(argument));
|
| - } else {
|
| - __ push(ToOperand(argument));
|
| - }
|
| + EmitPushTaggedOperand(argument);
|
| }
|
|
|
|
|
| @@ -2685,7 +2705,7 @@
|
|
|
| void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
|
| ASSERT(ToRegister(instr->result()).is(eax));
|
| - __ mov(edi, instr->function());
|
| + __ LoadHeapObject(edi, instr->function());
|
| CallKnownFunction(instr->function(),
|
| instr->arity(),
|
| instr,
|
| @@ -3115,7 +3135,7 @@
|
|
|
| void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| ASSERT(ToRegister(instr->result()).is(eax));
|
| - __ mov(edi, instr->target());
|
| + __ LoadHeapObject(edi, instr->target());
|
| CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
|
| }
|
|
|
| @@ -3482,16 +3502,8 @@
|
|
|
|
|
| void LCodeGen::DoStringAdd(LStringAdd* instr) {
|
| - if (instr->left()->IsConstantOperand()) {
|
| - __ push(ToImmediate(instr->left()));
|
| - } else {
|
| - __ push(ToOperand(instr->left()));
|
| - }
|
| - if (instr->right()->IsConstantOperand()) {
|
| - __ push(ToImmediate(instr->right()));
|
| - } else {
|
| - __ push(ToOperand(instr->right()));
|
| - }
|
| + EmitPushTaggedOperand(instr->left());
|
| + EmitPushTaggedOperand(instr->right());
|
| StringAddStub stub(NO_STRING_CHECK_IN_STUB);
|
| CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
| }
|
| @@ -3991,7 +4003,7 @@
|
| __ cmp(reg, Operand::Cell(cell));
|
| } else {
|
| Operand operand = ToOperand(instr->value());
|
| - __ cmp(operand, instr->hydrogen()->target());
|
| + __ cmp(operand, target);
|
| }
|
| DeoptimizeIf(not_equal, instr->environment());
|
| }
|
| @@ -4055,17 +4067,6 @@
|
| }
|
|
|
|
|
| -void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) {
|
| - if (isolate()->heap()->InNewSpace(*object)) {
|
| - Handle<JSGlobalPropertyCell> cell =
|
| - isolate()->factory()->NewJSGlobalPropertyCell(object);
|
| - __ mov(result, Operand::Cell(cell));
|
| - } else {
|
| - __ mov(result, object);
|
| - }
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
|
| Register reg = ToRegister(instr->TempAt(0));
|
|
|
| @@ -4073,7 +4074,7 @@
|
| Handle<JSObject> current_prototype = instr->prototype();
|
|
|
| // Load prototype object.
|
| - LoadHeapObject(reg, current_prototype);
|
| + __ LoadHeapObject(reg, current_prototype);
|
|
|
| // Check prototype maps up to the holder.
|
| while (!current_prototype.is_identical_to(holder)) {
|
| @@ -4083,7 +4084,7 @@
|
| current_prototype =
|
| Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
|
| // Load next prototype object.
|
| - LoadHeapObject(reg, current_prototype);
|
| + __ LoadHeapObject(reg, current_prototype);
|
| }
|
|
|
| // Check the holder map.
|
| @@ -4231,11 +4232,7 @@
|
|
|
| void LCodeGen::DoTypeof(LTypeof* instr) {
|
| LOperand* input = instr->InputAt(1);
|
| - if (input->IsConstantOperand()) {
|
| - __ push(ToImmediate(input));
|
| - } else {
|
| - __ push(ToOperand(input));
|
| - }
|
| + EmitPushTaggedOperand(input);
|
| CallRuntime(Runtime::kTypeof, 1, instr);
|
| }
|
|
|
| @@ -4371,11 +4368,7 @@
|
| LOperand* obj = instr->object();
|
| LOperand* key = instr->key();
|
| __ push(ToOperand(obj));
|
| - if (key->IsConstantOperand()) {
|
| - __ push(ToImmediate(key));
|
| - } else {
|
| - __ push(ToOperand(key));
|
| - }
|
| + EmitPushTaggedOperand(key);
|
| ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
|
| LPointerMap* pointers = instr->pointer_map();
|
| LEnvironment* env = instr->deoptimization_environment();
|
| @@ -4466,16 +4459,8 @@
|
| void LCodeGen::DoIn(LIn* instr) {
|
| LOperand* obj = instr->object();
|
| LOperand* key = instr->key();
|
| - if (key->IsConstantOperand()) {
|
| - __ push(ToImmediate(key));
|
| - } else {
|
| - __ push(ToOperand(key));
|
| - }
|
| - if (obj->IsConstantOperand()) {
|
| - __ push(ToImmediate(obj));
|
| - } else {
|
| - __ push(ToOperand(obj));
|
| - }
|
| + EmitPushTaggedOperand(key);
|
| + EmitPushTaggedOperand(obj);
|
| ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
|
| LPointerMap* pointers = instr->pointer_map();
|
| LEnvironment* env = instr->deoptimization_environment();
|
|
|