ic-inl.h 1.32 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
#ifndef V8_IC_IC_INL_H_
#define V8_IC_IC_INL_H_
7

8
#include "src/ic/ic.h"
9

10
#include "src/codegen/assembler-inl.h"
11
#include "src/debug/debug.h"
12
#include "src/execution/frames-inl.h"
13
#include "src/handles/handles-inl.h"
14
#include "src/objects/prototype.h"
15

16 17
namespace v8 {
namespace internal {
18

19 20 21 22
void IC::update_receiver_map(Handle<Object> receiver) {
  if (receiver->IsSmi()) {
    receiver_map_ = isolate_->factory()->heap_number_map();
  } else {
23
    receiver_map_ = handle(HeapObject::cast(*receiver).map(), isolate_);
24 25 26
  }
}

27
bool IC::IsHandler(MaybeObject object) {
28
  HeapObject heap_object;
29
  return (object->IsSmi() && (object.ptr() != kNullAddress)) ||
30
         (object->GetHeapObjectIfWeak(&heap_object) &&
31
          (heap_object.IsMap() || heap_object.IsPropertyCell())) ||
32
         (object->GetHeapObjectIfStrong(&heap_object) &&
33
          (heap_object.IsDataHandler() || heap_object.IsCode()));
34 35
}

Clemens Hammacher's avatar
Clemens Hammacher committed
36
bool IC::vector_needs_update() {
37
  if (state() == NO_FEEDBACK) return false;
Clemens Hammacher's avatar
Clemens Hammacher committed
38 39
  return (!vector_set_ &&
          (state() != MEGAMORPHIC ||
40
           nexus()->GetFeedbackExtra().ToSmi().value() != ELEMENT));
Clemens Hammacher's avatar
Clemens Hammacher committed
41 42
}

43 44
}  // namespace internal
}  // namespace v8
45

46
#endif  // V8_IC_IC_INL_H_