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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return script->name()->IsUndefined(); | 154 return script->name()->IsUndefined(); |
155 } | 155 } |
156 // Do the fast bailout checks first. | 156 // Do the fast bailout checks first. |
157 if (line_offset != script->line_offset()->value()) return false; | 157 if (line_offset != script->line_offset()->value()) return false; |
158 if (column_offset != script->column_offset()->value()) return false; | 158 if (column_offset != script->column_offset()->value()) return false; |
159 // Check that both names are strings. If not, no match. | 159 // Check that both names are strings. If not, no match. |
160 if (!name->IsString() || !script->name()->IsString()) return false; | 160 if (!name->IsString() || !script->name()->IsString()) return false; |
161 // Were both scripts tagged by the embedder as being shared cross-origin? | 161 // Were both scripts tagged by the embedder as being shared cross-origin? |
162 if (is_shared_cross_origin != script->is_shared_cross_origin()) return false; | 162 if (is_shared_cross_origin != script->is_shared_cross_origin()) return false; |
163 // Compare the two name strings for equality. | 163 // Compare the two name strings for equality. |
164 return String::cast(*name)->Equals(String::cast(script->name())); | 164 return String::Equals(Handle<String>::cast(name), |
| 165 Handle<String>(String::cast(script->name()))); |
165 } | 166 } |
166 | 167 |
167 | 168 |
168 // TODO(245): Need to allow identical code from different contexts to | 169 // TODO(245): Need to allow identical code from different contexts to |
169 // be cached in the same script generation. Currently the first use | 170 // be cached in the same script generation. Currently the first use |
170 // will be cached, but subsequent code from different source / line | 171 // will be cached, but subsequent code from different source / line |
171 // won't. | 172 // won't. |
172 Handle<SharedFunctionInfo> CompilationCacheScript::Lookup( | 173 Handle<SharedFunctionInfo> CompilationCacheScript::Lookup( |
173 Handle<String> source, | 174 Handle<String> source, |
174 Handle<Object> name, | 175 Handle<Object> name, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 459 } |
459 | 460 |
460 | 461 |
461 void CompilationCache::Disable() { | 462 void CompilationCache::Disable() { |
462 enabled_ = false; | 463 enabled_ = false; |
463 Clear(); | 464 Clear(); |
464 } | 465 } |
465 | 466 |
466 | 467 |
467 } } // namespace v8::internal | 468 } } // namespace v8::internal |
OLD | NEW |