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

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

Issue 148223002: Remove CallICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update test262 status file Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/type-info.h ('k') | src/typing.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { 75 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) {
76 Handle<Object> maybe_code = GetInfo(id); 76 Handle<Object> maybe_code = GetInfo(id);
77 if (maybe_code->IsCode()) { 77 if (maybe_code->IsCode()) {
78 Handle<Code> code = Handle<Code>::cast(maybe_code); 78 Handle<Code> code = Handle<Code>::cast(maybe_code);
79 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; 79 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
80 } 80 }
81 return false; 81 return false;
82 } 82 }
83 83
84 84
85 bool TypeFeedbackOracle::LoadIsPreMonomorphic(TypeFeedbackId id) {
86 Handle<Object> maybe_code = GetInfo(id);
87 if (maybe_code->IsCode()) {
88 Handle<Code> code = Handle<Code>::cast(maybe_code);
89 return code->is_inline_cache_stub() && code->ic_state() == PREMONOMORPHIC;
90 }
91 return false;
92 }
93
94
95 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { 85 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) {
96 Handle<Object> maybe_code = GetInfo(ast_id); 86 Handle<Object> maybe_code = GetInfo(ast_id);
97 if (!maybe_code->IsCode()) return false; 87 if (!maybe_code->IsCode()) return false;
98 Handle<Code> code = Handle<Code>::cast(maybe_code); 88 Handle<Code> code = Handle<Code>::cast(maybe_code);
99 return code->ic_state() == UNINITIALIZED; 89 return code->ic_state() == UNINITIALIZED;
100 } 90 }
101 91
102 92
103 bool TypeFeedbackOracle::StoreIsPreMonomorphic(TypeFeedbackId ast_id) {
104 Handle<Object> maybe_code = GetInfo(ast_id);
105 if (maybe_code->IsCode()) {
106 Handle<Code> code = Handle<Code>::cast(maybe_code);
107 return code->ic_state() == PREMONOMORPHIC;
108 }
109 return false;
110 }
111
112
113 bool TypeFeedbackOracle::StoreIsKeyedPolymorphic(TypeFeedbackId ast_id) { 93 bool TypeFeedbackOracle::StoreIsKeyedPolymorphic(TypeFeedbackId ast_id) {
114 Handle<Object> maybe_code = GetInfo(ast_id); 94 Handle<Object> maybe_code = GetInfo(ast_id);
115 if (maybe_code->IsCode()) { 95 if (maybe_code->IsCode()) {
116 Handle<Code> code = Handle<Code>::cast(maybe_code); 96 Handle<Code> code = Handle<Code>::cast(maybe_code);
117 return code->is_keyed_store_stub() && 97 return code->is_keyed_store_stub() &&
118 code->ic_state() == POLYMORPHIC; 98 code->ic_state() == POLYMORPHIC;
119 } 99 }
120 return false; 100 return false;
121 } 101 }
122 102
123 103
124 bool TypeFeedbackOracle::CallIsMonomorphic(TypeFeedbackId id) { 104 bool TypeFeedbackOracle::CallIsMonomorphic(TypeFeedbackId id) {
125 Handle<Object> value = GetInfo(id); 105 Handle<Object> value = GetInfo(id);
126 return value->IsAllocationSite() || value->IsJSFunction() || value->IsSmi() || 106 return value->IsAllocationSite() || value->IsJSFunction();
127 (value->IsCode() && Handle<Code>::cast(value)->ic_state() == MONOMORPHIC);
128 } 107 }
129 108
130 109
131 bool TypeFeedbackOracle::KeyedArrayCallIsHoley(TypeFeedbackId id) {
132 Handle<Object> value = GetInfo(id);
133 Handle<Code> code = Handle<Code>::cast(value);
134 return KeyedArrayCallStub::IsHoley(code);
135 }
136
137
138 bool TypeFeedbackOracle::CallNewIsMonomorphic(TypeFeedbackId id) { 110 bool TypeFeedbackOracle::CallNewIsMonomorphic(TypeFeedbackId id) {
139 Handle<Object> info = GetInfo(id); 111 Handle<Object> info = GetInfo(id);
140 return info->IsAllocationSite() || info->IsJSFunction(); 112 return info->IsAllocationSite() || info->IsJSFunction();
141 } 113 }
142 114
143 115
144 byte TypeFeedbackOracle::ForInType(TypeFeedbackId id) { 116 byte TypeFeedbackOracle::ForInType(TypeFeedbackId id) {
145 Handle<Object> value = GetInfo(id); 117 Handle<Object> value = GetInfo(id);
146 return value->IsSmi() && 118 return value->IsSmi() &&
147 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker 119 Smi::cast(*value)->value() == TypeFeedbackCells::kForInFastCaseMarker
148 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN; 120 ? ForInStatement::FAST_FOR_IN : ForInStatement::SLOW_FOR_IN;
149 } 121 }
150 122
151 123
152 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( 124 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode(
153 TypeFeedbackId ast_id) { 125 TypeFeedbackId ast_id) {
154 Handle<Object> maybe_code = GetInfo(ast_id); 126 Handle<Object> maybe_code = GetInfo(ast_id);
155 if (maybe_code->IsCode()) { 127 if (maybe_code->IsCode()) {
156 Handle<Code> code = Handle<Code>::cast(maybe_code); 128 Handle<Code> code = Handle<Code>::cast(maybe_code);
157 if (code->kind() == Code::KEYED_STORE_IC) { 129 if (code->kind() == Code::KEYED_STORE_IC) {
158 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); 130 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state());
159 } 131 }
160 } 132 }
161 return STANDARD_STORE; 133 return STANDARD_STORE;
162 } 134 }
163 135
164 136
165 void TypeFeedbackOracle::CallReceiverTypes(TypeFeedbackId id,
166 Handle<String> name,
167 int arity,
168 SmallMapList* types) {
169 Code::Flags flags = Code::ComputeMonomorphicFlags(
170 Code::CALL_IC, kNoExtraICState, OWN_MAP, Code::NORMAL, arity);
171 CollectReceiverTypes(id, name, flags, types);
172 }
173
174
175 CheckType TypeFeedbackOracle::GetCallCheckType(TypeFeedbackId id) {
176 Handle<Object> value = GetInfo(id);
177 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
178 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
179 ASSERT(check != RECEIVER_MAP_CHECK);
180 return check;
181 }
182
183
184 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(TypeFeedbackId id) { 137 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(TypeFeedbackId id) {
185 Handle<Object> info = GetInfo(id); 138 Handle<Object> info = GetInfo(id);
186 if (info->IsAllocationSite()) { 139 if (info->IsAllocationSite()) {
187 return Handle<JSFunction>(isolate()->global_context()->array_function()); 140 return Handle<JSFunction>(isolate()->global_context()->array_function());
188 } else { 141 } else {
189 return Handle<JSFunction>::cast(info); 142 return Handle<JSFunction>::cast(info);
190 } 143 }
191 } 144 }
192 145
193 146
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 450
498 451
499 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { 452 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
500 for (int i = 0; i < infos->length(); i++) { 453 for (int i = 0; i < infos->length(); i++) {
501 RelocInfo reloc_entry = (*infos)[i]; 454 RelocInfo reloc_entry = (*infos)[i];
502 Address target_address = reloc_entry.target_address(); 455 Address target_address = reloc_entry.target_address();
503 TypeFeedbackId ast_id = 456 TypeFeedbackId ast_id =
504 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); 457 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data()));
505 Code* target = Code::GetCodeFromTargetAddress(target_address); 458 Code* target = Code::GetCodeFromTargetAddress(target_address);
506 switch (target->kind()) { 459 switch (target->kind()) {
507 case Code::CALL_IC:
508 if (target->ic_state() == MONOMORPHIC &&
509 target->check_type() != RECEIVER_MAP_CHECK) {
510 SetInfo(ast_id, Smi::FromInt(target->check_type()));
511 break;
512 }
513 case Code::LOAD_IC: 460 case Code::LOAD_IC:
514 case Code::STORE_IC: 461 case Code::STORE_IC:
515 case Code::KEYED_CALL_IC:
516 case Code::KEYED_LOAD_IC: 462 case Code::KEYED_LOAD_IC:
517 case Code::KEYED_STORE_IC: 463 case Code::KEYED_STORE_IC:
518 case Code::BINARY_OP_IC: 464 case Code::BINARY_OP_IC:
519 case Code::COMPARE_IC: 465 case Code::COMPARE_IC:
520 case Code::TO_BOOLEAN_IC: 466 case Code::TO_BOOLEAN_IC:
521 case Code::COMPARE_NIL_IC: 467 case Code::COMPARE_NIL_IC:
522 SetInfo(ast_id, target); 468 SetInfo(ast_id, target);
523 break; 469 break;
524 470
525 default: 471 default:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 #ifdef DEBUG 503 #ifdef DEBUG
558 Object* result = NULL; 504 Object* result = NULL;
559 // Dictionary has been allocated with sufficient size for all elements. 505 // Dictionary has been allocated with sufficient size for all elements.
560 ASSERT(maybe_result->ToObject(&result)); 506 ASSERT(maybe_result->ToObject(&result));
561 ASSERT(*dictionary_ == result); 507 ASSERT(*dictionary_ == result);
562 #endif 508 #endif
563 } 509 }
564 510
565 511
566 } } // namespace v8::internal 512 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698