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

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

Issue 7491043: Record ToBoolean's type information in Hydrogen's HBranch instruction, so we can use it in LCodeG... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 4 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') | 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 RelocInfo* info = it.rinfo(); 432 RelocInfo* info = it.rinfo();
433 Object* object = info->target_object(); 433 Object* object = info->target_object();
434 if (object->IsMap()) { 434 if (object->IsMap()) {
435 types->Add(Handle<Map>(Map::cast(object))); 435 types->Add(Handle<Map>(Map::cast(object)));
436 } 436 }
437 } 437 }
438 } 438 }
439 } 439 }
440 440
441 441
442 byte TypeFeedbackOracle::ToBooleanTypes(unsigned ast_id) {
443 Handle<Object> object = GetInfo(ast_id);
444 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0;
445 }
446
447
442 // Things are a bit tricky here: The iterator for the RelocInfos and the infos 448 // Things are a bit tricky here: The iterator for the RelocInfos and the infos
443 // themselves are not GC-safe, so we first get all infos, then we create the 449 // themselves are not GC-safe, so we first get all infos, then we create the
444 // dictionary (possibly triggering GC), and finally we relocate the collected 450 // dictionary (possibly triggering GC), and finally we relocate the collected
445 // infos before we process them. 451 // infos before we process them.
446 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { 452 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) {
447 AssertNoAllocation no_allocation; 453 AssertNoAllocation no_allocation;
448 ZoneList<RelocInfo> infos(16); 454 ZoneList<RelocInfo> infos(16);
449 HandleScope scope; 455 HandleScope scope;
450 GetRelocInfos(code, &infos); 456 GetRelocInfos(code, &infos);
451 CreateDictionary(code, &infos); 457 CreateDictionary(code, &infos);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 case Code::KEYED_STORE_IC: 522 case Code::KEYED_STORE_IC:
517 if (target->ic_state() == MONOMORPHIC || 523 if (target->ic_state() == MONOMORPHIC ||
518 target->ic_state() == MEGAMORPHIC) { 524 target->ic_state() == MEGAMORPHIC) {
519 SetInfo(ast_id, target); 525 SetInfo(ast_id, target);
520 } 526 }
521 break; 527 break;
522 528
523 case Code::UNARY_OP_IC: 529 case Code::UNARY_OP_IC:
524 case Code::BINARY_OP_IC: 530 case Code::BINARY_OP_IC:
525 case Code::COMPARE_IC: 531 case Code::COMPARE_IC:
532 case Code::TO_BOOLEAN_IC:
526 SetInfo(ast_id, target); 533 SetInfo(ast_id, target);
527 break; 534 break;
528 535
529 default: 536 default:
530 break; 537 break;
531 } 538 }
532 } 539 }
533 540
534 541
535 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { 542 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) {
536 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); 543 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound);
537 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); 544 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target);
538 USE(maybe_result); 545 USE(maybe_result);
539 #ifdef DEBUG 546 #ifdef DEBUG
540 Object* result = NULL; 547 Object* result = NULL;
541 // Dictionary has been allocated with sufficient size for all elements. 548 // Dictionary has been allocated with sufficient size for all elements.
542 ASSERT(maybe_result->ToObject(&result)); 549 ASSERT(maybe_result->ToObject(&result));
543 ASSERT(*dictionary_ == result); 550 ASSERT(*dictionary_ == result);
544 #endif 551 #endif
545 } 552 }
546 553
547 } } // namespace v8::internal 554 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698