OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 old_state = old_target->ic_state(); | 467 old_state = old_target->ic_state(); |
468 new_state = target->ic_state(); | 468 new_state = target->ic_state(); |
469 target_remains_ic_stub = true; | 469 target_remains_ic_stub = true; |
470 } | 470 } |
471 | 471 |
472 OnTypeFeedbackChanged(isolate, address, old_state, new_state, | 472 OnTypeFeedbackChanged(isolate, address, old_state, new_state, |
473 target_remains_ic_stub); | 473 target_remains_ic_stub); |
474 } | 474 } |
475 | 475 |
476 | 476 |
477 void IC::RegisterWeakMapDependency(Handle<Code> stub) { | |
478 if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_ic && | |
479 stub->CanBeWeakStub()) { | |
480 DCHECK(!stub->is_weak_stub()); | |
481 MapHandleList maps; | |
482 stub->FindAllMaps(&maps); | |
483 if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.at(0))) { | |
484 Map::AddDependentIC(maps.at(0), stub); | |
485 stub->mark_as_weak_stub(); | |
486 if (FLAG_enable_ool_constant_pool) { | |
487 stub->constant_pool()->set_weak_object_state( | |
488 ConstantPoolArray::WEAK_OBJECTS_IN_IC); | |
489 } | |
490 } | |
491 } | |
492 } | |
493 | |
494 | |
495 void IC::InvalidateMaps(Code* stub) { | |
496 DCHECK(stub->is_weak_stub()); | |
497 stub->mark_as_invalidated_weak_stub(); | |
498 Isolate* isolate = stub->GetIsolate(); | |
499 Heap* heap = isolate->heap(); | |
500 Object* undefined = heap->undefined_value(); | |
501 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | |
502 for (RelocIterator it(stub, mode_mask); !it.done(); it.next()) { | |
503 RelocInfo::Mode mode = it.rinfo()->rmode(); | |
504 if (mode == RelocInfo::EMBEDDED_OBJECT && | |
505 it.rinfo()->target_object()->IsMap()) { | |
506 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); | |
507 } | |
508 } | |
509 CpuFeatures::FlushICache(stub->instruction_start(), stub->instruction_size()); | |
510 } | |
511 | |
512 | |
513 void IC::Clear(Isolate* isolate, Address address, | 477 void IC::Clear(Isolate* isolate, Address address, |
514 ConstantPoolArray* constant_pool) { | 478 ConstantPoolArray* constant_pool) { |
515 Code* target = GetTargetAtAddress(address, constant_pool); | 479 Code* target = GetTargetAtAddress(address, constant_pool); |
516 | 480 |
517 // Don't clear debug break inline cache as it will remove the break point. | 481 // Don't clear debug break inline cache as it will remove the break point. |
518 if (target->is_debug_stub()) return; | 482 if (target->is_debug_stub()) return; |
519 | 483 |
520 switch (target->kind()) { | 484 switch (target->kind()) { |
521 case Code::LOAD_IC: | 485 case Code::LOAD_IC: |
522 if (FLAG_vector_ics) return; | 486 if (FLAG_vector_ics) return; |
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 static const Address IC_utilities[] = { | 2972 static const Address IC_utilities[] = { |
3009 #define ADDR(name) FUNCTION_ADDR(name), | 2973 #define ADDR(name) FUNCTION_ADDR(name), |
3010 IC_UTIL_LIST(ADDR) NULL | 2974 IC_UTIL_LIST(ADDR) NULL |
3011 #undef ADDR | 2975 #undef ADDR |
3012 }; | 2976 }; |
3013 | 2977 |
3014 | 2978 |
3015 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2979 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3016 } | 2980 } |
3017 } // namespace v8::internal | 2981 } // namespace v8::internal |
OLD | NEW |