| 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 26 matching lines...) Expand all Loading... |
| 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, Zone* zone) | 46 StubCache::StubCache(Isolate* isolate, Zone* zone) |
| 47 : isolate_(isolate), zone_(zone) { | 47 : isolate_(isolate) { |
| 48 ASSERT(isolate == Isolate::Current()); | 48 ASSERT(isolate == Isolate::Current()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 void StubCache::Initialize() { | 52 void StubCache::Initialize() { |
| 53 ASSERT(IsPowerOf2(kPrimaryTableSize)); | 53 ASSERT(IsPowerOf2(kPrimaryTableSize)); |
| 54 ASSERT(IsPowerOf2(kSecondaryTableSize)); | 54 ASSERT(IsPowerOf2(kSecondaryTableSize)); |
| 55 Clear(); | 55 Clear(); |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 for (int j = 0; j < kSecondaryTableSize; j++) { | 920 for (int j = 0; j < kSecondaryTableSize; j++) { |
| 921 secondary_[j].key = heap()->empty_string(); | 921 secondary_[j].key = heap()->empty_string(); |
| 922 secondary_[j].value = empty; | 922 secondary_[j].value = empty; |
| 923 } | 923 } |
| 924 } | 924 } |
| 925 | 925 |
| 926 | 926 |
| 927 void StubCache::CollectMatchingMaps(SmallMapList* types, | 927 void StubCache::CollectMatchingMaps(SmallMapList* types, |
| 928 String* name, | 928 String* name, |
| 929 Code::Flags flags, | 929 Code::Flags flags, |
| 930 Handle<Context> global_context) { | 930 Handle<Context> global_context, |
| 931 Zone* zone) { |
| 931 for (int i = 0; i < kPrimaryTableSize; i++) { | 932 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 932 if (primary_[i].key == name) { | 933 if (primary_[i].key == name) { |
| 933 Map* map = primary_[i].value->FindFirstMap(); | 934 Map* map = primary_[i].value->FindFirstMap(); |
| 934 // Map can be NULL, if the stub is constant function call | 935 // Map can be NULL, if the stub is constant function call |
| 935 // with a primitive receiver. | 936 // with a primitive receiver. |
| 936 if (map == NULL) continue; | 937 if (map == NULL) continue; |
| 937 | 938 |
| 938 int offset = PrimaryOffset(name, flags, map); | 939 int offset = PrimaryOffset(name, flags, map); |
| 939 if (entry(primary_, offset) == &primary_[i] && | 940 if (entry(primary_, offset) == &primary_[i] && |
| 940 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 941 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
| 941 types->Add(Handle<Map>(map), zone()); | 942 types->Add(Handle<Map>(map), zone); |
| 942 } | 943 } |
| 943 } | 944 } |
| 944 } | 945 } |
| 945 | 946 |
| 946 for (int i = 0; i < kSecondaryTableSize; i++) { | 947 for (int i = 0; i < kSecondaryTableSize; i++) { |
| 947 if (secondary_[i].key == name) { | 948 if (secondary_[i].key == name) { |
| 948 Map* map = secondary_[i].value->FindFirstMap(); | 949 Map* map = secondary_[i].value->FindFirstMap(); |
| 949 // Map can be NULL, if the stub is constant function call | 950 // Map can be NULL, if the stub is constant function call |
| 950 // with a primitive receiver. | 951 // with a primitive receiver. |
| 951 if (map == NULL) continue; | 952 if (map == NULL) continue; |
| 952 | 953 |
| 953 // Lookup in primary table and skip duplicates. | 954 // Lookup in primary table and skip duplicates. |
| 954 int primary_offset = PrimaryOffset(name, flags, map); | 955 int primary_offset = PrimaryOffset(name, flags, map); |
| 955 Entry* primary_entry = entry(primary_, primary_offset); | 956 Entry* primary_entry = entry(primary_, primary_offset); |
| 956 if (primary_entry->key == name) { | 957 if (primary_entry->key == name) { |
| 957 Map* primary_map = primary_entry->value->FindFirstMap(); | 958 Map* primary_map = primary_entry->value->FindFirstMap(); |
| 958 if (map == primary_map) continue; | 959 if (map == primary_map) continue; |
| 959 } | 960 } |
| 960 | 961 |
| 961 // Lookup in secondary table and add matches. | 962 // Lookup in secondary table and add matches. |
| 962 int offset = SecondaryOffset(name, flags, primary_offset); | 963 int offset = SecondaryOffset(name, flags, primary_offset); |
| 963 if (entry(secondary_, offset) == &secondary_[i] && | 964 if (entry(secondary_, offset) == &secondary_[i] && |
| 964 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { | 965 !TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) { |
| 965 types->Add(Handle<Map>(map), zone()); | 966 types->Add(Handle<Map>(map), zone); |
| 966 } | 967 } |
| 967 } | 968 } |
| 968 } | 969 } |
| 969 } | 970 } |
| 970 | 971 |
| 971 | 972 |
| 972 // ------------------------------------------------------------------------ | 973 // ------------------------------------------------------------------------ |
| 973 // StubCompiler implementation. | 974 // StubCompiler implementation. |
| 974 | 975 |
| 975 | 976 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 Handle<FunctionTemplateInfo>( | 1565 Handle<FunctionTemplateInfo>( |
| 1565 FunctionTemplateInfo::cast(signature->receiver())); | 1566 FunctionTemplateInfo::cast(signature->receiver())); |
| 1566 } | 1567 } |
| 1567 } | 1568 } |
| 1568 | 1569 |
| 1569 is_simple_api_call_ = true; | 1570 is_simple_api_call_ = true; |
| 1570 } | 1571 } |
| 1571 | 1572 |
| 1572 | 1573 |
| 1573 } } // namespace v8::internal | 1574 } } // namespace v8::internal |
| OLD | NEW |