Chromium Code Reviews| 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 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1051 primary_[i].key = heap()->empty_string(); | 1051 primary_[i].key = heap()->empty_string(); |
| 1052 primary_[i].value = empty; | 1052 primary_[i].value = empty; |
| 1053 } | 1053 } |
| 1054 for (int j = 0; j < kSecondaryTableSize; j++) { | 1054 for (int j = 0; j < kSecondaryTableSize; j++) { |
| 1055 secondary_[j].key = heap()->empty_string(); | 1055 secondary_[j].key = heap()->empty_string(); |
| 1056 secondary_[j].value = empty; | 1056 secondary_[j].value = empty; |
| 1057 } | 1057 } |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 | 1060 |
| 1061 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list, | |
|
danno
2013/05/02 14:29:30
We already have this in type-info.cc. Any way to s
Toon Verwaest
2013/05/02 15:22:40
Done.
| |
| 1062 Zone* zone) { | |
| 1063 map = Map::Update(map); | |
| 1064 for (int i = 0; i < list->length(); ++i) { | |
| 1065 if (list->at(i).is_identical_to(map)) return; | |
| 1066 } | |
| 1067 list->Add(map, zone); | |
| 1068 } | |
| 1069 | |
| 1070 | |
| 1061 void StubCache::CollectMatchingMaps(SmallMapList* types, | 1071 void StubCache::CollectMatchingMaps(SmallMapList* types, |
| 1062 Name* name, | 1072 Handle<Name> name, |
| 1063 Code::Flags flags, | 1073 Code::Flags flags, |
| 1064 Handle<Context> native_context, | 1074 Handle<Context> native_context, |
| 1065 Zone* zone) { | 1075 Zone* zone) { |
| 1066 for (int i = 0; i < kPrimaryTableSize; i++) { | 1076 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 1067 if (primary_[i].key == name) { | 1077 if (primary_[i].key == *name) { |
| 1068 Map* map = primary_[i].map; | 1078 Map* map = primary_[i].map; |
| 1069 // Map can be NULL, if the stub is constant function call | 1079 // Map can be NULL, if the stub is constant function call |
| 1070 // with a primitive receiver. | 1080 // with a primitive receiver. |
| 1071 if (map == NULL) continue; | 1081 if (map == NULL) continue; |
| 1072 | 1082 |
| 1073 int offset = PrimaryOffset(name, flags, map); | 1083 int offset = PrimaryOffset(*name, flags, map); |
| 1074 if (entry(primary_, offset) == &primary_[i] && | 1084 if (entry(primary_, offset) == &primary_[i] && |
| 1075 !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { | 1085 !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { |
| 1076 types->Add(Handle<Map>(map), zone); | 1086 AddMapIfMissing(Handle<Map>(map), types, zone); |
| 1077 } | 1087 } |
| 1078 } | 1088 } |
| 1079 } | 1089 } |
| 1080 | 1090 |
| 1081 for (int i = 0; i < kSecondaryTableSize; i++) { | 1091 for (int i = 0; i < kSecondaryTableSize; i++) { |
| 1082 if (secondary_[i].key == name) { | 1092 if (secondary_[i].key == *name) { |
| 1083 Map* map = secondary_[i].map; | 1093 Map* map = secondary_[i].map; |
| 1084 // Map can be NULL, if the stub is constant function call | 1094 // Map can be NULL, if the stub is constant function call |
| 1085 // with a primitive receiver. | 1095 // with a primitive receiver. |
| 1086 if (map == NULL) continue; | 1096 if (map == NULL) continue; |
| 1087 | 1097 |
| 1088 // Lookup in primary table and skip duplicates. | 1098 // Lookup in primary table and skip duplicates. |
| 1089 int primary_offset = PrimaryOffset(name, flags, map); | 1099 int primary_offset = PrimaryOffset(*name, flags, map); |
| 1090 Entry* primary_entry = entry(primary_, primary_offset); | |
| 1091 if (primary_entry->key == name) { | |
| 1092 Map* primary_map = primary_entry->map; | |
| 1093 if (map == primary_map) continue; | |
| 1094 } | |
| 1095 | 1100 |
| 1096 // Lookup in secondary table and add matches. | 1101 // Lookup in secondary table and add matches. |
| 1097 int offset = SecondaryOffset(name, flags, primary_offset); | 1102 int offset = SecondaryOffset(*name, flags, primary_offset); |
| 1098 if (entry(secondary_, offset) == &secondary_[i] && | 1103 if (entry(secondary_, offset) == &secondary_[i] && |
| 1099 !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { | 1104 !TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) { |
| 1100 types->Add(Handle<Map>(map), zone); | 1105 AddMapIfMissing(Handle<Map>(map), types, zone); |
| 1101 } | 1106 } |
| 1102 } | 1107 } |
| 1103 } | 1108 } |
| 1104 } | 1109 } |
| 1105 | 1110 |
| 1106 | 1111 |
| 1107 // ------------------------------------------------------------------------ | 1112 // ------------------------------------------------------------------------ |
| 1108 // StubCompiler implementation. | 1113 // StubCompiler implementation. |
| 1109 | 1114 |
| 1110 | 1115 |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2116 Handle<FunctionTemplateInfo>( | 2121 Handle<FunctionTemplateInfo>( |
| 2117 FunctionTemplateInfo::cast(signature->receiver())); | 2122 FunctionTemplateInfo::cast(signature->receiver())); |
| 2118 } | 2123 } |
| 2119 } | 2124 } |
| 2120 | 2125 |
| 2121 is_simple_api_call_ = true; | 2126 is_simple_api_call_ = true; |
| 2122 } | 2127 } |
| 2123 | 2128 |
| 2124 | 2129 |
| 2125 } } // namespace v8::internal | 2130 } } // namespace v8::internal |
| OLD | NEW |