OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // contain a script for the given source string. | 60 // contain a script for the given source string. |
61 static Handle<JSFunction> LookupEval(Handle<String> source, | 61 static Handle<JSFunction> LookupEval(Handle<String> source, |
62 Handle<Context> context, | 62 Handle<Context> context, |
63 Entry entry); | 63 Entry entry); |
64 | 64 |
65 // Returns the regexp data associated with the given regexp if it | 65 // Returns the regexp data associated with the given regexp if it |
66 // is in cache, otherwise an empty handle. | 66 // is in cache, otherwise an empty handle. |
67 static Handle<FixedArray> LookupRegExp(Handle<String> source, | 67 static Handle<FixedArray> LookupRegExp(Handle<String> source, |
68 JSRegExp::Flags flags); | 68 JSRegExp::Flags flags); |
69 | 69 |
| 70 // Associate the (source, kind) pair to the boilerplate. This may |
| 71 // overwrite an existing mapping. |
| 72 static void PutScript(Handle<String> source, |
| 73 Entry entry, |
| 74 Handle<JSFunction> boilerplate); |
| 75 |
| 76 // Associate the (source, context->closure()->shared(), kind) triple |
| 77 // with the boilerplate. This may overwrite an existing mapping. |
| 78 static void PutEval(Handle<String> source, |
| 79 Handle<Context> context, |
| 80 Entry entry, |
| 81 Handle<JSFunction> boilerplate); |
| 82 |
70 // Associate the (source, flags) pair to the given regexp data. | 83 // Associate the (source, flags) pair to the given regexp data. |
71 // This may overwrite an existing mapping. | 84 // This may overwrite an existing mapping. |
72 static void PutRegExp(Handle<String> source, | 85 static void PutRegExp(Handle<String> source, |
73 JSRegExp::Flags flags, | 86 JSRegExp::Flags flags, |
74 Handle<FixedArray> data); | 87 Handle<FixedArray> data); |
75 | 88 |
76 // Associate the (source, kind) pair to the boilerplate. This may | |
77 // overwrite an existing mapping. | |
78 static void PutFunction(Handle<String> source, | |
79 Entry entry, | |
80 Handle<JSFunction> boilerplate); | |
81 | |
82 // Associate the (source, context->closure()->shared(), kind) | |
83 // triple with the boilerplate. This may overwrite an existing | |
84 // mapping. | |
85 static void PutEvalFunction(Handle<String> source, | |
86 Handle<Context> context, | |
87 Entry entry, | |
88 Handle<JSFunction> boilerplate); | |
89 | |
90 // Clear the cache - also used to initialize the cache at startup. | 89 // Clear the cache - also used to initialize the cache at startup. |
91 static void Clear(); | 90 static void Clear(); |
92 | 91 |
93 // GC support. | 92 // GC support. |
94 static void Iterate(ObjectVisitor* v); | 93 static void Iterate(ObjectVisitor* v); |
95 | 94 |
96 // Notify the cache that a mark-sweep garbage collection is about to | 95 // Notify the cache that a mark-sweep garbage collection is about to |
97 // take place. This is used to retire entries from the cache to | 96 // take place. This is used to retire entries from the cache to |
98 // avoid keeping them alive too long without using them. For now, we | 97 // avoid keeping them alive too long without using them. For now, we |
99 // just clear the cache but we should consider are more | 98 // just clear the cache but we should consider are more |
100 // sophisticated LRU scheme. | 99 // sophisticated LRU scheme. |
101 static void MarkCompactPrologue() { Clear(); } | 100 static void MarkCompactPrologue() { Clear(); } |
102 }; | 101 }; |
103 | 102 |
104 | 103 |
105 } } // namespace v8::internal | 104 } } // namespace v8::internal |
106 | 105 |
107 #endif // V8_COMPILATION_CACHE_H_ | 106 #endif // V8_COMPILATION_CACHE_H_ |
OLD | NEW |