MIPS: The gc should be able to traverse all AllocationSites for decision making.

Port r15715 (2e830d4)

Original commit message:
The gc should be able to traverse all AllocationSites for decision making. The sites are threaded into a weak list. Special problems include:

* Allocations of AllocationSites occur in generated code, so generated code needs to be able to add to the list. For now I have a special hydrogen instruction, though it would be nice to use general purpose instructions.
* The snapshot contains AllocationSites, and these need to be re-threaded into the list on deserialization.

Something nice is that the AllocationSites are only created in old space, so a special new space visitor isn't required.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15732 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
palfia@homejinni.com 2013-07-17 18:39:34 +00:00
parent 86bfd87fa6
commit 462f6be930
3 changed files with 56 additions and 0 deletions

View File

@ -2794,6 +2794,19 @@ void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) {
}
void LCodeGen::DoLinkObjectInList(LLinkObjectInList* instr) {
Register object = ToRegister(instr->object());
ExternalReference sites_list_address = instr->GetReference(isolate());
__ li(at, Operand(sites_list_address));
__ lw(at, MemOperand(at));
__ sw(at, FieldMemOperand(object,
instr->hydrogen()->store_field().offset()));
__ li(at, Operand(sites_list_address));
__ sw(object, MemOperand(at));
}
void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
Register context = ToRegister(instr->context());
Register result = ToRegister(instr->result());

View File

@ -277,6 +277,24 @@ void LCallConstantFunction::PrintDataTo(StringStream* stream) {
}
ExternalReference LLinkObjectInList::GetReference(Isolate* isolate) {
switch (hydrogen()->known_list()) {
case HLinkObjectInList::ALLOCATION_SITE_LIST:
return ExternalReference::allocation_sites_list_address(isolate);
}
UNREACHABLE();
// Return a dummy value
return ExternalReference::isolate_address(isolate);
}
void LLinkObjectInList::PrintDataTo(StringStream* stream) {
object()->PrintTo(stream);
stream->Add(" offset %d", hydrogen()->store_field().offset());
}
void LLoadContextSlot::PrintDataTo(StringStream* stream) {
context()->PrintTo(stream);
stream->Add("[%d]", slot_index());
@ -2035,6 +2053,13 @@ LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
}
LInstruction* LChunkBuilder::DoLinkObjectInList(HLinkObjectInList* instr) {
LOperand* object = UseRegister(instr->value());
LLinkObjectInList* result = new(zone()) LLinkObjectInList(object);
return result;
}
LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
LOperand* context = UseRegisterAtStart(instr->value());
LInstruction* result =

View File

@ -120,6 +120,7 @@ class LCodeGen;
V(IsUndetectableAndBranch) \
V(Label) \
V(LazyBailout) \
V(LinkObjectInList) \
V(LoadContextSlot) \
V(LoadExternalArrayPointer) \
V(LoadFunctionPrototype) \
@ -1662,6 +1663,23 @@ class LStoreGlobalGeneric: public LTemplateInstruction<0, 2, 0> {
};
class LLinkObjectInList: public LTemplateInstruction<0, 1, 0> {
public:
explicit LLinkObjectInList(LOperand* object) {
inputs_[0] = object;
}
LOperand* object() { return inputs_[0]; }
ExternalReference GetReference(Isolate* isolate);
DECLARE_CONCRETE_INSTRUCTION(LinkObjectInList, "link-object-in-list")
DECLARE_HYDROGEN_ACCESSOR(LinkObjectInList)
virtual void PrintDataTo(StringStream* stream);
};
class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
public:
explicit LLoadContextSlot(LOperand* context) {