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

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

Issue 6894003: Better support for 'polymorphic' JS and external arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: new strategy Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ? Handle<Object>(dictionary_->ValueAt(entry)) 75 ? Handle<Object>(dictionary_->ValueAt(entry))
76 : Isolate::Current()->factory()->undefined_value(); 76 : Isolate::Current()->factory()->undefined_value();
77 } 77 }
78 78
79 79
80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) { 80 bool TypeFeedbackOracle::LoadIsMonomorphic(Property* expr) {
81 Handle<Object> map_or_code(GetInfo(expr->position())); 81 Handle<Object> map_or_code(GetInfo(expr->position()));
82 if (map_or_code->IsMap()) return true; 82 if (map_or_code->IsMap()) return true;
83 if (map_or_code->IsCode()) { 83 if (map_or_code->IsCode()) {
84 Handle<Code> code(Code::cast(*map_or_code)); 84 Handle<Code> code(Code::cast(*map_or_code));
85 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC && 85 return code->is_keyed_load_stub() &&
86 code->FindFirstMap() != NULL; 86 code->ic_state() == MONOMORPHIC;
87 } 87 }
88 return false; 88 return false;
89 } 89 }
90 90
91 91
92 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) { 92 bool TypeFeedbackOracle::StoreIsMonomorphic(Expression* expr) {
93 Handle<Object> map_or_code(GetInfo(expr->position())); 93 Handle<Object> map_or_code(GetInfo(expr->position()));
94 if (map_or_code->IsMap()) return true; 94 if (map_or_code->IsMap()) return true;
95 if (map_or_code->IsCode()) { 95 if (map_or_code->IsCode()) {
96 Handle<Code> code(Code::cast(*map_or_code)); 96 Handle<Code> code(Code::cast(*map_or_code));
97 return code->kind() == Code::KEYED_EXTERNAL_ARRAY_STORE_IC && 97 return code->is_keyed_store_stub() &&
98 code->FindFirstMap() != NULL; 98 code->ic_state() == MONOMORPHIC;
99 } 99 }
100 return false; 100 return false;
101 } 101 }
102 102
103 103
104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 104 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
105 Handle<Object> value = GetInfo(expr->position()); 105 Handle<Object> value = GetInfo(expr->position());
106 return value->IsMap() || value->IsSmi(); 106 return value->IsMap() || value->IsSmi();
107 } 107 }
108 108
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC || 381 if (kind == Code::TYPE_RECORDING_BINARY_OP_IC ||
382 kind == Code::COMPARE_IC) { 382 kind == Code::COMPARE_IC) {
383 // TODO(kasperl): Avoid having multiple ICs with the same 383 // TODO(kasperl): Avoid having multiple ICs with the same
384 // position by making sure that we have position information 384 // position by making sure that we have position information
385 // recorded for all binary ICs. 385 // recorded for all binary ICs.
386 int entry = dictionary_->FindEntry(position); 386 int entry = dictionary_->FindEntry(position);
387 if (entry == NumberDictionary::kNotFound) { 387 if (entry == NumberDictionary::kNotFound) {
388 SetInfo(position, target); 388 SetInfo(position, target);
389 } 389 }
390 } else if (state == MONOMORPHIC) { 390 } else if (state == MONOMORPHIC) {
391 if (kind == Code::KEYED_EXTERNAL_ARRAY_LOAD_IC || 391 if (kind == Code::KEYED_LOAD_IC ||
392 kind == Code::KEYED_EXTERNAL_ARRAY_STORE_IC) { 392 kind == Code::KEYED_STORE_IC) {
393 SetInfo(position, target); 393 SetInfo(position, target);
394 } else if (target->kind() != Code::CALL_IC || 394 } else if (target->kind() != Code::CALL_IC ||
395 target->check_type() == RECEIVER_MAP_CHECK) { 395 target->check_type() == RECEIVER_MAP_CHECK) {
396 Map* map = target->FindFirstMap(); 396 Map* map = target->FindFirstMap();
397 if (map == NULL) { 397 if (map == NULL) {
398 SetInfo(position, target); 398 SetInfo(position, target);
399 } else { 399 } else {
400 SetInfo(position, map); 400 SetInfo(position, map);
401 } 401 }
402 } else { 402 } else {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 source_positions->Add(position); 447 source_positions->Add(position);
448 } 448 }
449 } else { 449 } else {
450 ASSERT(RelocInfo::IsPosition(mode)); 450 ASSERT(RelocInfo::IsPosition(mode));
451 position = static_cast<int>(info->data()); 451 position = static_cast<int>(info->data());
452 } 452 }
453 } 453 }
454 } 454 }
455 455
456 } } // namespace v8::internal 456 } } // namespace v8::internal
OLDNEW
« src/ic.cc ('K') | « src/stub-cache.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698