Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 43288ad810ef79ddaeee3b7e9e0e2a26d9a2915f..8f61f756493b3e99b930f1199c0cb00cbb72b558 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -10891,6 +10891,26 @@ bool Code::FindHandlers(CodeHandleList* code_list, int length) { |
} |
+MaybeHandle<Code> Code::FindHandlerForMap(Map* map) { |
+ ASSERT(is_inline_cache_stub()); |
+ int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
+ RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
+ bool return_next = false; |
+ for (RelocIterator it(this, mask); !it.done(); it.next()) { |
+ RelocInfo* info = it.rinfo(); |
+ if (info->rmode() == RelocInfo::EMBEDDED_OBJECT) { |
+ Object* object = info->target_object(); |
+ if (object == map) return_next = true; |
+ } else if (return_next) { |
+ Code* code = Code::GetCodeFromTargetAddress(info->target_address()); |
+ ASSERT(code->kind() == Code::HANDLER); |
+ return handle(code); |
+ } |
+ } |
+ return MaybeHandle<Code>(); |
+} |
+ |
+ |
Name* Code::FindFirstName() { |
ASSERT(is_inline_cache_stub()); |
DisallowHeapAllocation no_allocation; |
@@ -11354,7 +11374,8 @@ const char* Code::ICState2String(InlineCacheState state) { |
case UNINITIALIZED: return "UNINITIALIZED"; |
case PREMONOMORPHIC: return "PREMONOMORPHIC"; |
case MONOMORPHIC: return "MONOMORPHIC"; |
- case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE"; |
+ case PROTOTYPE_FAILURE: |
+ return "PROTOTYPE_FAILURE"; |
case POLYMORPHIC: return "POLYMORPHIC"; |
case MEGAMORPHIC: return "MEGAMORPHIC"; |
case GENERIC: return "GENERIC"; |