Commit 8bc9d987 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Implement IC support for Constant Function transitions.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/16826016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15124 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fede5231
......@@ -512,7 +512,13 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
Register storage_reg = name_reg;
if (FLAG_track_fields && representation.IsSmi()) {
if (details.type() == CONSTANT_FUNCTION) {
Handle<HeapObject> constant(
HeapObject::cast(descriptors->GetValue(descriptor)));
__ LoadHeapObject(scratch1, constant);
__ cmp(value_reg, scratch1);
__ b(ne, miss_restore_name);
} else if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_restore_name);
} else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
__ JumpIfSmi(value_reg, miss_restore_name);
......@@ -570,6 +576,8 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
if (details.type() == CONSTANT_FUNCTION) return;
int index = transition->instance_descriptors()->GetFieldIndex(
transition->LastAdded());
......
......@@ -839,8 +839,14 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
Register storage_reg = name_reg;
if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_restore_name);
if (details.type() == CONSTANT_FUNCTION) {
Handle<HeapObject> constant(
HeapObject::cast(descriptors->GetValue(descriptor)));
__ LoadHeapObject(scratch1, constant);
__ cmp(value_reg, scratch1);
__ j(not_equal, miss_restore_name);
} else if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_restore_name);
} else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
__ JumpIfSmi(value_reg, miss_restore_name);
} else if (FLAG_track_double_fields && representation.IsDouble()) {
......@@ -913,6 +919,8 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
if (details.type() == CONSTANT_FUNCTION) return;
int index = transition->instance_descriptors()->GetFieldIndex(
transition->LastAdded());
......
......@@ -1733,7 +1733,7 @@ Handle<Code> StoreIC::ComputeStoreMonomorphic(LookupResult* lookup,
DescriptorArray* target_descriptors = transition->instance_descriptors();
PropertyDetails details = target_descriptors->GetDetails(descriptor);
if (details.type() != FIELD || details.attributes() != NONE) break;
if (details.type() == CALLBACKS || details.attributes() != NONE) break;
return isolate()->stub_cache()->ComputeStoreTransition(
name, receiver, lookup, transition, strict_mode);
......@@ -2099,7 +2099,7 @@ Handle<Code> KeyedStoreIC::ComputeStoreMonomorphic(LookupResult* lookup,
DescriptorArray* target_descriptors = transition->instance_descriptors();
PropertyDetails details = target_descriptors->GetDetails(descriptor);
if (details.type() == FIELD && details.attributes() == NONE) {
if (details.type() != CALLBACKS && details.attributes() == NONE) {
return isolate()->stub_cache()->ComputeKeyedStoreTransition(
name, receiver, lookup, transition, strict_mode);
}
......
......@@ -392,6 +392,11 @@ class LookupResult BASE_EMBEDDED {
return IsTransition() && GetTransitionDetails(map).type() == FIELD;
}
bool IsTransitionToConstantFunction(Map* map) {
return IsTransition() &&
GetTransitionDetails(map).type() == CONSTANT_FUNCTION;
}
Map* GetTransitionMap() {
ASSERT(IsTransition());
return Map::cast(GetValue());
......
......@@ -817,7 +817,13 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
Register storage_reg = name_reg;
if (FLAG_track_fields && representation.IsSmi()) {
if (details.type() == CONSTANT_FUNCTION) {
Handle<HeapObject> constant(
HeapObject::cast(descriptors->GetValue(descriptor)));
__ LoadHeapObject(scratch1, constant);
__ cmpq(value_reg, scratch1);
__ j(not_equal, miss_restore_name);
} else if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_restore_name);
} else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
__ JumpIfSmi(value_reg, miss_restore_name);
......@@ -873,6 +879,8 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
if (details.type() == CONSTANT_FUNCTION) return;
int index = transition->instance_descriptors()->GetFieldIndex(
transition->LastAdded());
......
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