| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 5959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5970 | 5970 |
| 5971 | 5971 |
| 5972 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) { | 5972 bool HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) { |
| 5973 if (!IsLoad() && lookup_.IsProperty() && | 5973 if (!IsLoad() && lookup_.IsProperty() && |
| 5974 (lookup_.IsReadOnly() || !lookup_.IsCacheable())) { | 5974 (lookup_.IsReadOnly() || !lookup_.IsCacheable())) { |
| 5975 return false; | 5975 return false; |
| 5976 } | 5976 } |
| 5977 | 5977 |
| 5978 if (lookup_.IsField()) { | 5978 if (lookup_.IsField()) { |
| 5979 // Construct the object field access. | 5979 // Construct the object field access. |
| 5980 access_ = HObjectAccess::ForField(map, &lookup_, name_); | 5980 int index = lookup_.GetLocalFieldIndexFromMap(*map); |
| 5981 Representation representation = lookup_.representation(); |
| 5982 access_ = HObjectAccess::ForField(map, index, representation, name_); |
| 5981 | 5983 |
| 5982 // Load field map for heap objects. | 5984 // Load field map for heap objects. |
| 5983 LoadFieldMaps(map); | 5985 LoadFieldMaps(map); |
| 5984 } else if (lookup_.IsPropertyCallbacks()) { | 5986 } else if (lookup_.IsPropertyCallbacks()) { |
| 5985 Handle<Object> callback(lookup_.GetValueFromMap(*map), isolate()); | 5987 Handle<Object> callback(lookup_.GetValueFromMap(*map), isolate()); |
| 5986 if (!callback->IsAccessorPair()) return false; | 5988 if (!callback->IsAccessorPair()) return false; |
| 5987 Object* raw_accessor = IsLoad() | 5989 Object* raw_accessor = IsLoad() |
| 5988 ? Handle<AccessorPair>::cast(callback)->getter() | 5990 ? Handle<AccessorPair>::cast(callback)->getter() |
| 5989 : Handle<AccessorPair>::cast(callback)->setter(); | 5991 : Handle<AccessorPair>::cast(callback)->setter(); |
| 5990 if (!raw_accessor->IsJSFunction()) return false; | 5992 if (!raw_accessor->IsJSFunction()) return false; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6080 return !lookup_.IsReadOnly() && lookup_.IsCacheable(); | 6082 return !lookup_.IsReadOnly() && lookup_.IsCacheable(); |
| 6081 } | 6083 } |
| 6082 if (!LookupInPrototypes()) return false; | 6084 if (!LookupInPrototypes()) return false; |
| 6083 if (IsLoad()) return true; | 6085 if (IsLoad()) return true; |
| 6084 | 6086 |
| 6085 if (lookup_.IsPropertyCallbacks()) return true; | 6087 if (lookup_.IsPropertyCallbacks()) return true; |
| 6086 Handle<Map> map = this->map(); | 6088 Handle<Map> map = this->map(); |
| 6087 map->LookupTransition(NULL, *name_, &lookup_); | 6089 map->LookupTransition(NULL, *name_, &lookup_); |
| 6088 if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) { | 6090 if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) { |
| 6089 // Construct the object field access. | 6091 // Construct the object field access. |
| 6090 access_ = HObjectAccess::ForField(map, &lookup_, name_); | 6092 int descriptor = transition()->LastAdded(); |
| 6093 int index = |
| 6094 transition()->instance_descriptors()->GetFieldIndex(descriptor) - |
| 6095 map->inobject_properties(); |
| 6096 PropertyDetails details = |
| 6097 transition()->instance_descriptors()->GetDetails(descriptor); |
| 6098 Representation representation = details.representation(); |
| 6099 access_ = HObjectAccess::ForField(map, index, representation, name_); |
| 6091 | 6100 |
| 6092 // Load field map for heap objects. | 6101 // Load field map for heap objects. |
| 6093 LoadFieldMaps(transition()); | 6102 LoadFieldMaps(transition()); |
| 6094 return true; | 6103 return true; |
| 6095 } | 6104 } |
| 6096 return false; | 6105 return false; |
| 6097 } | 6106 } |
| 6098 | 6107 |
| 6099 | 6108 |
| 6100 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessAsMonomorphic( | 6109 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessAsMonomorphic( |
| (...skipping 6385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12486 if (ShouldProduceTraceOutput()) { | 12495 if (ShouldProduceTraceOutput()) { |
| 12487 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12496 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12488 } | 12497 } |
| 12489 | 12498 |
| 12490 #ifdef DEBUG | 12499 #ifdef DEBUG |
| 12491 graph_->Verify(false); // No full verify. | 12500 graph_->Verify(false); // No full verify. |
| 12492 #endif | 12501 #endif |
| 12493 } | 12502 } |
| 12494 | 12503 |
| 12495 } } // namespace v8::internal | 12504 } } // namespace v8::internal |
| OLD | NEW |