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

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

Issue 8520006: 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
« src/heap.h ('K') | « src/type-info.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 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 switch (state) { 370 switch (state) {
357 case CompareIC::UNINITIALIZED: 371 case CompareIC::UNINITIALIZED:
358 // Uninitialized means never executed. 372 // Uninitialized means never executed.
359 // TODO(fschneider): Introduce a separate value for never-executed ICs. 373 // TODO(fschneider): Introduce a separate value for never-executed ICs.
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::HEAP_NUMBERS: 377 case CompareIC::HEAP_NUMBERS:
364 return TypeInfo::Number(); 378 return TypeInfo::Number();
365 case CompareIC::OBJECTS: 379 case CompareIC::OBJECTS:
380 case CompareIC::KNOWN_OBJECTS:
366 // TODO(kasperl): We really need a type for JS objects here. 381 // TODO(kasperl): We really need a type for JS objects here.
367 return TypeInfo::NonPrimitive(); 382 return TypeInfo::NonPrimitive();
368 case CompareIC::GENERIC: 383 case CompareIC::GENERIC:
369 default: 384 default:
370 return unknown; 385 return unknown;
371 } 386 }
372 } 387 }
373 388
374 389
375 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) { 390 TypeInfo TypeFeedbackOracle::IncrementType(CountOperation* expr) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 USE(maybe_result); 579 USE(maybe_result);
565 #ifdef DEBUG 580 #ifdef DEBUG
566 Object* result = NULL; 581 Object* result = NULL;
567 // Dictionary has been allocated with sufficient size for all elements. 582 // Dictionary has been allocated with sufficient size for all elements.
568 ASSERT(maybe_result->ToObject(&result)); 583 ASSERT(maybe_result->ToObject(&result));
569 ASSERT(*dictionary_ == result); 584 ASSERT(*dictionary_ == result);
570 #endif 585 #endif
571 } 586 }
572 587
573 } } // namespace v8::internal 588 } } // namespace v8::internal
OLDNEW
« src/heap.h ('K') | « src/type-info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698