• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/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 namespace v8 {
17 namespace internal {
18 
update_lookup_start_object_map(Handle<Object> object)19 void IC::update_lookup_start_object_map(Handle<Object> object) {
20   if (object->IsSmi()) {
21     lookup_start_object_map_ = isolate_->factory()->heap_number_map();
22   } else {
23     lookup_start_object_map_ =
24         handle(HeapObject::cast(*object).map(), isolate_);
25   }
26 }
27 
IsHandler(MaybeObject object)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.IsCodeT()));
35 }
36 
vector_needs_update()37 bool IC::vector_needs_update() {
38   if (state() == InlineCacheState::NO_FEEDBACK) return false;
39   return (!vector_set_ && (state() != InlineCacheState::MEGAMORPHIC ||
40                            nexus()->GetKeyType() != IcCheckType::kElement));
41 }
42 
43 }  // namespace internal
44 }  // namespace v8
45 
46 #endif  // V8_IC_IC_INL_H_
47