OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 map_holder->UpdateMapCodeCache(name, Code::cast(code)); | 853 map_holder->UpdateMapCodeCache(name, Code::cast(code)); |
854 if (!maybe_result->ToObject(&result)) return maybe_result; | 854 if (!maybe_result->ToObject(&result)) return maybe_result; |
855 } | 855 } |
856 } | 856 } |
857 return code; | 857 return code; |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 static Object* GetProbeValue(Isolate* isolate, Code::Flags flags) { | 861 static Object* GetProbeValue(Isolate* isolate, Code::Flags flags) { |
862 // Use raw_unchecked... so we don't get assert failures during GC. | 862 // Use raw_unchecked... so we don't get assert failures during GC. |
863 NumberDictionary* dictionary = | 863 UnseededNumberDictionary* dictionary = |
864 isolate->heap()->raw_unchecked_non_monomorphic_cache(); | 864 isolate->heap()->raw_unchecked_non_monomorphic_cache(); |
865 int entry = dictionary->FindEntry(isolate, flags); | 865 int entry = dictionary->FindEntry(isolate, flags); |
866 if (entry != -1) return dictionary->ValueAt(entry); | 866 if (entry != -1) return dictionary->ValueAt(entry); |
867 return isolate->heap()->raw_unchecked_undefined_value(); | 867 return isolate->heap()->raw_unchecked_undefined_value(); |
868 } | 868 } |
869 | 869 |
870 | 870 |
871 MUST_USE_RESULT static MaybeObject* ProbeCache(Isolate* isolate, | 871 MUST_USE_RESULT static MaybeObject* ProbeCache(Isolate* isolate, |
872 Code::Flags flags) { | 872 Code::Flags flags) { |
873 Heap* heap = isolate->heap(); | 873 Heap* heap = isolate->heap(); |
874 Object* probe = GetProbeValue(isolate, flags); | 874 Object* probe = GetProbeValue(isolate, flags); |
875 if (probe != heap->undefined_value()) return probe; | 875 if (probe != heap->undefined_value()) return probe; |
876 // Seed the cache with an undefined value to make sure that any | 876 // Seed the cache with an undefined value to make sure that any |
877 // generated code object can always be inserted into the cache | 877 // generated code object can always be inserted into the cache |
878 // without causing allocation failures. | 878 // without causing allocation failures. |
879 Object* result; | 879 Object* result; |
880 { MaybeObject* maybe_result = | 880 { MaybeObject* maybe_result = |
881 heap->non_monomorphic_cache()->AtNumberPut(flags, | 881 heap->non_monomorphic_cache()->AtNumberPut(flags, |
882 heap->undefined_value()); | 882 heap->undefined_value()); |
883 if (!maybe_result->ToObject(&result)) return maybe_result; | 883 if (!maybe_result->ToObject(&result)) return maybe_result; |
884 } | 884 } |
885 heap->public_set_non_monomorphic_cache(NumberDictionary::cast(result)); | 885 heap->public_set_non_monomorphic_cache( |
| 886 UnseededNumberDictionary::cast(result)); |
886 return probe; | 887 return probe; |
887 } | 888 } |
888 | 889 |
889 | 890 |
890 static MaybeObject* FillCache(Isolate* isolate, MaybeObject* maybe_code) { | 891 static MaybeObject* FillCache(Isolate* isolate, MaybeObject* maybe_code) { |
891 Object* code; | 892 Object* code; |
892 if (maybe_code->ToObject(&code)) { | 893 if (maybe_code->ToObject(&code)) { |
893 if (code->IsCode()) { | 894 if (code->IsCode()) { |
894 Heap* heap = isolate->heap(); | 895 Heap* heap = isolate->heap(); |
895 int entry = heap->non_monomorphic_cache()->FindEntry( | 896 int entry = heap->non_monomorphic_cache()->FindEntry( |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 expected_receiver_type_ = | 1834 expected_receiver_type_ = |
1834 FunctionTemplateInfo::cast(signature->receiver()); | 1835 FunctionTemplateInfo::cast(signature->receiver()); |
1835 } | 1836 } |
1836 } | 1837 } |
1837 | 1838 |
1838 is_simple_api_call_ = true; | 1839 is_simple_api_call_ = true; |
1839 } | 1840 } |
1840 | 1841 |
1841 | 1842 |
1842 } } // namespace v8::internal | 1843 } } // namespace v8::internal |
OLD | NEW |