ic-inl.h 1.49 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4 5 6 7

#ifndef V8_IC_INL_H_
#define V8_IC_INL_H_

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 16
namespace v8 {
namespace internal {
17

18

19
Address IC::address() const {
20
  // Get the address of the call.
21
  return Assembler::target_address_from_return_address(pc());
22 23 24
}


25
Address IC::constant_pool() const {
26 27
  if (FLAG_enable_embedded_constant_pool) {
    return raw_constant_pool();
28
  } else {
29
    return NULL;
30 31 32 33
  }
}


34 35 36
Address IC::raw_constant_pool() const {
  if (FLAG_enable_embedded_constant_pool) {
    return *constant_pool_address_;
37 38 39 40 41 42
  } else {
    return NULL;
  }
}


43
bool IC::IsHandler(Object* object) {
44
  return (object->IsSmi() && (object != nullptr)) || object->IsTuple2() ||
45
         object->IsTuple3() || object->IsFixedArray() || object->IsWeakCell() ||
46 47 48
         (object->IsCode() && Code::cast(object)->is_handler());
}

49 50 51 52 53 54 55 56 57 58 59
bool IC::AddressIsDeoptimizedCode() const {
  return AddressIsDeoptimizedCode(isolate(), address());
}


bool IC::AddressIsDeoptimizedCode(Isolate* isolate, Address address) {
  Code* host =
      isolate->inner_pointer_to_code_cache()->GetCacheEntry(address)->code;
  return (host->kind() == Code::OPTIMIZED_FUNCTION &&
          host->marked_for_deoptimization());
}
60 61
}  // namespace internal
}  // namespace v8
62 63

#endif  // V8_IC_INL_H_