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

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

Issue 8277034: Revert r9619. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 byte* new_start) { 489 byte* new_start) {
490 for (int i = 0; i < infos->length(); i++) { 490 for (int i = 0; i < infos->length(); i++) {
491 RelocInfo* info = &(*infos)[i]; 491 RelocInfo* info = &(*infos)[i];
492 info->set_pc(new_start + (info->pc() - old_start)); 492 info->set_pc(new_start + (info->pc() - old_start));
493 } 493 }
494 } 494 }
495 495
496 496
497 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { 497 void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
498 for (int i = 0; i < infos->length(); i++) { 498 for (int i = 0; i < infos->length(); i++) {
499 RelocInfo reloc_entry = (*infos)[i]; 499 Address target_address = (*infos)[i].target_address();
500 Address target_address = reloc_entry.target_address();
501 unsigned ast_id = static_cast<unsigned>((*infos)[i].data()); 500 unsigned ast_id = static_cast<unsigned>((*infos)[i].data());
502 Code* target = Code::GetCodeFromTargetAddress(target_address); 501 ProcessTargetAt(target_address, ast_id);
503 switch (target->kind()) {
504 case Code::LOAD_IC:
505 case Code::STORE_IC:
506 case Code::CALL_IC:
507 case Code::KEYED_CALL_IC:
508 if (target->ic_state() == MONOMORPHIC) {
509 if (target->kind() == Code::CALL_IC &&
510 target->check_type() != RECEIVER_MAP_CHECK) {
511 SetInfo(ast_id, Smi::FromInt(target->check_type()));
512 } else {
513 Object* map = target->FindFirstMap();
514 SetInfo(ast_id, map == NULL ? static_cast<Object*>(target) : map);
515 }
516 } else if (target->ic_state() == MEGAMORPHIC) {
517 SetInfo(ast_id, target);
518 }
519 break;
520
521 case Code::KEYED_LOAD_IC:
522 case Code::KEYED_STORE_IC:
523 if (target->ic_state() == MONOMORPHIC ||
524 target->ic_state() == MEGAMORPHIC) {
525 SetInfo(ast_id, target);
526 }
527 break;
528
529 case Code::UNARY_OP_IC:
530 case Code::BINARY_OP_IC:
531 case Code::COMPARE_IC:
532 case Code::TO_BOOLEAN_IC:
533 SetInfo(ast_id, target);
534 break;
535
536 case Code::STUB:
537 if (target->major_key() == CodeStub::CallFunction &&
538 target->has_function_cache()) {
539 Object* value = CallFunctionStub::GetCachedValue(reloc_entry.pc());
540 if (value->IsJSFunction()) {
541 SetInfo(ast_id, value);
542 }
543 }
544 break;
545
546 default:
547 break;
548 }
549 } 502 }
550 } 503 }
551 504
505
506 void TypeFeedbackOracle::ProcessTargetAt(Address target_address,
507 unsigned ast_id) {
508 Code* target = Code::GetCodeFromTargetAddress(target_address);
509 switch (target->kind()) {
510 case Code::LOAD_IC:
511 case Code::STORE_IC:
512 case Code::CALL_IC:
513 case Code::KEYED_CALL_IC:
514 if (target->ic_state() == MONOMORPHIC) {
515 if (target->kind() == Code::CALL_IC &&
516 target->check_type() != RECEIVER_MAP_CHECK) {
517 SetInfo(ast_id, Smi::FromInt(target->check_type()));
518 } else {
519 Object* map = target->FindFirstMap();
520 SetInfo(ast_id, map == NULL ? static_cast<Object*>(target) : map);
521 }
522 } else if (target->ic_state() == MEGAMORPHIC) {
523 SetInfo(ast_id, target);
524 }
525 break;
526
527 case Code::KEYED_LOAD_IC:
528 case Code::KEYED_STORE_IC:
529 if (target->ic_state() == MONOMORPHIC ||
530 target->ic_state() == MEGAMORPHIC) {
531 SetInfo(ast_id, target);
532 }
533 break;
534
535 case Code::UNARY_OP_IC:
536 case Code::BINARY_OP_IC:
537 case Code::COMPARE_IC:
538 case Code::TO_BOOLEAN_IC:
539 SetInfo(ast_id, target);
540 break;
541
542 case Code::STUB:
543 if (target->major_key() == CodeStub::CallFunction &&
544 target->has_function_cache()) {
545 Object* value = CallFunctionStub::GetCachedValue(target_address);
546 if (value->IsJSFunction()) {
547 SetInfo(ast_id, value);
548 }
549 }
550 break;
551
552 default:
553 break;
554 }
555 }
556
552 557
553 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { 558 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) {
554 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); 559 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound);
555 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); 560 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target);
556 USE(maybe_result); 561 USE(maybe_result);
557 #ifdef DEBUG 562 #ifdef DEBUG
558 Object* result = NULL; 563 Object* result = NULL;
559 // Dictionary has been allocated with sufficient size for all elements. 564 // Dictionary has been allocated with sufficient size for all elements.
560 ASSERT(maybe_result->ToObject(&result)); 565 ASSERT(maybe_result->ToObject(&result));
561 ASSERT(*dictionary_ == result); 566 ASSERT(*dictionary_ == result);
562 #endif 567 #endif
563 } 568 }
564 569
565 } } // namespace v8::internal 570 } } // 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