Showing with 134 additions and 176 deletions.
  1. +3 −82 src/ia32/lir-ia32.cc
  2. +63 −0 src/ia32/stubs-ia32.cc
  3. +2 −0 src/stubs.h
  4. +2 −76 src/x64/lir-x64.cc
  5. +64 −18 src/x64/stubs-x64.cc
@@ -260,96 +260,17 @@ void LAccessProperty::UpdateIC(Masm* masm) {


void LLoadProperty::Generate(Masm* masm) {
Label ic_done, done;

__ push(eax);
__ push(eax);
__ push(eax);
__ push(eax);

CheckIC(masm, &ic_done);

// eax <- object
// ebx <- property
__ mov(ecx, Immediate(0));
__ Call(masm->stubs()->GetLookupPropertyStub());

UpdateIC(masm);
__ bind(&ic_done);

__ pop(ebx);
__ pop(ebx);
__ pop(ebx);
__ pop(ebx);

__ IsNil(eax, NULL, &done);
Operand qmap(ebx, HObject::kMapOffset);
__ mov(ebx, qmap);
__ addl(eax, ebx);

Operand slot(eax, 0);
__ mov(eax, slot);

__ bind(&done);

if (HasMonomorphicProperty()) {
// Cleanup scratches
Register tmp0 = scratches[0]->ToRegister();
Register tmp1 = scratch;
__ xorl(tmp0, tmp0);
__ xorl(tmp1, tmp1);
}
__ Call(masm->stubs()->GetLoadPropertyStub());
}


void LStoreProperty::Generate(Masm* masm) {
Label ic_done;

__ push(eax);
__ push(eax);
__ push(ecx);
__ push(ecx);

// eax <- object
// ebx <- property
__ mov(ecx, Immediate(1));

CheckIC(masm, &ic_done);
__ Call(masm->stubs()->GetLookupPropertyStub());
UpdateIC(masm);
__ bind(&ic_done);

// Make eax look like unboxed number to GC
__ dec(eax);
__ CheckGC();
__ inc(eax);

__ pop(ecx);
__ pop(ecx);
__ pop(ebx);
__ pop(ebx);

Label done;
__ IsNil(eax, NULL, &done);

Operand qmap(ebx, HObject::kMapOffset);
__ push(ebx);
__ mov(ebx, qmap);
__ addl(eax, ebx);
__ pop(ebx);

Operand slot(eax, 0);
__ mov(slot, ecx);

__ bind(&done);

if (HasMonomorphicProperty()) {
// Cleanup scratches
Register tmp0 = scratches[0]->ToRegister();
Register tmp1 = scratch;
__ xorl(tmp0, tmp0);
__ xorl(tmp1, tmp1);
}
// ecx <- value
__ Call(masm->stubs()->GetStorePropertyStub());
}


@@ -774,6 +774,69 @@ void CloneObjectStub::Generate() {
}


void LoadPropertyStub::Generate() {
GeneratePrologue();

Label done;
Masm::Spill eax_s(masm(), eax);

// eax <- object
// ebx <- propery
__ mov(ecx, Immediate(0));
__ Call(masm()->stubs()->GetLookupPropertyStub());

__ IsNil(eax, NULL, &done);
eax_s.Unspill(ebx);
Operand qmap(ebx, HObject::kMapOffset);
__ mov(ebx, qmap);
__ addl(eax, ebx);

Operand slot(eax, 0);
__ mov(eax, slot);

__ bind(&done);

// eax -> result
GenerateEpilogue(0);
}


void StorePropertyStub::Generate() {
GeneratePrologue();

Label done;
Masm::Spill eax_s(masm(), eax);
Masm::Spill ecx_s(masm(), ecx);

// eax <- object
// ebx <- propery
// ecx <- value
__ mov(ecx, Immediate(1));
__ Call(masm()->stubs()->GetLookupPropertyStub());

// Make eax look like unboxed number to GC
__ dec(eax);
__ CheckGC();
__ inc(eax);

__ IsNil(eax, NULL, &done);
eax_s.Unspill(ebx);
ecx_s.Unspill(ecx);
Operand qmap(ebx, HObject::kMapOffset);
__ mov(ebx, qmap);
__ addl(eax, ebx);

Operand slot(eax, 0);
__ mov(slot, ecx);

// ebx <- object
__ bind(&done);
eax_s.Unspill(ebx);

GenerateEpilogue(0);
}


void DeletePropertyStub::Generate() {
GeneratePrologue();

@@ -28,6 +28,8 @@ namespace internal {
V(LookupProperty)\
V(CoerceToBoolean)\
V(CloneObject)\
V(LoadProperty)\
V(StoreProperty)\
V(DeleteProperty)\
V(HashValue)\
V(StackTrace)
@@ -102,15 +102,13 @@ void LLiteral::Generate(Masm* masm) {


void LAllocateObject::Generate(Masm* masm) {
// XXX Use correct size here
__ push(Immediate(HNumber::Tag(size_)));
__ push(Immediate(HNumber::Tag(Heap::kTagObject)));
__ Call(masm->stubs()->GetAllocateObjectStub());
}


void LAllocateArray::Generate(Masm* masm) {
// XXX Use correct size here
__ push(Immediate(HNumber::Tag(size_)));
__ push(Immediate(HNumber::Tag(Heap::kTagArray)));
__ Call(masm->stubs()->GetAllocateObjectStub());
@@ -246,89 +244,17 @@ void LAccessProperty::UpdateIC(Masm* masm) {


void LLoadProperty::Generate(Masm* masm) {
Label ic_done, done;

__ push(rax);
__ push(rax);

CheckIC(masm, &ic_done);

// rax <- object
// rbx <- property
__ mov(rcx, Immediate(0));
__ Call(masm->stubs()->GetLookupPropertyStub());
UpdateIC(masm);
__ bind(&ic_done);

__ pop(rbx);
__ pop(rbx);


__ IsNil(rax, NULL, &done);
Operand qmap(rbx, HObject::kMapOffset);
__ mov(rbx, qmap);
__ addq(rax, rbx);

Operand slot(rax, 0);
__ mov(rax, slot);

__ bind(&done);

if (HasMonomorphicProperty()) {
// Cleanup scratches
Register tmp0 = scratches[0]->ToRegister();
Register tmp1 = scratches[1]->ToRegister();
__ xorq(tmp0, tmp0);
__ xorq(tmp1, tmp1);
}
__ Call(masm->stubs()->GetLoadPropertyStub());
}


void LStoreProperty::Generate(Masm* masm) {
Label ic_done, done;

__ push(rax);
__ push(rcx);

CheckIC(masm, &ic_done);

// rax <- object
// rbx <- property
// rcx <- value
__ mov(rcx, Immediate(1));
__ Call(masm->stubs()->GetLookupPropertyStub());

UpdateIC(masm);
__ bind(&ic_done);

// Make rax look like unboxed number to GC
__ dec(rax);
__ CheckGC();
__ inc(rax);

__ pop(rcx);
__ pop(rbx);

__ IsNil(rax, NULL, &done);

Operand qmap(rbx, HObject::kMapOffset);
__ push(rbx);
__ mov(rbx, qmap);
__ addq(rax, rbx);
__ pop(rbx);

Operand slot(rax, 0);
__ mov(slot, rcx);

__ bind(&done);

if (HasMonomorphicProperty()) {
// Cleanup scratches
Register tmp0 = scratches[0]->ToRegister();
Register tmp1 = scratches[1]->ToRegister();
__ xorq(tmp0, tmp0);
__ xorq(tmp1, tmp1);
}
__ Call(masm->stubs()->GetStorePropertyStub());
}