OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 25 matching lines...) Expand all Loading... |
36 #include "stub-cache.h" | 36 #include "stub-cache.h" |
37 #include "vm-state-inl.h" | 37 #include "vm-state-inl.h" |
38 | 38 |
39 namespace v8 { | 39 namespace v8 { |
40 namespace internal { | 40 namespace internal { |
41 | 41 |
42 // ----------------------------------------------------------------------- | 42 // ----------------------------------------------------------------------- |
43 // StubCache implementation. | 43 // StubCache implementation. |
44 | 44 |
45 | 45 |
46 StubCache::StubCache(Isolate* isolate) : isolate_(isolate) { | 46 StubCache::StubCache(Isolate* isolate, Zone* zone) |
| 47 : isolate_(isolate), zone_(zone) { |
47 ASSERT(isolate == Isolate::Current()); | 48 ASSERT(isolate == Isolate::Current()); |
48 } | 49 } |
49 | 50 |
50 | 51 |
51 void StubCache::Initialize() { | 52 void StubCache::Initialize() { |
52 ASSERT(IsPowerOf2(kPrimaryTableSize)); | 53 ASSERT(IsPowerOf2(kPrimaryTableSize)); |
53 ASSERT(IsPowerOf2(kSecondaryTableSize)); | 54 ASSERT(IsPowerOf2(kSecondaryTableSize)); |
54 Clear(); | 55 Clear(); |
55 } | 56 } |
56 | 57 |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 for (int i = 0; i < kPrimaryTableSize; i++) { | 895 for (int i = 0; i < kPrimaryTableSize; i++) { |
895 if (primary_[i].key == name) { | 896 if (primary_[i].key == name) { |
896 Map* map = primary_[i].value->FindFirstMap(); | 897 Map* map = primary_[i].value->FindFirstMap(); |
897 // Map can be NULL, if the stub is constant function call | 898 // Map can be NULL, if the stub is constant function call |
898 // with a primitive receiver. | 899 // with a primitive receiver. |
899 if (map == NULL) continue; | 900 if (map == NULL) continue; |
900 | 901 |
901 int offset = PrimaryOffset(name, flags, map); | 902 int offset = PrimaryOffset(name, flags, map); |
902 if (entry(primary_, offset) == &primary_[i] && | 903 if (entry(primary_, offset) == &primary_[i] && |
903 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 904 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
904 types->Add(Handle<Map>(map)); | 905 types->Add(Handle<Map>(map), zone()); |
905 } | 906 } |
906 } | 907 } |
907 } | 908 } |
908 | 909 |
909 for (int i = 0; i < kSecondaryTableSize; i++) { | 910 for (int i = 0; i < kSecondaryTableSize; i++) { |
910 if (secondary_[i].key == name) { | 911 if (secondary_[i].key == name) { |
911 Map* map = secondary_[i].value->FindFirstMap(); | 912 Map* map = secondary_[i].value->FindFirstMap(); |
912 // Map can be NULL, if the stub is constant function call | 913 // Map can be NULL, if the stub is constant function call |
913 // with a primitive receiver. | 914 // with a primitive receiver. |
914 if (map == NULL) continue; | 915 if (map == NULL) continue; |
915 | 916 |
916 // Lookup in primary table and skip duplicates. | 917 // Lookup in primary table and skip duplicates. |
917 int primary_offset = PrimaryOffset(name, flags, map); | 918 int primary_offset = PrimaryOffset(name, flags, map); |
918 Entry* primary_entry = entry(primary_, primary_offset); | 919 Entry* primary_entry = entry(primary_, primary_offset); |
919 if (primary_entry->key == name) { | 920 if (primary_entry->key == name) { |
920 Map* primary_map = primary_entry->value->FindFirstMap(); | 921 Map* primary_map = primary_entry->value->FindFirstMap(); |
921 if (map == primary_map) continue; | 922 if (map == primary_map) continue; |
922 } | 923 } |
923 | 924 |
924 // Lookup in secondary table and add matches. | 925 // Lookup in secondary table and add matches. |
925 int offset = SecondaryOffset(name, flags, primary_offset); | 926 int offset = SecondaryOffset(name, flags, primary_offset); |
926 if (entry(secondary_, offset) == &secondary_[i] && | 927 if (entry(secondary_, offset) == &secondary_[i] && |
927 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 928 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
928 types->Add(Handle<Map>(map)); | 929 types->Add(Handle<Map>(map), zone()); |
929 } | 930 } |
930 } | 931 } |
931 } | 932 } |
932 } | 933 } |
933 | 934 |
934 | 935 |
935 // ------------------------------------------------------------------------ | 936 // ------------------------------------------------------------------------ |
936 // StubCompiler implementation. | 937 // StubCompiler implementation. |
937 | 938 |
938 | 939 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 Handle<FunctionTemplateInfo>( | 1526 Handle<FunctionTemplateInfo>( |
1526 FunctionTemplateInfo::cast(signature->receiver())); | 1527 FunctionTemplateInfo::cast(signature->receiver())); |
1527 } | 1528 } |
1528 } | 1529 } |
1529 | 1530 |
1530 is_simple_api_call_ = true; | 1531 is_simple_api_call_ = true; |
1531 } | 1532 } |
1532 | 1533 |
1533 | 1534 |
1534 } } // namespace v8::internal | 1535 } } // namespace v8::internal |
OLD | NEW |