| Index: src/x64/lithium-codegen-x64.cc
|
| ===================================================================
|
| --- src/x64/lithium-codegen-x64.cc (revision 9574)
|
| +++ src/x64/lithium-codegen-x64.cc (working copy)
|
| @@ -1211,8 +1211,13 @@
|
|
|
|
|
| void LCodeGen::DoConstantT(LConstantT* instr) {
|
| - ASSERT(instr->result()->IsRegister());
|
| - __ Move(ToRegister(instr->result()), instr->value());
|
| + Handle<Object> value = instr->value();
|
| + if (value->IsSmi()) {
|
| + __ Move(ToRegister(instr->result()), value);
|
| + } else {
|
| + __ LoadHeapObject(ToRegister(instr->result()),
|
| + Handle<HeapObject>::cast(value));
|
| + }
|
| }
|
|
|
|
|
| @@ -2008,13 +2013,7 @@
|
|
|
| void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
|
| Register result = ToRegister(instr->result());
|
| - if (result.is(rax)) {
|
| - __ load_rax(instr->hydrogen()->cell().location(),
|
| - RelocInfo::GLOBAL_PROPERTY_CELL);
|
| - } else {
|
| - __ movq(result, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL);
|
| - __ movq(result, Operand(result, 0));
|
| - }
|
| + __ LoadGlobalCell(result, instr->hydrogen()->cell());
|
| if (instr->hydrogen()->RequiresHoleCheck()) {
|
| __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
|
| DeoptimizeIf(equal, instr->environment());
|
| @@ -2136,7 +2135,7 @@
|
| }
|
| } else {
|
| Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*type));
|
| - LoadHeapObject(result, Handle<HeapObject>::cast(function));
|
| + __ LoadHeapObject(result, function);
|
| }
|
| }
|
|
|
| @@ -2632,7 +2631,7 @@
|
|
|
| void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
|
| ASSERT(ToRegister(instr->result()).is(rax));
|
| - __ Move(rdi, instr->function());
|
| + __ LoadHeapObject(rdi, instr->function());
|
| CallKnownFunction(instr->function(),
|
| instr->arity(),
|
| instr,
|
| @@ -3031,7 +3030,7 @@
|
|
|
| void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| ASSERT(ToRegister(instr->result()).is(rax));
|
| - __ Move(rdi, instr->target());
|
| + __ LoadHeapObject(rdi, instr->target());
|
| CallKnownFunction(instr->target(), instr->arity(), instr, CALL_AS_FUNCTION);
|
| }
|
|
|
| @@ -3717,9 +3716,16 @@
|
|
|
|
|
| void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
|
| - ASSERT(instr->InputAt(0)->IsRegister());
|
| - Register reg = ToRegister(instr->InputAt(0));
|
| - __ Cmp(reg, instr->hydrogen()->target());
|
| + Register reg = ToRegister(instr->value());
|
| + Handle<JSFunction> target = instr->hydrogen()->target();
|
| + if (isolate()->heap()->InNewSpace(*target)) {
|
| + Handle<JSGlobalPropertyCell> cell =
|
| + isolate()->factory()->NewJSGlobalPropertyCell(target);
|
| + __ movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
|
| + __ cmpq(reg, Operand(kScratchRegister, 0));
|
| + } else {
|
| + __ Cmp(reg, target);
|
| + }
|
| DeoptimizeIf(not_equal, instr->environment());
|
| }
|
|
|
| @@ -3785,18 +3791,6 @@
|
| }
|
|
|
|
|
| -void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) {
|
| - if (heap()->InNewSpace(*object)) {
|
| - Handle<JSGlobalPropertyCell> cell =
|
| - factory()->NewJSGlobalPropertyCell(object);
|
| - __ movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL);
|
| - __ movq(result, Operand(result, 0));
|
| - } else {
|
| - __ Move(result, object);
|
| - }
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
|
| Register reg = ToRegister(instr->TempAt(0));
|
|
|
| @@ -3804,7 +3798,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)) {
|
| @@ -3814,7 +3808,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.
|
| @@ -3959,7 +3953,12 @@
|
| void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
|
| ASSERT(!operand->IsDoubleRegister());
|
| if (operand->IsConstantOperand()) {
|
| - __ Push(ToHandle(LConstantOperand::cast(operand)));
|
| + 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 {
|
|
|