Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: src/compilation-cache.cc

Issue 6286043: Direct call to eval passes strict mode through. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review feedback. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 }; 129 };
130 130
131 131
132 // Sub-cache for eval scripts. 132 // Sub-cache for eval scripts.
133 class CompilationCacheEval: public CompilationSubCache { 133 class CompilationCacheEval: public CompilationSubCache {
134 public: 134 public:
135 explicit CompilationCacheEval(int generations) 135 explicit CompilationCacheEval(int generations)
136 : CompilationSubCache(generations) { } 136 : CompilationSubCache(generations) { }
137 137
138 Handle<SharedFunctionInfo> Lookup(Handle<String> source, 138 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
139 Handle<Context> context); 139 Handle<Context> context,
140 StrictModeFlag strict_mode);
140 141
141 void Put(Handle<String> source, 142 void Put(Handle<String> source,
142 Handle<Context> context, 143 Handle<Context> context,
143 Handle<SharedFunctionInfo> function_info); 144 Handle<SharedFunctionInfo> function_info);
144 145
145 private: 146 private:
146 MUST_USE_RESULT MaybeObject* TryTablePut( 147 MUST_USE_RESULT MaybeObject* TryTablePut(
147 Handle<String> source, 148 Handle<String> source,
148 Handle<Context> context, 149 Handle<Context> context,
149 Handle<SharedFunctionInfo> function_info); 150 Handle<SharedFunctionInfo> function_info);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 365
365 366
366 void CompilationCacheScript::Put(Handle<String> source, 367 void CompilationCacheScript::Put(Handle<String> source,
367 Handle<SharedFunctionInfo> function_info) { 368 Handle<SharedFunctionInfo> function_info) {
368 HandleScope scope; 369 HandleScope scope;
369 SetFirstTable(TablePut(source, function_info)); 370 SetFirstTable(TablePut(source, function_info));
370 } 371 }
371 372
372 373
373 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( 374 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
374 Handle<String> source, Handle<Context> context) { 375 Handle<String> source,
376 Handle<Context> context,
377 StrictModeFlag strict_mode) {
375 // Make sure not to leak the table into the surrounding handle 378 // Make sure not to leak the table into the surrounding handle
376 // scope. Otherwise, we risk keeping old tables around even after 379 // scope. Otherwise, we risk keeping old tables around even after
377 // having cleared the cache. 380 // having cleared the cache.
378 Object* result = NULL; 381 Object* result = NULL;
379 int generation; 382 int generation;
380 { HandleScope scope; 383 { HandleScope scope;
381 for (generation = 0; generation < generations(); generation++) { 384 for (generation = 0; generation < generations(); generation++) {
382 Handle<CompilationCacheTable> table = GetTable(generation); 385 Handle<CompilationCacheTable> table = GetTable(generation);
383 result = table->LookupEval(*source, *context); 386 result = table->LookupEval(*source, *context, strict_mode);
384 if (result->IsSharedFunctionInfo()) { 387 if (result->IsSharedFunctionInfo()) {
385 break; 388 break;
386 } 389 }
387 } 390 }
388 } 391 }
389 if (result->IsSharedFunctionInfo()) { 392 if (result->IsSharedFunctionInfo()) {
390 Handle<SharedFunctionInfo> 393 Handle<SharedFunctionInfo>
391 function_info(SharedFunctionInfo::cast(result)); 394 function_info(SharedFunctionInfo::cast(result));
392 if (generation != 0) { 395 if (generation != 0) {
393 Put(source, context, function_info); 396 Put(source, context, function_info);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 int line_offset, 499 int line_offset,
497 int column_offset) { 500 int column_offset) {
498 if (!IsEnabled()) { 501 if (!IsEnabled()) {
499 return Handle<SharedFunctionInfo>::null(); 502 return Handle<SharedFunctionInfo>::null();
500 } 503 }
501 504
502 return script.Lookup(source, name, line_offset, column_offset); 505 return script.Lookup(source, name, line_offset, column_offset);
503 } 506 }
504 507
505 508
506 Handle<SharedFunctionInfo> CompilationCache::LookupEval(Handle<String> source, 509 Handle<SharedFunctionInfo> CompilationCache::LookupEval(
507 Handle<Context> context, 510 Handle<String> source,
508 bool is_global) { 511 Handle<Context> context,
512 bool is_global,
513 StrictModeFlag strict_mode) {
509 if (!IsEnabled()) { 514 if (!IsEnabled()) {
510 return Handle<SharedFunctionInfo>::null(); 515 return Handle<SharedFunctionInfo>::null();
511 } 516 }
512 517
513 Handle<SharedFunctionInfo> result; 518 Handle<SharedFunctionInfo> result;
514 if (is_global) { 519 if (is_global) {
515 result = eval_global.Lookup(source, context); 520 result = eval_global.Lookup(source, context, strict_mode);
516 } else { 521 } else {
517 result = eval_contextual.Lookup(source, context); 522 result = eval_contextual.Lookup(source, context, strict_mode);
518 } 523 }
519 return result; 524 return result;
520 } 525 }
521 526
522 527
523 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, 528 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
524 JSRegExp::Flags flags) { 529 JSRegExp::Flags flags) {
525 if (!IsEnabled()) { 530 if (!IsEnabled()) {
526 return Handle<FixedArray>::null(); 531 return Handle<FixedArray>::null();
527 } 532 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 645 }
641 646
642 647
643 void CompilationCache::Disable() { 648 void CompilationCache::Disable() {
644 enabled = false; 649 enabled = false;
645 Clear(); 650 Clear();
646 } 651 }
647 652
648 653
649 } } // namespace v8::internal 654 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698