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

Side by Side Diff: src/compiler.cc

Issue 678843004: Use shared function info for eval cache key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/compiler.h ('k') | src/compiler/ast-graph-builder.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone()); 1089 live_edit_tracker.RecordFunctionInfo(result, lit, info->zone());
1090 } 1090 }
1091 1091
1092 isolate->debug()->OnAfterCompile(script); 1092 isolate->debug()->OnAfterCompile(script);
1093 1093
1094 return result; 1094 return result;
1095 } 1095 }
1096 1096
1097 1097
1098 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( 1098 MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
1099 Handle<String> source, 1099 Handle<String> source, Handle<SharedFunctionInfo> outer_info,
1100 Handle<Context> context, 1100 Handle<Context> context, StrictMode strict_mode,
1101 StrictMode strict_mode, 1101 ParseRestriction restriction, int scope_position) {
1102 ParseRestriction restriction,
1103 int scope_position) {
1104 Isolate* isolate = source->GetIsolate(); 1102 Isolate* isolate = source->GetIsolate();
1105 int source_length = source->length(); 1103 int source_length = source->length();
1106 isolate->counters()->total_eval_size()->Increment(source_length); 1104 isolate->counters()->total_eval_size()->Increment(source_length);
1107 isolate->counters()->total_compile_size()->Increment(source_length); 1105 isolate->counters()->total_compile_size()->Increment(source_length);
1108 1106
1109 CompilationCache* compilation_cache = isolate->compilation_cache(); 1107 CompilationCache* compilation_cache = isolate->compilation_cache();
1110 MaybeHandle<SharedFunctionInfo> maybe_shared_info = 1108 MaybeHandle<SharedFunctionInfo> maybe_shared_info =
1111 compilation_cache->LookupEval(source, context, strict_mode, 1109 compilation_cache->LookupEval(source, outer_info, context, strict_mode,
1112 scope_position); 1110 scope_position);
1113 Handle<SharedFunctionInfo> shared_info; 1111 Handle<SharedFunctionInfo> shared_info;
1114 1112
1115 if (!maybe_shared_info.ToHandle(&shared_info)) { 1113 if (!maybe_shared_info.ToHandle(&shared_info)) {
1116 Handle<Script> script = isolate->factory()->NewScript(source); 1114 Handle<Script> script = isolate->factory()->NewScript(source);
1117 CompilationInfoWithZone info(script); 1115 CompilationInfoWithZone info(script);
1118 info.MarkAsEval(); 1116 info.MarkAsEval();
1119 if (context->IsNativeContext()) info.MarkAsGlobal(); 1117 if (context->IsNativeContext()) info.MarkAsGlobal();
1120 info.SetStrictMode(strict_mode); 1118 info.SetStrictMode(strict_mode);
1121 info.SetParseRestriction(restriction); 1119 info.SetParseRestriction(restriction);
1122 info.SetContext(context); 1120 info.SetContext(context);
1123 1121
1124 Debug::RecordEvalCaller(script); 1122 Debug::RecordEvalCaller(script);
1125 1123
1126 shared_info = CompileToplevel(&info); 1124 shared_info = CompileToplevel(&info);
1127 1125
1128 if (shared_info.is_null()) { 1126 if (shared_info.is_null()) {
1129 return MaybeHandle<JSFunction>(); 1127 return MaybeHandle<JSFunction>();
1130 } else { 1128 } else {
1131 // Explicitly disable optimization for eval code. We're not yet prepared 1129 // Explicitly disable optimization for eval code. We're not yet prepared
1132 // to handle eval-code in the optimizing compiler. 1130 // to handle eval-code in the optimizing compiler.
1133 shared_info->DisableOptimization(kEval); 1131 shared_info->DisableOptimization(kEval);
1134 1132
1135 // If caller is strict mode, the result must be in strict mode as well. 1133 // If caller is strict mode, the result must be in strict mode as well.
1136 DCHECK(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT); 1134 DCHECK(strict_mode == SLOPPY || shared_info->strict_mode() == STRICT);
1137 if (!shared_info->dont_cache()) { 1135 if (!shared_info->dont_cache()) {
1138 compilation_cache->PutEval( 1136 compilation_cache->PutEval(source, outer_info, context, shared_info,
1139 source, context, shared_info, scope_position); 1137 scope_position);
1140 } 1138 }
1141 } 1139 }
1142 } else if (shared_info->ic_age() != isolate->heap()->global_ic_age()) { 1140 } else if (shared_info->ic_age() != isolate->heap()->global_ic_age()) {
1143 shared_info->ResetForNewContext(isolate->heap()->global_ic_age()); 1141 shared_info->ResetForNewContext(isolate->heap()->global_ic_age());
1144 } 1142 }
1145 1143
1146 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 1144 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
1147 shared_info, context, NOT_TENURED); 1145 shared_info, context, NOT_TENURED);
1148 } 1146 }
1149 1147
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 AllowHandleDereference allow_deref; 1455 AllowHandleDereference allow_deref;
1458 bool tracing_on = info()->IsStub() 1456 bool tracing_on = info()->IsStub()
1459 ? FLAG_trace_hydrogen_stubs 1457 ? FLAG_trace_hydrogen_stubs
1460 : (FLAG_trace_hydrogen && 1458 : (FLAG_trace_hydrogen &&
1461 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1459 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1462 return (tracing_on && 1460 return (tracing_on &&
1463 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1461 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1464 } 1462 }
1465 1463
1466 } } // namespace v8::internal 1464 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698