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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (HasOrigin(boilerplate, name, line_offset, column_offset)) { | 167 if (HasOrigin(boilerplate, name, line_offset, column_offset)) { |
168 result = *boilerplate; | 168 result = *boilerplate; |
169 break; | 169 break; |
170 } | 170 } |
171 } | 171 } |
172 // Go to the next generation. | 172 // Go to the next generation. |
173 generation++; | 173 generation++; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 // Once outside the menacles of the handle scope, we need to recheck | 177 // Once outside the manacles of the handle scope, we need to recheck |
178 // to see if we actually found a cached script. If so, we return a | 178 // to see if we actually found a cached script. If so, we return a |
179 // handle created in the caller's handle scope. | 179 // handle created in the caller's handle scope. |
180 if (result != NULL) { | 180 if (result != NULL) { |
181 Handle<JSFunction> boilerplate(JSFunction::cast(result)); | 181 Handle<JSFunction> boilerplate(JSFunction::cast(result)); |
182 ASSERT(HasOrigin(boilerplate, name, line_offset, column_offset)); | 182 ASSERT(HasOrigin(boilerplate, name, line_offset, column_offset)); |
183 // If the script was found in a later generation, we promote it to | 183 // If the script was found in a later generation, we promote it to |
184 // the first generation to let it survive longer in the cache. | 184 // the first generation to let it survive longer in the cache. |
185 if (generation != SCRIPT) PutScript(source, boilerplate); | 185 if (generation != SCRIPT) PutScript(source, boilerplate); |
186 Counters::compilation_cache_hits.Increment(); | 186 Counters::compilation_cache_hits.Increment(); |
187 return boilerplate; | 187 return boilerplate; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 void CompilationCache::Disable() { | 299 void CompilationCache::Disable() { |
300 enabled = false; | 300 enabled = false; |
301 Clear(); | 301 Clear(); |
302 } | 302 } |
303 | 303 |
304 | 304 |
305 } } // namespace v8::internal | 305 } } // namespace v8::internal |
OLD | NEW |