OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 info->change_own_type_change_checksum(); | 428 info->change_own_type_change_checksum(); |
429 } | 429 } |
430 host->set_profiler_ticks(0); | 430 host->set_profiler_ticks(0); |
431 isolate->runtime_profiler()->NotifyICChanged(); | 431 isolate->runtime_profiler()->NotifyICChanged(); |
432 // TODO(2029): When an optimized function is patched, it would | 432 // TODO(2029): When an optimized function is patched, it would |
433 // be nice to propagate the corresponding type information to its | 433 // be nice to propagate the corresponding type information to its |
434 // unoptimized version for the benefit of later inlining. | 434 // unoptimized version for the benefit of later inlining. |
435 } | 435 } |
436 | 436 |
437 | 437 |
| 438 void IC::RegisterWeakMapDependency(Handle<Code> stub) { |
| 439 if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_ic && |
| 440 stub->can_be_weak_stub()) { |
| 441 ASSERT(!stub->is_weak_stub()); |
| 442 MapHandleList maps; |
| 443 stub->FindAllMaps(&maps); |
| 444 if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.at(0))) { |
| 445 maps.at(0)->AddDependentIC(stub); |
| 446 stub->mark_as_weak_stub(); |
| 447 } |
| 448 } |
| 449 } |
| 450 |
| 451 |
| 452 void IC::InvalidateMaps(Code* stub) { |
| 453 ASSERT(stub->is_weak_stub()); |
| 454 stub->mark_as_invalidated_weak_stub(); |
| 455 Isolate* isolate = stub->GetIsolate(); |
| 456 Heap* heap = isolate->heap(); |
| 457 Object* undefined = heap->undefined_value(); |
| 458 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 459 for (RelocIterator it(stub, mode_mask); !it.done(); it.next()) { |
| 460 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 461 if (mode == RelocInfo::EMBEDDED_OBJECT && |
| 462 it.rinfo()->target_object()->IsMap()) { |
| 463 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); |
| 464 } |
| 465 } |
| 466 CPU::FlushICache(stub->instruction_start(), stub->instruction_size()); |
| 467 } |
| 468 |
| 469 |
438 void IC::Clear(Isolate* isolate, Address address, | 470 void IC::Clear(Isolate* isolate, Address address, |
439 ConstantPoolArray* constant_pool) { | 471 ConstantPoolArray* constant_pool) { |
440 Code* target = GetTargetAtAddress(address, constant_pool); | 472 Code* target = GetTargetAtAddress(address, constant_pool); |
441 | 473 |
442 // Don't clear debug break inline cache as it will remove the break point. | 474 // Don't clear debug break inline cache as it will remove the break point. |
443 if (target->is_debug_stub()) return; | 475 if (target->is_debug_stub()) return; |
444 | 476 |
445 switch (target->kind()) { | 477 switch (target->kind()) { |
446 case Code::LOAD_IC: | 478 case Code::LOAD_IC: |
447 return LoadIC::Clear(isolate, address, target, constant_pool); | 479 return LoadIC::Clear(isolate, address, target, constant_pool); |
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2833 #undef ADDR | 2865 #undef ADDR |
2834 }; | 2866 }; |
2835 | 2867 |
2836 | 2868 |
2837 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2869 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2838 return IC_utilities[id]; | 2870 return IC_utilities[id]; |
2839 } | 2871 } |
2840 | 2872 |
2841 | 2873 |
2842 } } // namespace v8::internal | 2874 } } // namespace v8::internal |
OLD | NEW |