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

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

Issue 8872060: Reland 10216 - Optimize the equality check case of ICCompare stubs. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // Uninitialized means never executed. 252 // Uninitialized means never executed.
253 return TypeInfo::Uninitialized(); 253 return TypeInfo::Uninitialized();
254 case CompareIC::SMIS: 254 case CompareIC::SMIS:
255 return TypeInfo::Smi(); 255 return TypeInfo::Smi();
256 case CompareIC::HEAP_NUMBERS: 256 case CompareIC::HEAP_NUMBERS:
257 return TypeInfo::Number(); 257 return TypeInfo::Number();
258 case CompareIC::SYMBOLS: 258 case CompareIC::SYMBOLS:
259 case CompareIC::STRINGS: 259 case CompareIC::STRINGS:
260 return TypeInfo::String(); 260 return TypeInfo::String();
261 case CompareIC::OBJECTS: 261 case CompareIC::OBJECTS:
262 case CompareIC::KNOWN_OBJECTS:
262 // TODO(kasperl): We really need a type for JS objects here. 263 // TODO(kasperl): We really need a type for JS objects here.
263 return TypeInfo::NonPrimitive(); 264 return TypeInfo::NonPrimitive();
264 case CompareIC::GENERIC: 265 case CompareIC::GENERIC:
265 default: 266 default:
266 return unknown; 267 return unknown;
267 } 268 }
268 } 269 }
269 270
270 271
271 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) { 272 bool TypeFeedbackOracle::IsSymbolCompare(CompareOperation* expr) {
272 Handle<Object> object = GetInfo(expr->id()); 273 Handle<Object> object = GetInfo(expr->id());
273 if (!object->IsCode()) return false; 274 if (!object->IsCode()) return false;
274 Handle<Code> code = Handle<Code>::cast(object); 275 Handle<Code> code = Handle<Code>::cast(object);
275 if (!code->is_compare_ic_stub()) return false; 276 if (!code->is_compare_ic_stub()) return false;
276 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state()); 277 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
277 return state == CompareIC::SYMBOLS; 278 return state == CompareIC::SYMBOLS;
278 } 279 }
279 280
280 281
282 Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
283 Handle<Object> object = GetInfo(expr->id());
284 if (!object->IsCode()) return Handle<Map>::null();
285 Handle<Code> code = Handle<Code>::cast(object);
286 if (!code->is_compare_ic_stub()) return Handle<Map>::null();
287 CompareIC::State state = static_cast<CompareIC::State>(code->compare_state());
288 if (state != CompareIC::KNOWN_OBJECTS) {
289 return Handle<Map>::null();
290 }
291 return Handle<Map>(code->FindFirstMap());
292 }
293
294
281 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) { 295 TypeInfo TypeFeedbackOracle::UnaryType(UnaryOperation* expr) {
282 Handle<Object> object = GetInfo(expr->id()); 296 Handle<Object> object = GetInfo(expr->id());
283 TypeInfo unknown = TypeInfo::Unknown(); 297 TypeInfo unknown = TypeInfo::Unknown();
284 if (!object->IsCode()) return unknown; 298 if (!object->IsCode()) return unknown;
285 Handle<Code> code = Handle<Code>::cast(object); 299 Handle<Code> code = Handle<Code>::cast(object);
286 ASSERT(code->is_unary_op_stub()); 300 ASSERT(code->is_unary_op_stub());
287 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>( 301 UnaryOpIC::TypeInfo type = static_cast<UnaryOpIC::TypeInfo>(
288 code->unary_op_type()); 302 code->unary_op_type());
289 switch (type) { 303 switch (type) {
290 case UnaryOpIC::SMI: 304 case UnaryOpIC::SMI:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return unknown; 374 return unknown;
361 case CompareIC::SMIS: 375 case CompareIC::SMIS:
362 return TypeInfo::Smi(); 376 return TypeInfo::Smi();
363 case CompareIC::STRINGS: 377 case CompareIC::STRINGS:
364 return TypeInfo::String(); 378 return TypeInfo::String();
365 case CompareIC::SYMBOLS: 379 case CompareIC::SYMBOLS:
366 return TypeInfo::Symbol(); 380 return TypeInfo::Symbol();
367 case CompareIC::HEAP_NUMBERS: 381 case CompareIC::HEAP_NUMBERS:
368 return TypeInfo::Number(); 382 return TypeInfo::Number();
369 case CompareIC::OBJECTS: 383 case CompareIC::OBJECTS:
384 case CompareIC::KNOWN_OBJECTS:
370 // TODO(kasperl): We really need a type for JS objects here. 385 // TODO(kasperl): We really need a type for JS objects here.
371 return TypeInfo::NonPrimitive(); 386 return TypeInfo::NonPrimitive();
372 case CompareIC::GENERIC: 387 case CompareIC::GENERIC:
373 default: 388 default:
374 return unknown; 389 return unknown;
375 } 390 }
376 } 391 }
377 392
378 393
379 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { 394 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 USE(maybe_result); 584 USE(maybe_result);
570 #ifdef DEBUG 585 #ifdef DEBUG
571 Object* result = NULL; 586 Object* result = NULL;
572 // Dictionary has been allocated with sufficient size for all elements. 587 // Dictionary has been allocated with sufficient size for all elements.
573 ASSERT(maybe_result->ToObject(&result)); 588 ASSERT(maybe_result->ToObject(&result));
574 ASSERT(*dictionary_ == result); 589 ASSERT(*dictionary_ == result);
575 #endif 590 #endif
576 } 591 }
577 592
578 } } // namespace v8::internal 593 } } // namespace v8::internal
OLDNEW
« src/ic.cc ('K') | « src/type-info.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698