| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ic/stub-cache.h" | 5 #include "src/ic/stub-cache.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/type-info.h" | 8 #include "src/type-info.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 primary->map = map; | 68 primary->map = map; |
| 69 isolate()->counters()->megamorphic_stub_cache_updates()->Increment(); | 69 isolate()->counters()->megamorphic_stub_cache_updates()->Increment(); |
| 70 return code; | 70 return code; |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 Code* StubCache::Get(Name* name, Map* map, Code::Flags flags) { | 74 Code* StubCache::Get(Name* name, Map* map, Code::Flags flags) { |
| 75 flags = CommonStubCacheChecks(name, map, flags); | 75 flags = CommonStubCacheChecks(name, map, flags); |
| 76 int primary_offset = PrimaryOffset(name, flags, map); | 76 int primary_offset = PrimaryOffset(name, flags, map); |
| 77 Entry* primary = entry(primary_, primary_offset); | 77 Entry* primary = entry(primary_, primary_offset); |
| 78 if (primary->key == name && primary->map == map) { | 78 if (primary->key == name && primary->map == map && |
| 79 flags == Code::RemoveHolderFromFlags(primary->value->flags())) { |
| 79 return primary->value; | 80 return primary->value; |
| 80 } | 81 } |
| 81 int secondary_offset = SecondaryOffset(name, flags, primary_offset); | 82 int secondary_offset = SecondaryOffset(name, flags, primary_offset); |
| 82 Entry* secondary = entry(secondary_, secondary_offset); | 83 Entry* secondary = entry(secondary_, secondary_offset); |
| 83 if (secondary->key == name && secondary->map == map) { | 84 if (secondary->key == name && secondary->map == map && |
| 85 flags == Code::RemoveHolderFromFlags(secondary->value->flags())) { |
| 84 return secondary->value; | 86 return secondary->value; |
| 85 } | 87 } |
| 86 return NULL; | 88 return NULL; |
| 87 } | 89 } |
| 88 | 90 |
| 89 | 91 |
| 90 void StubCache::Clear() { | 92 void StubCache::Clear() { |
| 91 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); | 93 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); |
| 92 for (int i = 0; i < kPrimaryTableSize; i++) { | 94 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 93 primary_[i].key = isolate()->heap()->empty_string(); | 95 primary_[i].key = isolate()->heap()->empty_string(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 int offset = SecondaryOffset(*name, flags, primary_offset); | 137 int offset = SecondaryOffset(*name, flags, primary_offset); |
| 136 if (entry(secondary_, offset) == &secondary_[i] && | 138 if (entry(secondary_, offset) == &secondary_[i] && |
| 137 TypeFeedbackOracle::IsRelevantFeedback(map, *native_context)) { | 139 TypeFeedbackOracle::IsRelevantFeedback(map, *native_context)) { |
| 138 types->AddMapIfMissing(Handle<Map>(map), zone); | 140 types->AddMapIfMissing(Handle<Map>(map), zone); |
| 139 } | 141 } |
| 140 } | 142 } |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 } // namespace internal | 145 } // namespace internal |
| 144 } // namespace v8 | 146 } // namespace v8 |
| OLD | NEW |