OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 } | 5963 } |
5964 } | 5964 } |
5965 info->GeneralizeRepresentation(r); | 5965 info->GeneralizeRepresentation(r); |
5966 info->field_type_ = info->field_type_.Combine(field_type_); | 5966 info->field_type_ = info->field_type_.Combine(field_type_); |
5967 return true; | 5967 return true; |
5968 } | 5968 } |
5969 | 5969 |
5970 | 5970 |
5971 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupDescriptor() { | 5971 bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupDescriptor() { |
5972 if (!map_->IsJSObjectMap()) return true; | 5972 if (!map_->IsJSObjectMap()) return true; |
5973 map_->LookupDescriptor(NULL, *name_, &lookup_); | 5973 map_->LookupDescriptor(*name_, &lookup_); |
5974 return LoadResult(map_); | 5974 return LoadResult(map_); |
5975 } | 5975 } |
5976 | 5976 |
5977 | 5977 |
5978 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) { | 5978 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) { |
5979 if (!IsLoad() && IsProperty() && IsReadOnly()) { | 5979 if (!IsLoad() && IsProperty() && IsReadOnly()) { |
5980 return false; | 5980 return false; |
5981 } | 5981 } |
5982 | 5982 |
5983 if (IsData()) { | 5983 if (IsData()) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6055 while (map->prototype()->IsJSObject()) { | 6055 while (map->prototype()->IsJSObject()) { |
6056 holder_ = handle(JSObject::cast(map->prototype())); | 6056 holder_ = handle(JSObject::cast(map->prototype())); |
6057 if (holder_->map()->is_deprecated()) { | 6057 if (holder_->map()->is_deprecated()) { |
6058 JSObject::TryMigrateInstance(holder_); | 6058 JSObject::TryMigrateInstance(holder_); |
6059 } | 6059 } |
6060 map = Handle<Map>(holder_->map()); | 6060 map = Handle<Map>(holder_->map()); |
6061 if (!CanInlinePropertyAccess(map)) { | 6061 if (!CanInlinePropertyAccess(map)) { |
6062 lookup_.NotFound(); | 6062 lookup_.NotFound(); |
6063 return false; | 6063 return false; |
6064 } | 6064 } |
6065 map->LookupDescriptor(*holder_, *name_, &lookup_); | 6065 map->LookupDescriptor(*name_, &lookup_); |
6066 if (IsFound()) return LoadResult(map); | 6066 if (IsFound()) return LoadResult(map); |
6067 } | 6067 } |
6068 lookup_.NotFound(); | 6068 lookup_.NotFound(); |
6069 return true; | 6069 return true; |
6070 } | 6070 } |
6071 | 6071 |
6072 | 6072 |
6073 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() { | 6073 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() { |
6074 if (!CanInlinePropertyAccess(map_)) return false; | 6074 if (!CanInlinePropertyAccess(map_)) return false; |
6075 if (IsJSObjectFieldAccessor()) return IsLoad(); | 6075 if (IsJSObjectFieldAccessor()) return IsLoad(); |
6076 if (map_->function_with_prototype() && !map_->has_non_instance_prototype() && | 6076 if (map_->function_with_prototype() && !map_->has_non_instance_prototype() && |
6077 name_.is_identical_to(isolate()->factory()->prototype_string())) { | 6077 name_.is_identical_to(isolate()->factory()->prototype_string())) { |
6078 return IsLoad(); | 6078 return IsLoad(); |
6079 } | 6079 } |
6080 if (!LookupDescriptor()) return false; | 6080 if (!LookupDescriptor()) return false; |
6081 if (IsFound()) return IsLoad() || !IsReadOnly(); | 6081 if (IsFound()) return IsLoad() || !IsReadOnly(); |
6082 if (!LookupInPrototypes()) return false; | 6082 if (!LookupInPrototypes()) return false; |
6083 if (IsLoad()) return true; | 6083 if (IsLoad()) return true; |
6084 | 6084 |
6085 if (IsAccessorConstant()) return true; | 6085 if (IsAccessorConstant()) return true; |
6086 map_->LookupTransition(NULL, *name_, NONE, &lookup_); | 6086 map_->LookupTransition(*name_, NONE, &lookup_); |
6087 if (lookup_.IsTransitionToData() && map_->unused_property_fields() > 0) { | 6087 if (lookup_.IsTransitionToData() && map_->unused_property_fields() > 0) { |
6088 // Construct the object field access. | 6088 // Construct the object field access. |
6089 int descriptor = transition()->LastAdded(); | 6089 int descriptor = transition()->LastAdded(); |
6090 int index = | 6090 int index = |
6091 transition()->instance_descriptors()->GetFieldIndex(descriptor) - | 6091 transition()->instance_descriptors()->GetFieldIndex(descriptor) - |
6092 map_->inobject_properties(); | 6092 map_->inobject_properties(); |
6093 PropertyDetails details = | 6093 PropertyDetails details = |
6094 transition()->instance_descriptors()->GetDetails(descriptor); | 6094 transition()->instance_descriptors()->GetDetails(descriptor); |
6095 Representation representation = details.representation(); | 6095 Representation representation = details.representation(); |
6096 access_ = HObjectAccess::ForField(map_, index, representation, name_); | 6096 access_ = HObjectAccess::ForField(map_, index, representation, name_); |
(...skipping 7325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13422 if (ShouldProduceTraceOutput()) { | 13422 if (ShouldProduceTraceOutput()) { |
13423 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13423 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13424 } | 13424 } |
13425 | 13425 |
13426 #ifdef DEBUG | 13426 #ifdef DEBUG |
13427 graph_->Verify(false); // No full verify. | 13427 graph_->Verify(false); // No full verify. |
13428 #endif | 13428 #endif |
13429 } | 13429 } |
13430 | 13430 |
13431 } } // namespace v8::internal | 13431 } } // namespace v8::internal |
OLD | NEW |