OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 10873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10884 // IC stubs with handlers never contain non-handler code objects before | 10884 // IC stubs with handlers never contain non-handler code objects before |
10885 // handler targets. | 10885 // handler targets. |
10886 if (code->kind() != Code::HANDLER) break; | 10886 if (code->kind() != Code::HANDLER) break; |
10887 code_list->Add(Handle<Code>(code)); | 10887 code_list->Add(Handle<Code>(code)); |
10888 i++; | 10888 i++; |
10889 } | 10889 } |
10890 return i == length; | 10890 return i == length; |
10891 } | 10891 } |
10892 | 10892 |
10893 | 10893 |
| 10894 MaybeHandle<Code> Code::FindHandlerForMap(Map* map) { |
| 10895 ASSERT(is_inline_cache_stub()); |
| 10896 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
| 10897 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 10898 bool return_next = false; |
| 10899 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
| 10900 RelocInfo* info = it.rinfo(); |
| 10901 if (info->rmode() == RelocInfo::EMBEDDED_OBJECT) { |
| 10902 Object* object = info->target_object(); |
| 10903 if (object == map) return_next = true; |
| 10904 } else if (return_next) { |
| 10905 Code* code = Code::GetCodeFromTargetAddress(info->target_address()); |
| 10906 ASSERT(code->kind() == Code::HANDLER); |
| 10907 return handle(code); |
| 10908 } |
| 10909 } |
| 10910 return MaybeHandle<Code>(); |
| 10911 } |
| 10912 |
| 10913 |
10894 Name* Code::FindFirstName() { | 10914 Name* Code::FindFirstName() { |
10895 ASSERT(is_inline_cache_stub()); | 10915 ASSERT(is_inline_cache_stub()); |
10896 DisallowHeapAllocation no_allocation; | 10916 DisallowHeapAllocation no_allocation; |
10897 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 10917 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
10898 for (RelocIterator it(this, mask); !it.done(); it.next()) { | 10918 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
10899 RelocInfo* info = it.rinfo(); | 10919 RelocInfo* info = it.rinfo(); |
10900 Object* object = info->target_object(); | 10920 Object* object = info->target_object(); |
10901 if (object->IsName()) return Name::cast(object); | 10921 if (object->IsName()) return Name::cast(object); |
10902 } | 10922 } |
10903 return NULL; | 10923 return NULL; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11347 os << buf.start(); | 11367 os << buf.start(); |
11348 } | 11368 } |
11349 } | 11369 } |
11350 | 11370 |
11351 | 11371 |
11352 const char* Code::ICState2String(InlineCacheState state) { | 11372 const char* Code::ICState2String(InlineCacheState state) { |
11353 switch (state) { | 11373 switch (state) { |
11354 case UNINITIALIZED: return "UNINITIALIZED"; | 11374 case UNINITIALIZED: return "UNINITIALIZED"; |
11355 case PREMONOMORPHIC: return "PREMONOMORPHIC"; | 11375 case PREMONOMORPHIC: return "PREMONOMORPHIC"; |
11356 case MONOMORPHIC: return "MONOMORPHIC"; | 11376 case MONOMORPHIC: return "MONOMORPHIC"; |
11357 case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE"; | 11377 case PROTOTYPE_FAILURE: |
| 11378 return "PROTOTYPE_FAILURE"; |
11358 case POLYMORPHIC: return "POLYMORPHIC"; | 11379 case POLYMORPHIC: return "POLYMORPHIC"; |
11359 case MEGAMORPHIC: return "MEGAMORPHIC"; | 11380 case MEGAMORPHIC: return "MEGAMORPHIC"; |
11360 case GENERIC: return "GENERIC"; | 11381 case GENERIC: return "GENERIC"; |
11361 case DEBUG_STUB: return "DEBUG_STUB"; | 11382 case DEBUG_STUB: return "DEBUG_STUB"; |
11362 } | 11383 } |
11363 UNREACHABLE(); | 11384 UNREACHABLE(); |
11364 return NULL; | 11385 return NULL; |
11365 } | 11386 } |
11366 | 11387 |
11367 | 11388 |
(...skipping 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16914 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16935 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16915 static const char* error_messages_[] = { | 16936 static const char* error_messages_[] = { |
16916 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16937 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16917 }; | 16938 }; |
16918 #undef ERROR_MESSAGES_TEXTS | 16939 #undef ERROR_MESSAGES_TEXTS |
16919 return error_messages_[reason]; | 16940 return error_messages_[reason]; |
16920 } | 16941 } |
16921 | 16942 |
16922 | 16943 |
16923 } } // namespace v8::internal | 16944 } } // namespace v8::internal |
OLD | NEW |