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

Side by Side Diff: src/compiler.cc

Issue 1903463002: Make global eval faster by lazily computing its call position. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « src/builtins.cc ('k') | src/objects.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 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/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/ast/ast-numbering.h" 9 #include "src/ast/ast-numbering.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 ParseRestriction restriction, int eval_scope_position, int eval_position, 1239 ParseRestriction restriction, int eval_scope_position, int eval_position,
1240 int line_offset, int column_offset, Handle<Object> script_name, 1240 int line_offset, int column_offset, Handle<Object> script_name,
1241 ScriptOriginOptions options) { 1241 ScriptOriginOptions options) {
1242 Isolate* isolate = source->GetIsolate(); 1242 Isolate* isolate = source->GetIsolate();
1243 int source_length = source->length(); 1243 int source_length = source->length();
1244 isolate->counters()->total_eval_size()->Increment(source_length); 1244 isolate->counters()->total_eval_size()->Increment(source_length);
1245 isolate->counters()->total_compile_size()->Increment(source_length); 1245 isolate->counters()->total_compile_size()->Increment(source_length);
1246 1246
1247 CompilationCache* compilation_cache = isolate->compilation_cache(); 1247 CompilationCache* compilation_cache = isolate->compilation_cache();
1248 MaybeHandle<SharedFunctionInfo> maybe_shared_info = 1248 MaybeHandle<SharedFunctionInfo> maybe_shared_info =
1249 compilation_cache->LookupEval(source, outer_info, context, language_mode, 1249 compilation_cache->LookupEval(source, outer_info, context, language_mode,
Michael Starzinger 2016/04/19 13:39:32 This will perform a compilation cache lookup with
1250 eval_scope_position); 1250 eval_scope_position);
1251 Handle<SharedFunctionInfo> shared_info; 1251 Handle<SharedFunctionInfo> shared_info;
1252 1252
1253 Handle<Script> script; 1253 Handle<Script> script;
1254 if (!maybe_shared_info.ToHandle(&shared_info)) { 1254 if (!maybe_shared_info.ToHandle(&shared_info)) {
1255 script = isolate->factory()->NewScript(source); 1255 script = isolate->factory()->NewScript(source);
1256 if (!script_name.is_null()) { 1256 if (!script_name.is_null()) {
1257 script->set_name(*script_name); 1257 script->set_name(*script_name);
1258 script->set_line_offset(line_offset); 1258 script->set_line_offset(line_offset);
1259 script->set_column_offset(column_offset); 1259 script->set_column_offset(column_offset);
1260 } 1260 }
1261 script->set_origin_options(options); 1261 script->set_origin_options(options);
1262 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); 1262 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
1263 script->set_eval_from_shared(*outer_info); 1263 Script::SetEvalOrigin(script, outer_info, eval_position);
1264 script->set_eval_from_position(eval_position);
1265 1264
1266 Zone zone(isolate->allocator()); 1265 Zone zone(isolate->allocator());
1267 ParseInfo parse_info(&zone, script); 1266 ParseInfo parse_info(&zone, script);
1268 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1267 CompilationInfo info(&parse_info, Handle<JSFunction>::null());
1269 parse_info.set_eval(); 1268 parse_info.set_eval();
1270 if (context->IsNativeContext()) parse_info.set_global(); 1269 if (context->IsNativeContext()) parse_info.set_global();
1271 parse_info.set_language_mode(language_mode); 1270 parse_info.set_language_mode(language_mode);
1272 parse_info.set_parse_restriction(restriction); 1271 parse_info.set_parse_restriction(restriction);
1273 parse_info.set_context(context); 1272 parse_info.set_context(context);
1274 1273
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 MaybeHandle<Code> code; 1685 MaybeHandle<Code> code;
1687 if (cached.code != nullptr) code = handle(cached.code); 1686 if (cached.code != nullptr) code = handle(cached.code);
1688 Handle<Context> native_context(function->context()->native_context()); 1687 Handle<Context> native_context(function->context()->native_context());
1689 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 1688 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
1690 literals, BailoutId::None()); 1689 literals, BailoutId::None());
1691 } 1690 }
1692 } 1691 }
1693 1692
1694 } // namespace internal 1693 } // namespace internal
1695 } // namespace v8 1694 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698