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
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(),
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);
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();
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());
}
int offset = access.offset();
if (access.IsExternalMemory()) {
+ ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
MemOperand operand = instr->object()->IsConstantOperand()
? MemOperand::StaticVariable(
ToExternalReference(LConstantOperand::cast(instr->object())))
int offset = access.offset();
if (access.IsExternalMemory()) {
+ ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
Register value = ToRegister(instr->value());
if (instr->object()->IsConstantOperand()) {
ASSERT(value.is(rax));