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

Side by Side Diff: src/compiler/access-info.cc

Issue 2042013003: [builtins] Properly optimize TypedArray/DataView accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Yang's comments. Created 4 years, 6 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/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <ostream> 5 #include <ostream>
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/compilation-dependencies.h" 8 #include "src/compilation-dependencies.h"
9 #include "src/compiler/access-info.h" 9 #include "src/compiler/access-info.h"
10 #include "src/field-index-inl.h" 10 #include "src/field-index-inl.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 PropertyAccessInfo PropertyAccessInfo::DataConstant( 68 PropertyAccessInfo PropertyAccessInfo::DataConstant(
69 Type* receiver_type, Handle<Object> constant, 69 Type* receiver_type, Handle<Object> constant,
70 MaybeHandle<JSObject> holder) { 70 MaybeHandle<JSObject> holder) {
71 return PropertyAccessInfo(holder, constant, receiver_type); 71 return PropertyAccessInfo(holder, constant, receiver_type);
72 } 72 }
73 73
74 74
75 // static 75 // static
76 PropertyAccessInfo PropertyAccessInfo::DataField( 76 PropertyAccessInfo PropertyAccessInfo::DataField(
77 Type* receiver_type, FieldIndex field_index, Type* field_type, 77 Type* receiver_type, FieldIndex field_index, Type* field_type,
78 FieldCheck field_check, MaybeHandle<JSObject> holder, 78 MaybeHandle<JSObject> holder, MaybeHandle<Map> transition_map) {
79 MaybeHandle<Map> transition_map) { 79 return PropertyAccessInfo(holder, transition_map, field_index,
80 return PropertyAccessInfo(holder, transition_map, field_index, field_check,
81 field_type, receiver_type); 80 field_type, receiver_type);
82 } 81 }
83 82
84 83
85 ElementAccessInfo::ElementAccessInfo() : receiver_type_(Type::None()) {} 84 ElementAccessInfo::ElementAccessInfo() : receiver_type_(Type::None()) {}
86 85
87 86
88 ElementAccessInfo::ElementAccessInfo(Type* receiver_type, 87 ElementAccessInfo::ElementAccessInfo(Type* receiver_type,
89 ElementsKind elements_kind, 88 ElementsKind elements_kind,
90 MaybeHandle<JSObject> holder) 89 MaybeHandle<JSObject> holder)
(...skipping 20 matching lines...) Expand all
111 : kind_(kDataConstant), 110 : kind_(kDataConstant),
112 receiver_type_(receiver_type), 111 receiver_type_(receiver_type),
113 constant_(constant), 112 constant_(constant),
114 holder_(holder), 113 holder_(holder),
115 field_type_(Type::Any()) {} 114 field_type_(Type::Any()) {}
116 115
117 116
118 PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder, 117 PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder,
119 MaybeHandle<Map> transition_map, 118 MaybeHandle<Map> transition_map,
120 FieldIndex field_index, 119 FieldIndex field_index,
121 FieldCheck field_check, Type* field_type, 120 Type* field_type,
122 Type* receiver_type) 121 Type* receiver_type)
123 : kind_(kDataField), 122 : kind_(kDataField),
124 receiver_type_(receiver_type), 123 receiver_type_(receiver_type),
125 transition_map_(transition_map), 124 transition_map_(transition_map),
126 holder_(holder), 125 holder_(holder),
127 field_index_(field_index), 126 field_index_(field_index),
128 field_check_(field_check),
129 field_type_(field_type) {} 127 field_type_(field_type) {}
130 128
131 129
132 AccessInfoFactory::AccessInfoFactory(CompilationDependencies* dependencies, 130 AccessInfoFactory::AccessInfoFactory(CompilationDependencies* dependencies,
133 Handle<Context> native_context, Zone* zone) 131 Handle<Context> native_context, Zone* zone)
134 : dependencies_(dependencies), 132 : dependencies_(dependencies),
135 native_context_(native_context), 133 native_context_(native_context),
136 isolate_(native_context->GetIsolate()), 134 isolate_(native_context->GetIsolate()),
137 type_cache_(TypeCache::Get()), 135 type_cache_(TypeCache::Get()),
138 zone_(zone) { 136 zone_(zone) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 field_type = Type::TaggedPointer(); 291 field_type = Type::TaggedPointer();
294 } else if (!Type::Any()->Is(field_type)) { 292 } else if (!Type::Any()->Is(field_type)) {
295 // Add proper code dependencies in case of stable field map(s). 293 // Add proper code dependencies in case of stable field map(s).
296 Handle<Map> field_owner_map(map->FindFieldOwner(number), isolate()); 294 Handle<Map> field_owner_map(map->FindFieldOwner(number), isolate());
297 dependencies()->AssumeFieldType(field_owner_map); 295 dependencies()->AssumeFieldType(field_owner_map);
298 } 296 }
299 DCHECK(field_type->Is(Type::TaggedPointer())); 297 DCHECK(field_type->Is(Type::TaggedPointer()));
300 } 298 }
301 *access_info = PropertyAccessInfo::DataField( 299 *access_info = PropertyAccessInfo::DataField(
302 Type::Class(receiver_map, zone()), field_index, field_type, 300 Type::Class(receiver_map, zone()), field_index, field_type,
303 FieldCheck::kNone, holder); 301 holder);
304 return true; 302 return true;
305 } else { 303 } else {
306 // TODO(bmeurer): Add support for accessors. 304 // TODO(bmeurer): Add support for accessors.
307 return false; 305 return false;
308 } 306 }
309 } 307 }
310 308
311 // Don't search on the prototype chain for special indices in case of 309 // Don't search on the prototype chain for special indices in case of
312 // integer indexed exotic objects (see ES6 section 9.4.5). 310 // integer indexed exotic objects (see ES6 section 9.4.5).
313 if (map->IsJSTypedArrayMap() && name->IsString() && 311 if (map->IsJSTypedArrayMap() && name->IsString() &&
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } else if (!Type::Any()->Is(field_type)) { 443 } else if (!Type::Any()->Is(field_type)) {
446 // Add proper code dependencies in case of stable field map(s). 444 // Add proper code dependencies in case of stable field map(s).
447 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number), 445 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number),
448 isolate()); 446 isolate());
449 dependencies()->AssumeFieldType(field_owner_map); 447 dependencies()->AssumeFieldType(field_owner_map);
450 } 448 }
451 DCHECK(field_type->Is(Type::TaggedPointer())); 449 DCHECK(field_type->Is(Type::TaggedPointer()));
452 } 450 }
453 dependencies()->AssumeMapNotDeprecated(transition_map); 451 dependencies()->AssumeMapNotDeprecated(transition_map);
454 *access_info = PropertyAccessInfo::DataField( 452 *access_info = PropertyAccessInfo::DataField(
455 Type::Class(map, zone()), field_index, field_type, FieldCheck::kNone, 453 Type::Class(map, zone()), field_index, field_type,
456 holder, transition_map); 454 holder, transition_map);
457 return true; 455 return true;
458 } 456 }
459 return false; 457 return false;
460 } 458 }
461 459
462 460
463 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } 461 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); }
464 462
465 } // namespace compiler 463 } // namespace compiler
466 } // namespace internal 464 } // namespace internal
467 } // namespace v8 465 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698