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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 }; | 48 }; |
49 | 49 |
50 // Finds the script function boilerplate for a source | 50 // Finds the script function boilerplate for a source |
51 // string. Returns an empty handle if the cache doesn't contain a | 51 // string. Returns an empty handle if the cache doesn't contain a |
52 // script for the given source string with the right origin. | 52 // script for the given source string with the right origin. |
53 static Handle<JSFunction> LookupScript(Handle<String> source, | 53 static Handle<JSFunction> LookupScript(Handle<String> source, |
54 Handle<Object> name, | 54 Handle<Object> name, |
55 int line_offset, | 55 int line_offset, |
56 int column_offset); | 56 int column_offset); |
57 | 57 |
58 // Finds the function boilerplate for a source string for | 58 // Finds the function boilerplate for a source string for eval in a |
59 // eval. Returns an empty handle if the cache doesn't contain a | 59 // given context. Returns an empty handle if the cache doesn't |
60 // 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 Entry entry); | 63 Entry entry); |
63 | 64 |
64 // Returns the regexp data associated with the given regexp if it | 65 // Returns the regexp data associated with the given regexp if it |
65 // is in cache, otherwise an empty handle. | 66 // is in cache, otherwise an empty handle. |
66 static Handle<FixedArray> LookupRegExp(Handle<String> source, | 67 static Handle<FixedArray> LookupRegExp(Handle<String> source, |
67 JSRegExp::Flags flags); | 68 JSRegExp::Flags flags); |
68 | 69 |
69 // Associate the (source, flags) pair to the given regexp data. | 70 // Associate the (source, flags) pair to the given regexp data. |
70 // This may overwrite an existing mapping. | 71 // This may overwrite an existing mapping. |
71 static void PutRegExp(Handle<String> source, | 72 static void PutRegExp(Handle<String> source, |
72 JSRegExp::Flags flags, | 73 JSRegExp::Flags flags, |
73 Handle<FixedArray> data); | 74 Handle<FixedArray> data); |
74 | 75 |
75 // Associate the (source, kind) pair to the boilerplate. This may | 76 // Associate the (source, kind) pair to the boilerplate. This may |
76 // overwrite an existing mapping. | 77 // overwrite an existing mapping. |
77 static void PutFunction(Handle<String> source, | 78 static void PutFunction(Handle<String> source, |
78 Entry entry, | 79 Entry entry, |
79 Handle<JSFunction> boilerplate); | 80 Handle<JSFunction> boilerplate); |
80 | 81 |
82 // Associate the (source, context->closure()->shared(), kind) | |
83 // tripple with the boilerplate. This may overwrite an existing | |
Kasper Lund
2009/02/24 11:21:08
tripple -> triple
| |
84 // mapping. | |
85 static void PutEvalFunction(Handle<String> source, | |
86 Handle<Context> context, | |
87 Entry entry, | |
88 Handle<JSFunction> boilerplate); | |
89 | |
81 // Clear the cache - also used to initialize the cache at startup. | 90 // Clear the cache - also used to initialize the cache at startup. |
82 static void Clear(); | 91 static void Clear(); |
83 | 92 |
84 // GC support. | 93 // GC support. |
85 static void Iterate(ObjectVisitor* v); | 94 static void Iterate(ObjectVisitor* v); |
86 | 95 |
87 // Notify the cache that a mark-sweep garbage collection is about to | 96 // Notify the cache that a mark-sweep garbage collection is about to |
88 // take place. This is used to retire entries from the cache to | 97 // take place. This is used to retire entries from the cache to |
89 // avoid keeping them alive too long without using them. For now, we | 98 // avoid keeping them alive too long without using them. For now, we |
90 // just clear the cache but we should consider are more | 99 // just clear the cache but we should consider are more |
91 // sophisticated LRU scheme. | 100 // sophisticated LRU scheme. |
92 static void MarkCompactPrologue() { Clear(); } | 101 static void MarkCompactPrologue() { Clear(); } |
93 }; | 102 }; |
94 | 103 |
95 | 104 |
96 } } // namespace v8::internal | 105 } } // namespace v8::internal |
97 | 106 |
98 #endif // V8_COMPILATION_CACHE_H_ | 107 #endif // V8_COMPILATION_CACHE_H_ |
OLD | NEW |