| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 | 247 |
| 248 void CompilationCacheScript::Put(Handle<String> source, | 248 void CompilationCacheScript::Put(Handle<String> source, |
| 249 Handle<SharedFunctionInfo> function_info) { | 249 Handle<SharedFunctionInfo> function_info) { |
| 250 HandleScope scope; | 250 HandleScope scope; |
| 251 SetFirstTable(TablePut(source, function_info)); | 251 SetFirstTable(TablePut(source, function_info)); |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( | 255 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( |
| 256 Handle<String> source, Handle<Context> context) { | 256 Handle<String> source, |
| 257 Handle<Context> context, |
| 258 StrictModeFlag strict_mode) { |
| 257 // Make sure not to leak the table into the surrounding handle | 259 // Make sure not to leak the table into the surrounding handle |
| 258 // scope. Otherwise, we risk keeping old tables around even after | 260 // scope. Otherwise, we risk keeping old tables around even after |
| 259 // having cleared the cache. | 261 // having cleared the cache. |
| 260 Object* result = NULL; | 262 Object* result = NULL; |
| 261 int generation; | 263 int generation; |
| 262 { HandleScope scope; | 264 { HandleScope scope; |
| 263 for (generation = 0; generation < generations(); generation++) { | 265 for (generation = 0; generation < generations(); generation++) { |
| 264 Handle<CompilationCacheTable> table = GetTable(generation); | 266 Handle<CompilationCacheTable> table = GetTable(generation); |
| 265 result = table->LookupEval(*source, *context); | 267 result = table->LookupEval(*source, *context, strict_mode); |
| 266 if (result->IsSharedFunctionInfo()) { | 268 if (result->IsSharedFunctionInfo()) { |
| 267 break; | 269 break; |
| 268 } | 270 } |
| 269 } | 271 } |
| 270 } | 272 } |
| 271 if (result->IsSharedFunctionInfo()) { | 273 if (result->IsSharedFunctionInfo()) { |
| 272 Handle<SharedFunctionInfo> | 274 Handle<SharedFunctionInfo> |
| 273 function_info(SharedFunctionInfo::cast(result)); | 275 function_info(SharedFunctionInfo::cast(result)); |
| 274 if (generation != 0) { | 276 if (generation != 0) { |
| 275 Put(source, context, function_info); | 277 Put(source, context, function_info); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 int line_offset, | 385 int line_offset, |
| 384 int column_offset) { | 386 int column_offset) { |
| 385 if (!IsEnabled()) { | 387 if (!IsEnabled()) { |
| 386 return Handle<SharedFunctionInfo>::null(); | 388 return Handle<SharedFunctionInfo>::null(); |
| 387 } | 389 } |
| 388 | 390 |
| 389 return script_.Lookup(source, name, line_offset, column_offset); | 391 return script_.Lookup(source, name, line_offset, column_offset); |
| 390 } | 392 } |
| 391 | 393 |
| 392 | 394 |
| 393 Handle<SharedFunctionInfo> CompilationCache::LookupEval(Handle<String> source, | 395 Handle<SharedFunctionInfo> CompilationCache::LookupEval( |
| 394 Handle<Context> context, | 396 Handle<String> source, |
| 395 bool is_global) { | 397 Handle<Context> context, |
| 398 bool is_global, |
| 399 StrictModeFlag strict_mode) { |
| 396 if (!IsEnabled()) { | 400 if (!IsEnabled()) { |
| 397 return Handle<SharedFunctionInfo>::null(); | 401 return Handle<SharedFunctionInfo>::null(); |
| 398 } | 402 } |
| 399 | 403 |
| 400 Handle<SharedFunctionInfo> result; | 404 Handle<SharedFunctionInfo> result; |
| 401 if (is_global) { | 405 if (is_global) { |
| 402 result = eval_global_.Lookup(source, context); | 406 result = eval_global_.Lookup(source, context, strict_mode); |
| 403 } else { | 407 } else { |
| 404 result = eval_contextual_.Lookup(source, context); | 408 result = eval_contextual_.Lookup(source, context, strict_mode); |
| 405 } | 409 } |
| 406 return result; | 410 return result; |
| 407 } | 411 } |
| 408 | 412 |
| 409 | 413 |
| 410 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 414 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
| 411 JSRegExp::Flags flags) { | 415 JSRegExp::Flags flags) { |
| 412 if (!IsEnabled()) { | 416 if (!IsEnabled()) { |
| 413 return Handle<FixedArray>::null(); | 417 return Handle<FixedArray>::null(); |
| 414 } | 418 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 534 } |
| 531 | 535 |
| 532 | 536 |
| 533 void CompilationCache::Disable() { | 537 void CompilationCache::Disable() { |
| 534 enabled_ = false; | 538 enabled_ = false; |
| 535 Clear(); | 539 Clear(); |
| 536 } | 540 } |
| 537 | 541 |
| 538 | 542 |
| 539 } } // namespace v8::internal | 543 } } // namespace v8::internal |
| OLD | NEW |