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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 memset(primary_, 0, sizeof(primary_[0]) * StubCache::kPrimaryTableSize); | 48 memset(primary_, 0, sizeof(primary_[0]) * StubCache::kPrimaryTableSize); |
49 memset(secondary_, 0, sizeof(secondary_[0]) * StubCache::kSecondaryTableSize); | 49 memset(secondary_, 0, sizeof(secondary_[0]) * StubCache::kSecondaryTableSize); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 void StubCache::Initialize(bool create_heap_objects) { | 53 void StubCache::Initialize(bool create_heap_objects) { |
54 ASSERT(IsPowerOf2(kPrimaryTableSize)); | 54 ASSERT(IsPowerOf2(kPrimaryTableSize)); |
55 ASSERT(IsPowerOf2(kSecondaryTableSize)); | 55 ASSERT(IsPowerOf2(kSecondaryTableSize)); |
56 if (create_heap_objects) { | 56 if (create_heap_objects) { |
57 HandleScope scope; | 57 HandleScope scope; |
58 Clear(); | 58 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); |
| 59 for (int i = 0; i < kPrimaryTableSize; i++) { |
| 60 primary_[i].key = heap()->empty_string(); |
| 61 primary_[i].value = empty; |
| 62 } |
| 63 for (int j = 0; j < kSecondaryTableSize; j++) { |
| 64 secondary_[j].key = heap()->empty_string(); |
| 65 secondary_[j].value = empty; |
| 66 } |
59 } | 67 } |
60 } | 68 } |
61 | 69 |
62 | 70 |
63 Code* StubCache::Set(String* name, Map* map, Code* code) { | 71 Code* StubCache::Set(String* name, Map* map, Code* code) { |
64 // Get the flags from the code. | 72 // Get the flags from the code. |
65 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags()); | 73 Code::Flags flags = Code::RemoveTypeFromFlags(code->flags()); |
66 | 74 |
67 // Validate that the name does not move on scavenge, and that we | 75 // Validate that the name does not move on scavenge, and that we |
68 // can use identity checks instead of string equality checks. | 76 // can use identity checks instead of string equality checks. |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1100 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1093 } | 1101 } |
1094 if (!probe->IsUndefined()) return probe; | 1102 if (!probe->IsUndefined()) return probe; |
1095 StubCompiler compiler; | 1103 StubCompiler compiler; |
1096 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); | 1104 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); |
1097 } | 1105 } |
1098 #endif | 1106 #endif |
1099 | 1107 |
1100 | 1108 |
1101 void StubCache::Clear() { | 1109 void StubCache::Clear() { |
| 1110 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); |
1102 for (int i = 0; i < kPrimaryTableSize; i++) { | 1111 for (int i = 0; i < kPrimaryTableSize; i++) { |
1103 primary_[i].key = heap()->empty_string(); | 1112 Code* code = primary_[i].value; |
1104 primary_[i].value = isolate_->builtins()->builtin( | 1113 if (code != empty && !code->is_pregenerated()) { |
1105 Builtins::kIllegal); | 1114 primary_[i].key = heap()->empty_string(); |
| 1115 primary_[i].value = empty; |
| 1116 } |
1106 } | 1117 } |
1107 for (int j = 0; j < kSecondaryTableSize; j++) { | 1118 for (int j = 0; j < kSecondaryTableSize; j++) { |
1108 secondary_[j].key = heap()->empty_string(); | 1119 Code* code = secondary_[j].value; |
1109 secondary_[j].value = isolate_->builtins()->builtin( | 1120 if (code != empty && !code->is_pregenerated()) { |
1110 Builtins::kIllegal); | 1121 secondary_[j].key = heap()->empty_string(); |
| 1122 secondary_[j].value = empty; |
| 1123 } |
1111 } | 1124 } |
1112 } | 1125 } |
1113 | 1126 |
1114 | 1127 |
1115 void StubCache::CollectMatchingMaps(SmallMapList* types, | 1128 void StubCache::CollectMatchingMaps(SmallMapList* types, |
1116 String* name, | 1129 String* name, |
1117 Code::Flags flags) { | 1130 Code::Flags flags) { |
1118 for (int i = 0; i < kPrimaryTableSize; i++) { | 1131 for (int i = 0; i < kPrimaryTableSize; i++) { |
1119 if (primary_[i].key == name) { | 1132 if (primary_[i].key == name) { |
1120 Map* map = primary_[i].value->FindFirstMap(); | 1133 Map* map = primary_[i].value->FindFirstMap(); |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 expected_receiver_type_ = | 1846 expected_receiver_type_ = |
1834 FunctionTemplateInfo::cast(signature->receiver()); | 1847 FunctionTemplateInfo::cast(signature->receiver()); |
1835 } | 1848 } |
1836 } | 1849 } |
1837 | 1850 |
1838 is_simple_api_call_ = true; | 1851 is_simple_api_call_ = true; |
1839 } | 1852 } |
1840 | 1853 |
1841 | 1854 |
1842 } } // namespace v8::internal | 1855 } } // namespace v8::internal |
OLD | NEW |