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

Side by Side Diff: src/type-info.cc

Issue 755513003: Hydrogen: fix keyed loads with string keys (Closed) Base URL: gh:v8/v8@master
Patch Set: fixes Created 6 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 *store_mode = KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state); 123 *store_mode = KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state);
124 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state); 124 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state);
125 return; 125 return;
126 } 126 }
127 } 127 }
128 *store_mode = STANDARD_STORE; 128 *store_mode = STANDARD_STORE;
129 *key_type = ELEMENT; 129 *key_type = ELEMENT;
130 } 130 }
131 131
132 132
133 void TypeFeedbackOracle::GetLoadKeyType(
134 TypeFeedbackId ast_id, IcCheckType* key_type) {
135 Handle<Object> maybe_code = GetInfo(ast_id);
136 if (maybe_code->IsCode()) {
137 Handle<Code> code = Handle<Code>::cast(maybe_code);
138 if (code->kind() == Code::KEYED_LOAD_IC) {
139 ExtraICState extra_ic_state = code->extra_ic_state();
140 *key_type = KeyedLoadIC::GetKeyType(extra_ic_state);
141 return;
142 }
143 }
144 *key_type = ELEMENT;
145 }
146
147
133 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget( 148 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(
134 FeedbackVectorICSlot slot) { 149 FeedbackVectorICSlot slot) {
135 Handle<Object> info = GetInfo(slot); 150 Handle<Object> info = GetInfo(slot);
136 if (info->IsAllocationSite()) { 151 if (info->IsAllocationSite()) {
137 return Handle<JSFunction>(isolate()->native_context()->array_function()); 152 return Handle<JSFunction>(isolate()->native_context()->array_function());
138 } 153 }
139 154
140 return Handle<JSFunction>::cast(info); 155 return Handle<JSFunction>::cast(info);
141 } 156 }
142 157
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void TypeFeedbackOracle::PropertyReceiverTypes(TypeFeedbackId id, 278 void TypeFeedbackOracle::PropertyReceiverTypes(TypeFeedbackId id,
264 Handle<String> name, 279 Handle<String> name,
265 SmallMapList* receiver_types) { 280 SmallMapList* receiver_types) {
266 receiver_types->Clear(); 281 receiver_types->Clear();
267 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 282 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
268 CollectReceiverTypes(id, name, flags, receiver_types); 283 CollectReceiverTypes(id, name, flags, receiver_types);
269 } 284 }
270 285
271 286
272 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( 287 void TypeFeedbackOracle::KeyedPropertyReceiverTypes(
273 TypeFeedbackId id, SmallMapList* receiver_types, bool* is_string) { 288 TypeFeedbackId id,
289 SmallMapList* receiver_types,
290 bool* is_string,
291 IcCheckType* key_type) {
274 receiver_types->Clear(); 292 receiver_types->Clear();
275 CollectReceiverTypes(id, receiver_types); 293 CollectReceiverTypes(id, receiver_types);
276 294
277 // Are all the receiver maps string maps? 295 // Are all the receiver maps string maps?
278 bool all_strings = receiver_types->length() > 0; 296 bool all_strings = receiver_types->length() > 0;
279 for (int i = 0; i < receiver_types->length(); i++) { 297 for (int i = 0; i < receiver_types->length(); i++) {
280 all_strings &= receiver_types->at(i)->IsStringMap(); 298 all_strings &= receiver_types->at(i)->IsStringMap();
281 } 299 }
282 *is_string = all_strings; 300 *is_string = all_strings;
301
302 GetLoadKeyType(id, key_type);
283 } 303 }
284 304
285 305
286 void TypeFeedbackOracle::AssignmentReceiverTypes( 306 void TypeFeedbackOracle::AssignmentReceiverTypes(
287 TypeFeedbackId id, Handle<String> name, SmallMapList* receiver_types) { 307 TypeFeedbackId id, Handle<String> name, SmallMapList* receiver_types) {
288 receiver_types->Clear(); 308 receiver_types->Clear();
289 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); 309 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC);
290 CollectReceiverTypes(id, name, flags, receiver_types); 310 CollectReceiverTypes(id, name, flags, receiver_types);
291 } 311 }
292 312
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 UnseededNumberDictionary::kNotFound); 489 UnseededNumberDictionary::kNotFound);
470 // Dictionary has been allocated with sufficient size for all elements. 490 // Dictionary has been allocated with sufficient size for all elements.
471 DisallowHeapAllocation no_need_to_resize_dictionary; 491 DisallowHeapAllocation no_need_to_resize_dictionary;
472 HandleScope scope(isolate()); 492 HandleScope scope(isolate());
473 USE(UnseededNumberDictionary::AtNumberPut( 493 USE(UnseededNumberDictionary::AtNumberPut(
474 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 494 dictionary_, IdToKey(ast_id), handle(target, isolate())));
475 } 495 }
476 496
477 497
478 } } // namespace v8::internal 498 } } // namespace v8::internal
OLDNEW
« src/ic/ic-compiler.cc ('K') | « src/type-info.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698