Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: src/hydrogen.cc

Issue 935033003: Move LookupResult into crankshaft as that's now the only place where it's still used (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(*name_, &lookup_); 5973 lookup_.LookupDescriptor(*map_, *name_);
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
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(*name_, &lookup_); 6065 lookup_.LookupDescriptor(*map, *name_);
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(*name_, NONE, &lookup_); 6086 lookup_.LookupTransition(*map_, *name_, NONE);
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 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after
8164 break; 8164 break;
8165 default: 8165 default:
8166 // Not supported for inlining yet. 8166 // Not supported for inlining yet.
8167 break; 8167 break;
8168 } 8168 }
8169 return false; 8169 return false;
8170 } 8170 }
8171 8171
8172 8172
8173 // static 8173 // static
8174 bool HOptimizedGraphBuilder::IsReadOnlyLengthDescriptor(
8175 Handle<Map> jsarray_map) {
8176 DCHECK(!jsarray_map->is_dictionary_map());
8177 LookupResult lookup;
8178 Isolate* isolate = jsarray_map->GetIsolate();
8179 Handle<Name> length_string = isolate->factory()->length_string();
8180 lookup.LookupDescriptor(*jsarray_map, *length_string);
8181 return lookup.IsReadOnly();
8182 }
8183
8184
8185 // static
8174 bool HOptimizedGraphBuilder::CanInlineArrayResizeOperation( 8186 bool HOptimizedGraphBuilder::CanInlineArrayResizeOperation(
8175 Handle<Map> receiver_map) { 8187 Handle<Map> receiver_map) {
8176 return !receiver_map.is_null() && 8188 return !receiver_map.is_null() &&
8177 receiver_map->instance_type() == JS_ARRAY_TYPE && 8189 receiver_map->instance_type() == JS_ARRAY_TYPE &&
8178 IsFastElementsKind(receiver_map->elements_kind()) && 8190 IsFastElementsKind(receiver_map->elements_kind()) &&
8179 !receiver_map->is_dictionary_map() && 8191 !receiver_map->is_dictionary_map() &&
8180 !JSArray::IsReadOnlyLengthDescriptor(receiver_map) && 8192 !IsReadOnlyLengthDescriptor(receiver_map) &&
8181 !receiver_map->is_observed() && receiver_map->is_extensible(); 8193 !receiver_map->is_observed() && receiver_map->is_extensible();
8182 } 8194 }
8183 8195
8184 8196
8185 bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( 8197 bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
8186 Call* expr, Handle<JSFunction> function, Handle<Map> receiver_map, 8198 Call* expr, Handle<JSFunction> function, Handle<Map> receiver_map,
8187 int args_count_no_receiver) { 8199 int args_count_no_receiver) {
8188 if (!function->shared()->HasBuiltinFunctionId()) return false; 8200 if (!function->shared()->HasBuiltinFunctionId()) return false;
8189 BuiltinFunctionId id = function->shared()->builtin_function_id(); 8201 BuiltinFunctionId id = function->shared()->builtin_function_id();
8190 int argument_count = args_count_no_receiver + 1; // Plus receiver. 8202 int argument_count = args_count_no_receiver + 1; // Plus receiver.
(...skipping 5231 matching lines...) Expand 10 before | Expand all | Expand 10 after
13422 if (ShouldProduceTraceOutput()) { 13434 if (ShouldProduceTraceOutput()) {
13423 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13435 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13424 } 13436 }
13425 13437
13426 #ifdef DEBUG 13438 #ifdef DEBUG
13427 graph_->Verify(false); // No full verify. 13439 graph_->Verify(false); // No full verify.
13428 #endif 13440 #endif
13429 } 13441 }
13430 13442
13431 } } // namespace v8::internal 13443 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698