Commit 8c0f2eab authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Stores to external references don't need write barriers.

This also applies to stores with an external field representation.

Also cleans up the CreateAllocationSiteStub.

R=mstarzinger@chromium.org, mvstanton@chromium.org

Review URL: https://codereview.chromium.org/21357003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15989 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8ba5cabb
......@@ -459,11 +459,9 @@ Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
Zone* zone = this->zone();
HValue* size = AddInstruction(new(zone) HConstant(AllocationSite::kSize));
HInstruction* object = AddInstruction(new(zone)
HAllocate(context(), size, HType::JSObject(), true));
HValue* size = Add<HConstant>(AllocationSite::kSize);
HInstruction* object = Add<HAllocate>(
context(), size, HType::JSObject(), true);
// Store the map
Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(),
......@@ -471,8 +469,7 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
AddStoreMapConstant(object, allocation_site_map);
// Store the payload (smi elements kind)
HValue* initial_elements_kind = AddInstruction(new(zone) HConstant(
GetInitialFastElementsKind()));
HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind());
Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteTransitionInfo(),
initial_elements_kind);
......
......@@ -5374,6 +5374,11 @@ inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
if (object->IsConstant() && HConstant::cast(object)->IsCell()) {
return false;
}
if (object->IsConstant() &&
HConstant::cast(object)->HasExternalReferenceValue()) {
// Stores to external references require no write barriers
return false;
}
if (object != new_space_dominator) return true;
if (object->IsAllocate()) {
return !HAllocate::cast(object)->IsNewSpaceAllocation();
......@@ -6155,6 +6160,7 @@ class HStoreNamedField: public HTemplateInstruction<2> {
if (field_representation().IsDouble()) return false;
if (field_representation().IsSmi()) return false;
if (field_representation().IsInteger32()) return false;
if (field_representation().IsExternal()) return false;
return StoringValueNeedsWriteBarrier(value()) &&
ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
}
......
......@@ -4342,6 +4342,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
int offset = access.offset();
if (access.IsExternalMemory()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
MemOperand operand = instr->object()->IsConstantOperand()
? MemOperand::StaticVariable(
ToExternalReference(LConstantOperand::cast(instr->object())))
......
......@@ -3942,6 +3942,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
int offset = access.offset();
if (access.IsExternalMemory()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
Register value = ToRegister(instr->value());
if (instr->object()->IsConstantOperand()) {
ASSERT(value.is(rax));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment