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

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

Issue 5763004: Second attempt: Improve our type feedback by recogizining never-executed IC c... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr, Side side) { 135 TypeInfo TypeFeedbackOracle::CompareType(CompareOperation* expr, Side side) {
136 Handle<Object> object = GetElement(map_, expr->position()); 136 Handle<Object> object = GetElement(map_, expr->position());
137 TypeInfo unknown = TypeInfo::Unknown(); 137 TypeInfo unknown = TypeInfo::Unknown();
138 if (!object->IsCode()) return unknown; 138 if (!object->IsCode()) return unknown;
139 Handle<Code> code = Handle<Code>::cast(object); 139 Handle<Code> code = Handle<Code>::cast(object);
140 if (!code->is_compare_ic_stub()) return unknown; 140 if (!code->is_compare_ic_stub()) return unknown;
141 141
142 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); 142 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
143 switch (state) { 143 switch (state) {
144 case CompareIC::UNINITIALIZED: 144 case CompareIC::UNINITIALIZED:
145 // Uninitialized means never executed.
146 // TODO(fschneider): Introduce a separate value for never-executed ICs.
147 return unknown;
145 case CompareIC::SMIS: 148 case CompareIC::SMIS:
146 return TypeInfo::Smi(); 149 return TypeInfo::Smi();
147 case CompareIC::HEAP_NUMBERS: 150 case CompareIC::HEAP_NUMBERS:
148 return TypeInfo::Number(); 151 return TypeInfo::Number();
149 case CompareIC::OBJECTS: 152 case CompareIC::OBJECTS:
150 // TODO(kasperl): We really need a type for JS objects here. 153 // TODO(kasperl): We really need a type for JS objects here.
151 return TypeInfo::NonPrimitive(); 154 return TypeInfo::NonPrimitive();
152 case CompareIC::GENERIC: 155 case CompareIC::GENERIC:
153 default: 156 default:
154 return unknown; 157 return unknown;
(...skipping 22 matching lines...) Expand all
177 return unknown; 180 return unknown;
178 } 181 }
179 } else if (code->is_type_recording_binary_op_stub()) { 182 } else if (code->is_type_recording_binary_op_stub()) {
180 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>( 183 TRBinaryOpIC::TypeInfo type = static_cast<TRBinaryOpIC::TypeInfo>(
181 code->type_recording_binary_op_type()); 184 code->type_recording_binary_op_type());
182 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>( 185 TRBinaryOpIC::TypeInfo result_type = static_cast<TRBinaryOpIC::TypeInfo>(
183 code->type_recording_binary_op_result_type()); 186 code->type_recording_binary_op_result_type());
184 187
185 switch (type) { 188 switch (type) {
186 case TRBinaryOpIC::UNINITIALIZED: 189 case TRBinaryOpIC::UNINITIALIZED:
190 // Uninitialized means never executed.
191 // TODO(fschneider): Introduce a separate value for never-executed ICs
192 return unknown;
187 case TRBinaryOpIC::SMI: 193 case TRBinaryOpIC::SMI:
188 switch (result_type) { 194 switch (result_type) {
189 case TRBinaryOpIC::UNINITIALIZED: 195 case TRBinaryOpIC::UNINITIALIZED:
190 case TRBinaryOpIC::SMI: 196 case TRBinaryOpIC::SMI:
191 return TypeInfo::Smi(); 197 return TypeInfo::Smi();
192 case TRBinaryOpIC::INT32: 198 case TRBinaryOpIC::INT32:
193 return TypeInfo::Integer32(); 199 return TypeInfo::Integer32();
194 case TRBinaryOpIC::HEAP_NUMBER: 200 case TRBinaryOpIC::HEAP_NUMBER:
195 return TypeInfo::Double(); 201 return TypeInfo::Double();
196 default: 202 default:
(...skipping 20 matching lines...) Expand all
217 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { 223 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) {
218 Handle<Object> object = GetElement(map_, clause->position()); 224 Handle<Object> object = GetElement(map_, clause->position());
219 TypeInfo unknown = TypeInfo::Unknown(); 225 TypeInfo unknown = TypeInfo::Unknown();
220 if (!object->IsCode()) return unknown; 226 if (!object->IsCode()) return unknown;
221 Handle<Code> code = Handle<Code>::cast(object); 227 Handle<Code> code = Handle<Code>::cast(object);
222 if (!code->is_compare_ic_stub()) return unknown; 228 if (!code->is_compare_ic_stub()) return unknown;
223 229
224 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); 230 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
225 switch (state) { 231 switch (state) {
226 case CompareIC::UNINITIALIZED: 232 case CompareIC::UNINITIALIZED:
233 // Uninitialized means never executed.
234 // TODO(fschneider): Introduce a separate value for never-executed ICs.
235 return unknown;
227 case CompareIC::SMIS: 236 case CompareIC::SMIS:
228 return TypeInfo::Smi(); 237 return TypeInfo::Smi();
229 case CompareIC::HEAP_NUMBERS: 238 case CompareIC::HEAP_NUMBERS:
230 return TypeInfo::Number(); 239 return TypeInfo::Number();
231 case CompareIC::OBJECTS: 240 case CompareIC::OBJECTS:
232 // TODO(kasperl): We really need a type for JS objects here. 241 // TODO(kasperl): We really need a type for JS objects here.
233 return TypeInfo::NonPrimitive(); 242 return TypeInfo::NonPrimitive();
234 case CompareIC::GENERIC: 243 case CompareIC::GENERIC:
235 default: 244 default:
236 return unknown; 245 return unknown;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 source_positions->Add(position); 351 source_positions->Add(position);
343 } 352 }
344 } else { 353 } else {
345 ASSERT(RelocInfo::IsPosition(mode)); 354 ASSERT(RelocInfo::IsPosition(mode));
346 position = static_cast<int>(info->data()); 355 position = static_cast<int>(info->data());
347 } 356 }
348 } 357 }
349 } 358 }
350 359
351 } } // namespace v8::internal 360 } } // namespace v8::internal
OLDNEW
« src/ia32/ic-ia32.cc ('K') | « src/ic.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698