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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 for (int i = 0; i < kPrimaryTableSize; i++) { | 913 for (int i = 0; i < kPrimaryTableSize; i++) { |
913 if (primary_[i].key == name) { | 914 if (primary_[i].key == name) { |
914 Map* map = primary_[i].value->FindFirstMap(); | 915 Map* map = primary_[i].value->FindFirstMap(); |
915 // Map can be NULL, if the stub is constant function call | 916 // Map can be NULL, if the stub is constant function call |
916 // with a primitive receiver. | 917 // with a primitive receiver. |
917 if (map == NULL) continue; | 918 if (map == NULL) continue; |
918 | 919 |
919 int offset = PrimaryOffset(name, flags, map); | 920 int offset = PrimaryOffset(name, flags, map); |
920 if (entry(primary_, offset) == &primary_[i] && | 921 if (entry(primary_, offset) == &primary_[i] && |
921 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 922 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
922 types->Add(Handle<Map>(map)); | 923 types->Add(Handle<Map>(map), zone()); |
923 } | 924 } |
924 } | 925 } |
925 } | 926 } |
926 | 927 |
927 for (int i = 0; i < kSecondaryTableSize; i++) { | 928 for (int i = 0; i < kSecondaryTableSize; i++) { |
928 if (secondary_[i].key == name) { | 929 if (secondary_[i].key == name) { |
929 Map* map = secondary_[i].value->FindFirstMap(); | 930 Map* map = secondary_[i].value->FindFirstMap(); |
930 // Map can be NULL, if the stub is constant function call | 931 // Map can be NULL, if the stub is constant function call |
931 // with a primitive receiver. | 932 // with a primitive receiver. |
932 if (map == NULL) continue; | 933 if (map == NULL) continue; |
933 | 934 |
934 // Lookup in primary table and skip duplicates. | 935 // Lookup in primary table and skip duplicates. |
935 int primary_offset = PrimaryOffset(name, flags, map); | 936 int primary_offset = PrimaryOffset(name, flags, map); |
936 Entry* primary_entry = entry(primary_, primary_offset); | 937 Entry* primary_entry = entry(primary_, primary_offset); |
937 if (primary_entry->key == name) { | 938 if (primary_entry->key == name) { |
938 Map* primary_map = primary_entry->value->FindFirstMap(); | 939 Map* primary_map = primary_entry->value->FindFirstMap(); |
939 if (map == primary_map) continue; | 940 if (map == primary_map) continue; |
940 } | 941 } |
941 | 942 |
942 // Lookup in secondary table and add matches. | 943 // Lookup in secondary table and add matches. |
943 int offset = SecondaryOffset(name, flags, primary_offset); | 944 int offset = SecondaryOffset(name, flags, primary_offset); |
944 if (entry(secondary_, offset) == &secondary_[i] && | 945 if (entry(secondary_, offset) == &secondary_[i] && |
945 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 946 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
946 types->Add(Handle<Map>(map)); | 947 types->Add(Handle<Map>(map), zone()); |
947 } | 948 } |
948 } | 949 } |
949 } | 950 } |
950 } | 951 } |
951 | 952 |
952 | 953 |
953 // ------------------------------------------------------------------------ | 954 // ------------------------------------------------------------------------ |
954 // StubCompiler implementation. | 955 // StubCompiler implementation. |
955 | 956 |
956 | 957 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 Handle<FunctionTemplateInfo>( | 1546 Handle<FunctionTemplateInfo>( |
1546 FunctionTemplateInfo::cast(signature->receiver())); | 1547 FunctionTemplateInfo::cast(signature->receiver())); |
1547 } | 1548 } |
1548 } | 1549 } |
1549 | 1550 |
1550 is_simple_api_call_ = true; | 1551 is_simple_api_call_ = true; |
1551 } | 1552 } |
1552 | 1553 |
1553 | 1554 |
1554 } } // namespace v8::internal | 1555 } } // namespace v8::internal |
OLD | NEW |