ic-inl.h 1.33 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
void IC::update_lookup_start_object_map(Handle<Object> object) {
  if (object->IsSmi()) {
    lookup_start_object_map_ = isolate_->factory()->heap_number_map();
22
  } else {
23 24
    lookup_start_object_map_ =
        handle(HeapObject::cast(*object).map(), isolate_);
25 26 27
  }
}

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

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

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

46
#endif  // V8_IC_IC_INL_H_