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->CanBeWeakStub()) { |
| 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 if (FLAG_enable_ool_constant_pool) { |
| 448 stub->constant_pool()->set_weak_object_state( |
| 449 ConstantPoolArray::WEAK_OBJECTS_IN_IC); |
| 450 } |
| 451 } |
| 452 } |
| 453 } |
| 454 |
| 455 |
| 456 void IC::InvalidateMaps(Code* stub) { |
| 457 ASSERT(stub->is_weak_stub()); |
| 458 stub->mark_as_invalidated_weak_stub(); |
| 459 Isolate* isolate = stub->GetIsolate(); |
| 460 Heap* heap = isolate->heap(); |
| 461 Object* undefined = heap->undefined_value(); |
| 462 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 463 for (RelocIterator it(stub, mode_mask); !it.done(); it.next()) { |
| 464 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 465 if (mode == RelocInfo::EMBEDDED_OBJECT && |
| 466 it.rinfo()->target_object()->IsMap()) { |
| 467 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); |
| 468 } |
| 469 } |
| 470 CPU::FlushICache(stub->instruction_start(), stub->instruction_size()); |
| 471 } |
| 472 |
| 473 |
438 void IC::Clear(Isolate* isolate, Address address, | 474 void IC::Clear(Isolate* isolate, Address address, |
439 ConstantPoolArray* constant_pool) { | 475 ConstantPoolArray* constant_pool) { |
440 Code* target = GetTargetAtAddress(address, constant_pool); | 476 Code* target = GetTargetAtAddress(address, constant_pool); |
441 | 477 |
442 // Don't clear debug break inline cache as it will remove the break point. | 478 // Don't clear debug break inline cache as it will remove the break point. |
443 if (target->is_debug_stub()) return; | 479 if (target->is_debug_stub()) return; |
444 | 480 |
445 switch (target->kind()) { | 481 switch (target->kind()) { |
446 case Code::LOAD_IC: | 482 case Code::LOAD_IC: |
447 return LoadIC::Clear(isolate, address, target, constant_pool); | 483 return LoadIC::Clear(isolate, address, target, constant_pool); |
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 #undef ADDR | 2879 #undef ADDR |
2844 }; | 2880 }; |
2845 | 2881 |
2846 | 2882 |
2847 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2883 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2848 return IC_utilities[id]; | 2884 return IC_utilities[id]; |
2849 } | 2885 } |
2850 | 2886 |
2851 | 2887 |
2852 } } // namespace v8::internal | 2888 } } // namespace v8::internal |
OLD | NEW |