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

Side by Side Diff: src/type-feedback-vector.cc

Issue 935603002: Stop using HeapType in IC and Crankshaft (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/type-feedback-vector.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ic/ic.h" 7 #include "src/ic/ic.h"
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/type-feedback-vector-inl.h" 10 #include "src/type-feedback-vector-inl.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (!feedback->IsFixedArray() || 200 if (!feedback->IsFixedArray() ||
201 FixedArray::cast(*feedback)->length() != length) { 201 FixedArray::cast(*feedback)->length() != length) {
202 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); 202 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length);
203 SetFeedback(*array); 203 SetFeedback(*array);
204 return array; 204 return array;
205 } 205 }
206 return Handle<FixedArray>::cast(feedback); 206 return Handle<FixedArray>::cast(feedback);
207 } 207 }
208 208
209 209
210 void FeedbackNexus::InstallHandlers(int start_index, TypeHandleList* types, 210 void FeedbackNexus::InstallHandlers(int start_index, MapHandleList* maps,
211 CodeHandleList* handlers) { 211 CodeHandleList* handlers) {
212 Isolate* isolate = GetIsolate(); 212 Isolate* isolate = GetIsolate();
213 Handle<FixedArray> array = handle(FixedArray::cast(GetFeedback()), isolate); 213 Handle<FixedArray> array = handle(FixedArray::cast(GetFeedback()), isolate);
214 int receiver_count = types->length(); 214 int receiver_count = maps->length();
215 for (int current = 0; current < receiver_count; ++current) { 215 for (int current = 0; current < receiver_count; ++current) {
216 Handle<HeapType> type = types->at(current); 216 Handle<Map> map = maps->at(current);
217 Handle<Map> map = IC::TypeToMap(*type, isolate);
218 Handle<WeakCell> cell = Map::WeakCellForMap(map); 217 Handle<WeakCell> cell = Map::WeakCellForMap(map);
219 array->set(start_index + (current * 2), *cell); 218 array->set(start_index + (current * 2), *cell);
220 array->set(start_index + (current * 2 + 1), *handlers->at(current)); 219 array->set(start_index + (current * 2 + 1), *handlers->at(current));
221 } 220 }
222 } 221 }
223 222
224 223
225 InlineCacheState LoadICNexus::StateFromFeedback() const { 224 InlineCacheState LoadICNexus::StateFromFeedback() const {
226 Isolate* isolate = GetIsolate(); 225 Isolate* isolate = GetIsolate();
227 Object* feedback = GetFeedback(); 226 Object* feedback = GetFeedback();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 SKIP_WRITE_BARRIER); 325 SKIP_WRITE_BARRIER);
327 } 326 }
328 327
329 328
330 void KeyedLoadICNexus::ConfigurePremonomorphic() { 329 void KeyedLoadICNexus::ConfigurePremonomorphic() {
331 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()), 330 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()),
332 SKIP_WRITE_BARRIER); 331 SKIP_WRITE_BARRIER);
333 } 332 }
334 333
335 334
336 void LoadICNexus::ConfigureMonomorphic(Handle<HeapType> type, 335 void LoadICNexus::ConfigureMonomorphic(Handle<Map> receiver_map,
337 Handle<Code> handler) { 336 Handle<Code> handler) {
338 Handle<FixedArray> array = EnsureArrayOfSize(2); 337 Handle<FixedArray> array = EnsureArrayOfSize(2);
339 Handle<Map> receiver_map = IC::TypeToMap(*type, GetIsolate());
340 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); 338 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
341 array->set(0, *cell); 339 array->set(0, *cell);
342 array->set(1, *handler); 340 array->set(1, *handler);
343 } 341 }
344 342
345 343
346 void KeyedLoadICNexus::ConfigureMonomorphic(Handle<Name> name, 344 void KeyedLoadICNexus::ConfigureMonomorphic(Handle<Name> name,
347 Handle<HeapType> type, 345 Handle<Map> receiver_map,
348 Handle<Code> handler) { 346 Handle<Code> handler) {
349 Handle<FixedArray> array = EnsureArrayOfSize(3); 347 Handle<FixedArray> array = EnsureArrayOfSize(3);
350 Handle<Map> receiver_map = IC::TypeToMap(*type, GetIsolate());
351 if (name.is_null()) { 348 if (name.is_null()) {
352 array->set(0, Smi::FromInt(0)); 349 array->set(0, Smi::FromInt(0));
353 } else { 350 } else {
354 array->set(0, *name); 351 array->set(0, *name);
355 } 352 }
356 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); 353 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
357 array->set(1, *cell); 354 array->set(1, *cell);
358 array->set(2, *handler); 355 array->set(2, *handler);
359 } 356 }
360 357
361 358
362 void LoadICNexus::ConfigurePolymorphic(TypeHandleList* types, 359 void LoadICNexus::ConfigurePolymorphic(MapHandleList* maps,
363 CodeHandleList* handlers) { 360 CodeHandleList* handlers) {
364 int receiver_count = types->length(); 361 int receiver_count = maps->length();
365 EnsureArrayOfSize(receiver_count * 2); 362 EnsureArrayOfSize(receiver_count * 2);
366 InstallHandlers(0, types, handlers); 363 InstallHandlers(0, maps, handlers);
367 } 364 }
368 365
369 366
370 void KeyedLoadICNexus::ConfigurePolymorphic(Handle<Name> name, 367 void KeyedLoadICNexus::ConfigurePolymorphic(Handle<Name> name,
371 TypeHandleList* types, 368 MapHandleList* maps,
372 CodeHandleList* handlers) { 369 CodeHandleList* handlers) {
373 int receiver_count = types->length(); 370 int receiver_count = maps->length();
374 Handle<FixedArray> array = EnsureArrayOfSize(1 + receiver_count * 2); 371 Handle<FixedArray> array = EnsureArrayOfSize(1 + receiver_count * 2);
375 if (name.is_null()) { 372 if (name.is_null()) {
376 array->set(0, Smi::FromInt(0)); 373 array->set(0, Smi::FromInt(0));
377 } else { 374 } else {
378 array->set(0, *name); 375 array->set(0, *name);
379 } 376 }
380 InstallHandlers(1, types, handlers); 377 InstallHandlers(1, maps, handlers);
381 } 378 }
382 379
383 380
384 int FeedbackNexus::ExtractMaps(int start_index, MapHandleList* maps) const { 381 int FeedbackNexus::ExtractMaps(int start_index, MapHandleList* maps) const {
385 Isolate* isolate = GetIsolate(); 382 Isolate* isolate = GetIsolate();
386 Object* feedback = GetFeedback(); 383 Object* feedback = GetFeedback();
387 if (feedback->IsFixedArray()) { 384 if (feedback->IsFixedArray()) {
388 int found = 0; 385 int found = 0;
389 FixedArray* array = FixedArray::cast(feedback); 386 FixedArray* array = FixedArray::cast(feedback);
390 // The array should be of the form [<optional name>], then 387 // The array should be of the form [<optional name>], then
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (feedback->IsFixedArray()) { 492 if (feedback->IsFixedArray()) {
496 FixedArray* array = FixedArray::cast(feedback); 493 FixedArray* array = FixedArray::cast(feedback);
497 DCHECK(array->length() >= 3); 494 DCHECK(array->length() >= 3);
498 Object* name = array->get(0); 495 Object* name = array->get(0);
499 if (name->IsName()) return Name::cast(name); 496 if (name->IsName()) return Name::cast(name);
500 } 497 }
501 return NULL; 498 return NULL;
502 } 499 }
503 } 500 }
504 } // namespace v8::internal 501 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698