Line data Source code
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/frames-inl.h"
13 : #include "src/handles-inl.h"
14 : #include "src/prototype.h"
15 :
16 : namespace v8 {
17 : namespace internal {
18 :
19 :
20 0 : Address IC::address() const {
21 : // Get the address of the call.
22 : return Assembler::target_address_from_return_address(pc());
23 : }
24 :
25 :
26 : Address IC::constant_pool() const {
27 : if (FLAG_enable_embedded_constant_pool) {
28 : return raw_constant_pool();
29 : } else {
30 : return kNullAddress;
31 : }
32 : }
33 :
34 :
35 : Address IC::raw_constant_pool() const {
36 : if (FLAG_enable_embedded_constant_pool) {
37 : return *constant_pool_address_;
38 : } else {
39 : return kNullAddress;
40 : }
41 : }
42 :
43 9720759 : void IC::update_receiver_map(Handle<Object> receiver) {
44 19441539 : if (receiver->IsSmi()) {
45 28284 : receiver_map_ = isolate_->factory()->heap_number_map();
46 : } else {
47 19413289 : receiver_map_ = handle(HeapObject::cast(*receiver)->map(), isolate_);
48 : }
49 9720802 : }
50 :
51 : bool IC::IsHandler(MaybeObject object) {
52 : HeapObject heap_object;
53 : return (object->IsSmi() && (object.ptr() != kNullAddress)) ||
54 : (object->GetHeapObjectIfWeak(&heap_object) &&
55 : (heap_object->IsMap() || heap_object->IsPropertyCell())) ||
56 : (object->GetHeapObjectIfStrong(&heap_object) &&
57 : (heap_object->IsDataHandler() || heap_object->IsCode()));
58 : }
59 :
60 0 : bool IC::AddressIsDeoptimizedCode() const {
61 0 : return AddressIsDeoptimizedCode(isolate(), address());
62 : }
63 :
64 : // static
65 0 : bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) {
66 : Code host =
67 0 : isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
68 0 : return (host->kind() == Code::OPTIMIZED_FUNCTION &&
69 0 : host->marked_for_deoptimization());
70 : }
71 :
72 451421 : bool IC::vector_needs_update() {
73 451421 : if (state() == NO_FEEDBACK) return false;
74 451422 : return (!vector_set_ &&
75 0 : (state() != MEGAMORPHIC ||
76 451422 : nexus()->GetFeedbackExtra().ToSmi().value() != ELEMENT));
77 : }
78 :
79 : } // namespace internal
80 : } // namespace v8
81 :
82 : #endif // V8_IC_IC_INL_H_
|