Commit 41f660fe authored by verwaest@chromium.org's avatar verwaest@chromium.org

Rename ComputeLoadStoreField to just handle ComputeStoreField.

R=jkummerow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17086 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6c8e9df2
...@@ -4557,31 +4557,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { ...@@ -4557,31 +4557,6 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
} }
// Sets the lookup result and returns true if the load/store can be inlined.
static bool ComputeLoadStoreField(Handle<Map> type,
Handle<String> name,
LookupResult* lookup,
bool is_store) {
ASSERT(!is_store || !type->is_observed());
if (!CanInlinePropertyAccess(*type)) {
lookup->NotFound();
return false;
}
// If we directly find a field, the access can be inlined.
type->LookupDescriptor(NULL, *name, lookup);
if (lookup->IsField()) return true;
// For a load, we are out of luck if there is no such field.
if (!is_store) return false;
// 2nd chance: A store into a non-existent field can still be inlined if we
// have a matching transition and some room left in the object.
type->LookupTransition(NULL, *name, lookup);
return lookup->IsTransitionToField(*type) &&
(type->unused_property_fields() > 0);
}
HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object,
Handle<Map> map) { Handle<Map> map) {
BuildCheckHeapObject(object); BuildCheckHeapObject(object);
...@@ -4687,6 +4662,28 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric( ...@@ -4687,6 +4662,28 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric(
} }
// Sets the lookup result and returns true if the load/store can be inlined.
static bool ComputeStoreField(Handle<Map> type,
Handle<String> name,
LookupResult* lookup,
bool lookup_transition = true) {
ASSERT(!type->is_observed());
if (!CanInlinePropertyAccess(*type)) {
lookup->NotFound();
return false;
}
// If we directly find a field, the access can be inlined.
type->LookupDescriptor(NULL, *name, lookup);
if (lookup->IsField()) return true;
if (!lookup_transition) return false;
type->LookupTransition(NULL, *name, lookup);
return lookup->IsTransitionToField(*type) &&
(type->unused_property_fields() > 0);
}
HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic( HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic(
HValue* object, HValue* object,
Handle<String> name, Handle<String> name,
...@@ -4694,7 +4691,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic( ...@@ -4694,7 +4691,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic(
Handle<Map> map) { Handle<Map> map) {
// Handle a store to a known field. // Handle a store to a known field.
LookupResult lookup(isolate()); LookupResult lookup(isolate());
if (ComputeLoadStoreField(map, name, &lookup, true)) { if (ComputeStoreField(map, name, &lookup)) {
HCheckMaps* checked_object = AddCheckMap(object, map); HCheckMaps* checked_object = AddCheckMap(object, map);
return BuildStoreNamedField(checked_object, name, value, map, &lookup); return BuildStoreNamedField(checked_object, name, value, map, &lookup);
} }
...@@ -4964,7 +4961,7 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic( ...@@ -4964,7 +4961,7 @@ bool HOptimizedGraphBuilder::TryStorePolymorphicAsMonomorphic(
for (count = 0; count < types->length(); ++count) { for (count = 0; count < types->length(); ++count) {
Handle<Map> map = types->at(count); Handle<Map> map = types->at(count);
// Pass false to ignore transitions. // Pass false to ignore transitions.
if (!ComputeLoadStoreField(map, name, &lookup, false)) break; if (!ComputeStoreField(map, name, &lookup, false)) break;
ASSERT(!map->is_observed()); ASSERT(!map->is_observed());
HObjectAccess new_access = HObjectAccess::ForField(map, &lookup, name); HObjectAccess new_access = HObjectAccess::ForField(map, &lookup, name);
...@@ -5026,7 +5023,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField( ...@@ -5026,7 +5023,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicStoreNamedField(
for (int i = 0; i < types->length() && count < kMaxStorePolymorphism; ++i) { for (int i = 0; i < types->length() && count < kMaxStorePolymorphism; ++i) {
Handle<Map> map = types->at(i); Handle<Map> map = types->at(i);
LookupResult lookup(isolate()); LookupResult lookup(isolate());
if (ComputeLoadStoreField(map, name, &lookup, true)) { if (ComputeStoreField(map, name, &lookup)) {
if (count == 0) { if (count == 0) {
BuildCheckHeapObject(object); BuildCheckHeapObject(object);
join = graph()->CreateBasicBlock(); join = graph()->CreateBasicBlock();
......
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