Index: src/ic/handler-compiler.cc |
diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc |
index 4ed92ec6bfeeecfbe0f252edf4aff9f383566e8c..6180b5f6f18becb3d525dd781b76c4ee152673a8 100644 |
--- a/src/ic/handler-compiler.cc |
+++ b/src/ic/handler-compiler.cc |
@@ -309,7 +309,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter( |
// TODO(verwaest): Cleanup. holder() is actually the receiver. |
Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( |
Handle<Map> transition, Handle<Name> name) { |
- Label miss, slow; |
+ Label miss; |
// Ensure no transitions to deprecated maps are followed. |
__ CheckMapDeprecated(transition, scratch1(), &miss); |
@@ -331,21 +331,55 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition( |
DCHECK(holder()->HasFastProperties()); |
} |
- GenerateStoreTransition(transition, name, receiver(), this->name(), value(), |
- scratch1(), scratch2(), scratch3(), &miss, &slow); |
+ int descriptor = transition->LastAdded(); |
+ DescriptorArray* descriptors = transition->instance_descriptors(); |
+ PropertyDetails details = descriptors->GetDetails(descriptor); |
+ Representation representation = details.representation(); |
+ DCHECK(!representation.IsNone()); |
+ |
+ // Stub is never generated for objects that require access checks. |
+ DCHECK(!transition->is_access_check_needed()); |
+ |
+ // Call to respective StoreTransitionStub. |
+ if (details.type() == CONSTANT) { |
+ GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss); |
+ |
+ GenerateRestoreNameAndMap(name, transition); |
+ StoreTransitionStub stub(isolate()); |
+ GenerateTailCall(masm(), stub.GetCode()); |
+ |
+ } else { |
+ if (representation.IsHeapObject()) { |
+ GenerateFieldTypeChecks(descriptors->GetFieldType(descriptor), value(), |
+ &miss); |
+ } |
+ StoreTransitionStub::StoreMode store_mode = |
+ Map::cast(transition->GetBackPointer())->unused_property_fields() == 0 |
+ ? StoreTransitionStub::ExtendStorageAndStoreMapAndValue |
+ : StoreTransitionStub::StoreMapAndValue; |
+ |
+ GenerateRestoreNameAndMap(name, transition); |
+ StoreTransitionStub stub(isolate(), |
+ FieldIndex::ForDescriptor(*transition, descriptor), |
+ representation, store_mode); |
+ GenerateTailCall(masm(), stub.GetCode()); |
+ } |
GenerateRestoreName(&miss, name); |
TailCallBuiltin(masm(), MissBuiltin(kind())); |
- GenerateRestoreName(&slow, name); |
- TailCallBuiltin(masm(), SlowBuiltin(kind())); |
return GetCode(kind(), Code::FAST, name); |
} |
Handle<Code> NamedStoreHandlerCompiler::CompileStoreField(LookupIterator* it) { |
Label miss; |
- GenerateStoreField(it, value(), &miss); |
+ DCHECK(it->representation().IsHeapObject()); |
+ |
+ GenerateFieldTypeChecks(*it->GetFieldType(), value(), &miss); |
+ StoreFieldStub stub(isolate(), it->GetFieldIndex(), it->representation()); |
+ GenerateTailCall(masm(), stub.GetCode()); |
+ |
__ bind(&miss); |
TailCallBuiltin(masm(), MissBuiltin(kind())); |
return GetCode(kind(), Code::FAST, it->name()); |