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 3 // found in the LICENSE file. 4 5 #ifndef V8_IC_IC_INL_H_ 6 #define V8_IC_IC_INL_H_ 7 8 #include "src/ic/ic.h" 9 10 #include "src/assembler-inl.h" 11 #include "src/debug/debug.h" 12 #include "src/macro-assembler.h" 13 #include "src/prototype.h" 14 15 namespace v8 { 16 namespace internal { 17 18 address()19Address IC::address() const { 20 // Get the address of the call. 21 return Assembler::target_address_from_return_address(pc()); 22 } 23 24 constant_pool()25Address IC::constant_pool() const { 26 if (FLAG_enable_embedded_constant_pool) { 27 return raw_constant_pool(); 28 } else { 29 return kNullAddress; 30 } 31 } 32 33 raw_constant_pool()34Address IC::raw_constant_pool() const { 35 if (FLAG_enable_embedded_constant_pool) { 36 return *constant_pool_address_; 37 } else { 38 return kNullAddress; 39 } 40 } 41 update_receiver_map(Handle<Object> receiver)42void IC::update_receiver_map(Handle<Object> receiver) { 43 if (receiver->IsSmi()) { 44 receiver_map_ = isolate_->factory()->heap_number_map(); 45 } else { 46 receiver_map_ = handle(HeapObject::cast(*receiver)->map(), isolate_); 47 } 48 } 49 IsHandler(MaybeObject * object)50bool IC::IsHandler(MaybeObject* object) { 51 HeapObject* heap_object; 52 return (object->IsSmi() && (object != nullptr)) || 53 (object->ToWeakHeapObject(&heap_object) && 54 (heap_object->IsMap() || heap_object->IsPropertyCell())) || 55 (object->ToStrongHeapObject(&heap_object) && 56 (heap_object->IsDataHandler() || 57 heap_object->IsCode())); 58 } 59 AddressIsDeoptimizedCode()60bool IC::AddressIsDeoptimizedCode() const { 61 return AddressIsDeoptimizedCode(isolate(), address()); 62 } 63 64 AddressIsDeoptimizedCode(Isolate * isolate,Address address)65bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) { 66 Code* host = 67 isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code; 68 return (host->kind() == Code::OPTIMIZED_FUNCTION && 69 host->marked_for_deoptimization()); 70 } 71 } // namespace internal 72 } // namespace v8 73 74 #endif // V8_IC_IC_INL_H_ 75