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

Side by Side Diff: src/compiler.cc

Issue 2645403002: [Compiler] Enable use of seperate zones for parsing and compiling. (Closed)
Patch Set: Created 3 years, 11 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
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 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // Checks whether top level functions should be passed by the filter. 368 // Checks whether top level functions should be passed by the filter.
369 if (shared->is_toplevel()) { 369 if (shared->is_toplevel()) {
370 Vector<const char> filter = CStrVector(FLAG_ignition_filter); 370 Vector<const char> filter = CStrVector(FLAG_ignition_filter);
371 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); 371 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
372 } 372 }
373 373
374 // Finally respect the filter. 374 // Finally respect the filter.
375 return shared->PassesFilter(FLAG_ignition_filter); 375 return shared->PassesFilter(FLAG_ignition_filter);
376 } 376 }
377 377
378 bool UseAsmWasm(DeclarationScope* scope, Handle<SharedFunctionInfo> shared_info,
379 bool is_debug) {
380 return FLAG_validate_asm && scope->asm_module() &&
381 !shared_info->is_asm_wasm_broken() && !is_debug;
382 }
383
378 CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) { 384 CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) {
379 // Function should have been parsed and analyzed before creating a compilation 385 // Function should have been parsed and analyzed before creating a compilation
380 // job. 386 // job.
381 DCHECK_NOT_NULL(info->literal()); 387 DCHECK_NOT_NULL(info->literal());
382 DCHECK_NOT_NULL(info->scope()); 388 DCHECK_NOT_NULL(info->scope());
383 389
384 if (ShouldUseIgnition(info)) { 390 if (ShouldUseIgnition(info)) {
385 return interpreter::Interpreter::NewCompilationJob(info); 391 return interpreter::Interpreter::NewCompilationJob(info);
386 } else { 392 } else {
387 return FullCodeGenerator::NewCompilationJob(info); 393 return FullCodeGenerator::NewCompilationJob(info);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 return false; 461 return false;
456 } 462 }
457 if (!parse_info->shared_info().is_null()) { 463 if (!parse_info->shared_info().is_null()) {
458 SetSharedFunctionFlagsFromLiteral(parse_info->literal(), 464 SetSharedFunctionFlagsFromLiteral(parse_info->literal(),
459 parse_info->shared_info()); 465 parse_info->shared_info());
460 } 466 }
461 return true; 467 return true;
462 } 468 }
463 469
464 bool GenerateUnoptimizedCode(CompilationInfo* info) { 470 bool GenerateUnoptimizedCode(CompilationInfo* info) {
465 if (FLAG_validate_asm && info->scope()->asm_module() && 471 if (UseAsmWasm(info->scope(), info->shared_info(), info->is_debug())) {
466 !info->shared_info()->is_asm_wasm_broken() && !info->is_debug()) {
467 EnsureFeedbackMetadata(info); 472 EnsureFeedbackMetadata(info);
468 MaybeHandle<FixedArray> wasm_data; 473 MaybeHandle<FixedArray> wasm_data;
469 wasm_data = AsmJs::CompileAsmViaWasm(info); 474 wasm_data = AsmJs::CompileAsmViaWasm(info);
470 if (!wasm_data.is_null()) { 475 if (!wasm_data.is_null()) {
471 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked()); 476 info->shared_info()->set_asm_wasm_data(*wasm_data.ToHandleChecked());
472 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs()); 477 info->SetCode(info->isolate()->builtins()->InstantiateAsmJs());
473 InstallUnoptimizedCode(info); 478 InstallUnoptimizedCode(info);
474 return true; 479 return true;
475 } 480 }
476 } 481 }
(...skipping 28 matching lines...) Expand all
505 510
506 ParseInfo parse_info(script); 511 ParseInfo parse_info(script);
507 parse_info.set_literal(literal); 512 parse_info.set_literal(literal);
508 parse_info.set_shared_info(shared); 513 parse_info.set_shared_info(shared);
509 parse_info.set_function_literal_id(shared->function_literal_id()); 514 parse_info.set_function_literal_id(shared->function_literal_id());
510 parse_info.set_language_mode(literal->scope()->language_mode()); 515 parse_info.set_language_mode(literal->scope()->language_mode());
511 parse_info.set_ast_value_factory( 516 parse_info.set_ast_value_factory(
512 outer_info->parse_info()->ast_value_factory()); 517 outer_info->parse_info()->ast_value_factory());
513 parse_info.set_ast_value_factory_owned(false); 518 parse_info.set_ast_value_factory_owned(false);
514 519
515 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 520 Zone compile_zone(isolate->allocator(), ZONE_NAME);
521 CompilationInfo info(&compile_zone, &parse_info,
522 Handle<JSFunction>::null());
516 if (outer_info->will_serialize()) info.PrepareForSerializing(); 523 if (outer_info->will_serialize()) info.PrepareForSerializing();
517 if (outer_info->is_debug()) info.MarkAsDebug(); 524 if (outer_info->is_debug()) info.MarkAsDebug();
518 525
519 if (!GenerateUnoptimizedCode(&info)) { 526 if (!GenerateUnoptimizedCode(&info)) {
520 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 527 if (!isolate->has_pending_exception()) isolate->StackOverflow();
521 return false; 528 return false;
522 } 529 }
523 530
524 DCHECK(!info.code().is_null()); 531 DCHECK(!info.code().is_null());
525 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, &info); 532 RecordFunctionCompilation(CodeEventListener::FUNCTION_TAG, &info);
526 if (literal->should_be_used_once_hint()) { 533 if (literal->should_be_used_once_hint()) {
527 info.code()->MarkToBeExecutedOnce(isolate); 534 info.code()->MarkToBeExecutedOnce(isolate);
528 } 535 }
529 } 536 }
530 return true; 537 return true;
531 } 538 }
532 539
540 bool InnerFunctionIsAsmModule(
541 ThreadedList<ThreadedListZoneEntry<FunctionLiteral*>>* literals) {
542 for (auto it : *literals) {
543 FunctionLiteral* literal = it->value();
544 if (literal->scope()->IsAsmModule()) return true;
545 }
546 return false;
547 }
548
533 bool CompileUnoptimizedCode(CompilationInfo* info) { 549 bool CompileUnoptimizedCode(CompilationInfo* info) {
534 Isolate* isolate = info->isolate(); 550 Isolate* isolate = info->isolate();
535 DCHECK(AllowCompilation::IsAllowed(isolate)); 551 DCHECK(AllowCompilation::IsAllowed(isolate));
536 552
537 Compiler::EagerInnerFunctionLiterals inner_literals; 553 Compiler::EagerInnerFunctionLiterals inner_literals;
538 if (!Compiler::Analyze(info->parse_info(), &inner_literals) || 554 if (!Compiler::Analyze(info->parse_info(), &inner_literals)) {
539 !CompileUnoptimizedInnerFunctions(&inner_literals, info) || 555 if (!isolate->has_pending_exception()) isolate->StackOverflow();
556 return false;
557 }
558
559 // TODO(rmcilroy,bradnelson): Remove this UseAsmWasm check once the asm-wasm
560 // builder doesn't do parsing when visiting function declarations.
561 if (!info->scope()->IsAsmModule() &&
562 !InnerFunctionIsAsmModule(&inner_literals)) {
rmcilroy 2017/01/23 15:54:35 I'm going to send out a separate mail to figure ou
563 // Seal the parse zone so that it can be shared by parallel inner function
564 // compilation jobs.
565 DCHECK_NE(info->parse_info()->zone(), info->zone());
566 info->parse_info()->zone()->Seal();
567 }
568
569 if (!CompileUnoptimizedInnerFunctions(&inner_literals, info) ||
540 !GenerateUnoptimizedCode(info)) { 570 !GenerateUnoptimizedCode(info)) {
541 if (!isolate->has_pending_exception()) isolate->StackOverflow(); 571 if (!isolate->has_pending_exception()) isolate->StackOverflow();
542 return false; 572 return false;
543 } 573 }
544 574
545 return true; 575 return true;
546 } 576 }
547 577
548 void EnsureSharedFunctionInfosArrayOnScript(ParseInfo* info) { 578 void EnsureSharedFunctionInfosArrayOnScript(ParseInfo* info) {
549 DCHECK(info->is_toplevel()); 579 DCHECK(info->is_toplevel());
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 911 }
882 info->closure()->ReplaceCode(shared->code()); 912 info->closure()->ReplaceCode(shared->code());
883 return CompilationJob::FAILED; 913 return CompilationJob::FAILED;
884 } 914 }
885 915
886 MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) { 916 MaybeHandle<Code> GetBaselineCode(Handle<JSFunction> function) {
887 Isolate* isolate = function->GetIsolate(); 917 Isolate* isolate = function->GetIsolate();
888 VMState<COMPILER> state(isolate); 918 VMState<COMPILER> state(isolate);
889 PostponeInterruptsScope postpone(isolate); 919 PostponeInterruptsScope postpone(isolate);
890 ParseInfo parse_info(handle(function->shared())); 920 ParseInfo parse_info(handle(function->shared()));
891 CompilationInfo info(&parse_info, function); 921 Zone compile_zone(isolate->allocator(), ZONE_NAME);
922 CompilationInfo info(&compile_zone, &parse_info, function);
892 923
893 DCHECK(function->shared()->is_compiled()); 924 DCHECK(function->shared()->is_compiled());
894 925
895 // Function no longer needs to be tiered up 926 // Function no longer needs to be tiered up
896 function->shared()->set_marked_for_tier_up(false); 927 function->shared()->set_marked_for_tier_up(false);
897 928
898 // Reset profiler ticks, function is no longer considered hot. 929 // Reset profiler ticks, function is no longer considered hot.
899 if (function->shared()->HasBytecodeArray()) { 930 if (function->shared()->HasBytecodeArray()) {
900 function->shared()->set_profiler_ticks(0); 931 function->shared()->set_profiler_ticks(0);
901 } 932 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 return Handle<Code>(function->shared()->code()); 1045 return Handle<Code>(function->shared()->code());
1015 } 1046 }
1016 1047
1017 if (function->shared()->HasBytecodeArray()) { 1048 if (function->shared()->HasBytecodeArray()) {
1018 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline(); 1049 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline();
1019 function->shared()->ReplaceCode(*entry); 1050 function->shared()->ReplaceCode(*entry);
1020 return entry; 1051 return entry;
1021 } 1052 }
1022 1053
1023 ParseInfo parse_info(handle(function->shared())); 1054 ParseInfo parse_info(handle(function->shared()));
1024 CompilationInfo info(&parse_info, function); 1055 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1056 CompilationInfo info(&compile_zone, &parse_info, function);
1025 Handle<Code> result; 1057 Handle<Code> result;
1026 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCode(&info), Code); 1058 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCode(&info), Code);
1027 1059
1028 if (FLAG_always_opt && !info.shared_info()->HasAsmWasmData()) { 1060 if (FLAG_always_opt && !info.shared_info()->HasAsmWasmData()) {
1029 Handle<Code> opt_code; 1061 Handle<Code> opt_code;
1030 if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT) 1062 if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT)
1031 .ToHandle(&opt_code)) { 1063 .ToHandle(&opt_code)) {
1032 result = opt_code; 1064 result = opt_code;
1033 } 1065 }
1034 } 1066 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 if (!GetOptimizedCode(function, mode).ToHandle(&code)) { 1225 if (!GetOptimizedCode(function, mode).ToHandle(&code)) {
1194 // Optimization failed, get unoptimized code. 1226 // Optimization failed, get unoptimized code.
1195 DCHECK(!isolate->has_pending_exception()); 1227 DCHECK(!isolate->has_pending_exception());
1196 if (function->shared()->is_compiled()) { 1228 if (function->shared()->is_compiled()) {
1197 code = handle(function->shared()->code(), isolate); 1229 code = handle(function->shared()->code(), isolate);
1198 } else if (function->shared()->HasBytecodeArray()) { 1230 } else if (function->shared()->HasBytecodeArray()) {
1199 code = isolate->builtins()->InterpreterEntryTrampoline(); 1231 code = isolate->builtins()->InterpreterEntryTrampoline();
1200 function->shared()->ReplaceCode(*code); 1232 function->shared()->ReplaceCode(*code);
1201 } else { 1233 } else {
1202 ParseInfo parse_info(handle(function->shared())); 1234 ParseInfo parse_info(handle(function->shared()));
1203 CompilationInfo info(&parse_info, function); 1235 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1236 CompilationInfo info(&compile_zone, &parse_info, function);
1204 if (!GetUnoptimizedCode(&info).ToHandle(&code)) { 1237 if (!GetUnoptimizedCode(&info).ToHandle(&code)) {
1205 return false; 1238 return false;
1206 } 1239 }
1207 } 1240 }
1208 } 1241 }
1209 1242
1210 // Install code on closure. 1243 // Install code on closure.
1211 function->ReplaceCode(*code); 1244 function->ReplaceCode(*code);
1212 JSFunction::EnsureLiterals(function); 1245 JSFunction::EnsureLiterals(function);
1213 1246
1214 // Check postconditions on success. 1247 // Check postconditions on success.
1215 DCHECK(!isolate->has_pending_exception()); 1248 DCHECK(!isolate->has_pending_exception());
1216 DCHECK(function->shared()->is_compiled()); 1249 DCHECK(function->shared()->is_compiled());
1217 DCHECK(function->is_compiled()); 1250 DCHECK(function->is_compiled());
1218 return true; 1251 return true;
1219 } 1252 }
1220 1253
1221 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { 1254 bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) {
1222 Isolate* isolate = shared->GetIsolate(); 1255 Isolate* isolate = shared->GetIsolate();
1223 DCHECK(AllowCompilation::IsAllowed(isolate)); 1256 DCHECK(AllowCompilation::IsAllowed(isolate));
1224 1257
1225 // Start a compilation. 1258 // Start a compilation.
1226 ParseInfo parse_info(shared); 1259 ParseInfo parse_info(shared);
1227 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1260 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1261 CompilationInfo info(&compile_zone, &parse_info, Handle<JSFunction>::null());
1228 info.MarkAsDebug(); 1262 info.MarkAsDebug();
1229 if (GetUnoptimizedCode(&info).is_null()) { 1263 if (GetUnoptimizedCode(&info).is_null()) {
1230 isolate->clear_pending_exception(); 1264 isolate->clear_pending_exception();
1231 return false; 1265 return false;
1232 } 1266 }
1233 1267
1234 // Check postconditions on success. 1268 // Check postconditions on success.
1235 DCHECK(!isolate->has_pending_exception()); 1269 DCHECK(!isolate->has_pending_exception());
1236 DCHECK(shared->is_compiled()); 1270 DCHECK(shared->is_compiled());
1237 DCHECK(shared->HasDebugCode()); 1271 DCHECK(shared->HasDebugCode());
1238 return true; 1272 return true;
1239 } 1273 }
1240 1274
1241 MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) { 1275 MaybeHandle<JSArray> Compiler::CompileForLiveEdit(Handle<Script> script) {
1242 Isolate* isolate = script->GetIsolate(); 1276 Isolate* isolate = script->GetIsolate();
1243 DCHECK(AllowCompilation::IsAllowed(isolate)); 1277 DCHECK(AllowCompilation::IsAllowed(isolate));
1244 1278
1245 // In order to ensure that live edit function info collection finds the newly 1279 // In order to ensure that live edit function info collection finds the newly
1246 // generated shared function infos, clear the script's list temporarily 1280 // generated shared function infos, clear the script's list temporarily
1247 // and restore it at the end of this method. 1281 // and restore it at the end of this method.
1248 Handle<FixedArray> old_function_infos(script->shared_function_infos(), 1282 Handle<FixedArray> old_function_infos(script->shared_function_infos(),
1249 isolate); 1283 isolate);
1250 script->set_shared_function_infos(isolate->heap()->empty_fixed_array()); 1284 script->set_shared_function_infos(isolate->heap()->empty_fixed_array());
1251 1285
1252 // Start a compilation. 1286 // Start a compilation.
1253 ParseInfo parse_info(script); 1287 ParseInfo parse_info(script);
1254 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1288 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1289 CompilationInfo info(&compile_zone, &parse_info, Handle<JSFunction>::null());
1255 info.MarkAsDebug(); 1290 info.MarkAsDebug();
1256 1291
1257 // TODO(635): support extensions. 1292 // TODO(635): support extensions.
1258 const bool compilation_succeeded = !CompileToplevel(&info).is_null(); 1293 const bool compilation_succeeded = !CompileToplevel(&info).is_null();
1259 Handle<JSArray> infos; 1294 Handle<JSArray> infos;
1260 if (compilation_succeeded) { 1295 if (compilation_succeeded) {
1261 // Check postconditions on success. 1296 // Check postconditions on success.
1262 DCHECK(!isolate->has_pending_exception()); 1297 DCHECK(!isolate->has_pending_exception());
1263 infos = LiveEditFunctionTracker::Collect(parse_info.literal(), script, 1298 infos = LiveEditFunctionTracker::Collect(parse_info.literal(), script,
1264 parse_info.zone(), isolate); 1299 parse_info.zone(), isolate);
(...skipping 19 matching lines...) Expand all
1284 return info->shared_info()->HasBytecodeArray(); 1319 return info->shared_info()->HasBytecodeArray();
1285 } 1320 }
1286 1321
1287 // TODO(turbofan): In the future, unoptimized code with deopt support could 1322 // TODO(turbofan): In the future, unoptimized code with deopt support could
1288 // be generated lazily once deopt is triggered. 1323 // be generated lazily once deopt is triggered.
1289 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { 1324 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
1290 DCHECK_NOT_NULL(info->literal()); 1325 DCHECK_NOT_NULL(info->literal());
1291 DCHECK_NOT_NULL(info->scope()); 1326 DCHECK_NOT_NULL(info->scope());
1292 Handle<SharedFunctionInfo> shared = info->shared_info(); 1327 Handle<SharedFunctionInfo> shared = info->shared_info();
1293 if (!shared->has_deoptimization_support()) { 1328 if (!shared->has_deoptimization_support()) {
1294 Zone zone(info->isolate()->allocator(), ZONE_NAME); 1329 Zone compile_zone(info->isolate()->allocator(), ZONE_NAME);
1295 CompilationInfo unoptimized(info->parse_info(), info->closure()); 1330 CompilationInfo unoptimized(&compile_zone, info->parse_info(),
1331 info->closure());
1296 unoptimized.EnableDeoptimizationSupport(); 1332 unoptimized.EnableDeoptimizationSupport();
1297 1333
1298 // Don't generate full-codegen code for functions it can't support. 1334 // Don't generate full-codegen code for functions it can't support.
1299 if (shared->must_use_ignition_turbo()) return false; 1335 if (shared->must_use_ignition_turbo()) return false;
1300 DCHECK(!IsResumableFunction(shared->kind())); 1336 DCHECK(!IsResumableFunction(shared->kind()));
1301 1337
1302 // When we call PrepareForSerializing below, we will change the shared 1338 // When we call PrepareForSerializing below, we will change the shared
1303 // ParseInfo. Make sure to reset it. 1339 // ParseInfo. Make sure to reset it.
1304 bool old_will_serialize_value = info->parse_info()->will_serialize(); 1340 bool old_will_serialize_value = info->parse_info()->will_serialize();
1305 1341
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 if (!script_name.is_null()) { 1415 if (!script_name.is_null()) {
1380 script->set_name(*script_name); 1416 script->set_name(*script_name);
1381 script->set_line_offset(line_offset); 1417 script->set_line_offset(line_offset);
1382 script->set_column_offset(column_offset); 1418 script->set_column_offset(column_offset);
1383 } 1419 }
1384 script->set_origin_options(options); 1420 script->set_origin_options(options);
1385 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); 1421 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
1386 Script::SetEvalOrigin(script, outer_info, eval_position); 1422 Script::SetEvalOrigin(script, outer_info, eval_position);
1387 1423
1388 ParseInfo parse_info(script); 1424 ParseInfo parse_info(script);
1389 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1425 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1426 CompilationInfo info(&compile_zone, &parse_info,
1427 Handle<JSFunction>::null());
1390 parse_info.set_eval(); 1428 parse_info.set_eval();
1391 parse_info.set_language_mode(language_mode); 1429 parse_info.set_language_mode(language_mode);
1392 parse_info.set_parse_restriction(restriction); 1430 parse_info.set_parse_restriction(restriction);
1393 if (!context->IsNativeContext()) { 1431 if (!context->IsNativeContext()) {
1394 parse_info.set_outer_scope_info(handle(context->scope_info())); 1432 parse_info.set_outer_scope_info(handle(context->scope_info()));
1395 } 1433 }
1396 1434
1397 shared_info = CompileToplevel(&info); 1435 shared_info = CompileToplevel(&info);
1398 1436
1399 if (shared_info.is_null()) { 1437 if (shared_info.is_null()) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 script->set_line_offset(line_offset); 1595 script->set_line_offset(line_offset);
1558 script->set_column_offset(column_offset); 1596 script->set_column_offset(column_offset);
1559 } 1597 }
1560 script->set_origin_options(resource_options); 1598 script->set_origin_options(resource_options);
1561 if (!source_map_url.is_null()) { 1599 if (!source_map_url.is_null()) {
1562 script->set_source_mapping_url(*source_map_url); 1600 script->set_source_mapping_url(*source_map_url);
1563 } 1601 }
1564 1602
1565 // Compile the function and add it to the cache. 1603 // Compile the function and add it to the cache.
1566 ParseInfo parse_info(script); 1604 ParseInfo parse_info(script);
1567 CompilationInfo info(&parse_info, Handle<JSFunction>::null()); 1605 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1606 CompilationInfo info(&compile_zone, &parse_info,
1607 Handle<JSFunction>::null());
1568 if (resource_options.IsModule()) parse_info.set_module(); 1608 if (resource_options.IsModule()) parse_info.set_module();
1569 if (compile_options != ScriptCompiler::kNoCompileOptions) { 1609 if (compile_options != ScriptCompiler::kNoCompileOptions) {
1570 parse_info.set_cached_data(cached_data); 1610 parse_info.set_cached_data(cached_data);
1571 } 1611 }
1572 parse_info.set_compile_options(compile_options); 1612 parse_info.set_compile_options(compile_options);
1573 parse_info.set_extension(extension); 1613 parse_info.set_extension(extension);
1574 if (!context->IsNativeContext()) { 1614 if (!context->IsNativeContext()) {
1575 parse_info.set_outer_scope_info(handle(context->scope_info())); 1615 parse_info.set_outer_scope_info(handle(context->scope_info()));
1576 } 1616 }
1577 if (FLAG_serialize_toplevel && 1617 if (FLAG_serialize_toplevel &&
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 Handle<Script> script, ParseInfo* parse_info, int source_length) { 1658 Handle<Script> script, ParseInfo* parse_info, int source_length) {
1619 Isolate* isolate = script->GetIsolate(); 1659 Isolate* isolate = script->GetIsolate();
1620 // TODO(titzer): increment the counters in caller. 1660 // TODO(titzer): increment the counters in caller.
1621 isolate->counters()->total_load_size()->Increment(source_length); 1661 isolate->counters()->total_load_size()->Increment(source_length);
1622 isolate->counters()->total_compile_size()->Increment(source_length); 1662 isolate->counters()->total_compile_size()->Increment(source_length);
1623 1663
1624 LanguageMode language_mode = construct_language_mode(FLAG_use_strict); 1664 LanguageMode language_mode = construct_language_mode(FLAG_use_strict);
1625 parse_info->set_language_mode( 1665 parse_info->set_language_mode(
1626 static_cast<LanguageMode>(parse_info->language_mode() | language_mode)); 1666 static_cast<LanguageMode>(parse_info->language_mode() | language_mode));
1627 1667
1628 CompilationInfo compile_info(parse_info, Handle<JSFunction>::null()); 1668 Zone compile_zone(isolate->allocator(), ZONE_NAME);
1669 CompilationInfo compile_info(&compile_zone, parse_info,
1670 Handle<JSFunction>::null());
1629 1671
1630 // The source was parsed lazily, so compiling for debugging is not possible. 1672 // The source was parsed lazily, so compiling for debugging is not possible.
1631 DCHECK(!compile_info.is_debug()); 1673 DCHECK(!compile_info.is_debug());
1632 1674
1633 Handle<SharedFunctionInfo> result = CompileToplevel(&compile_info); 1675 Handle<SharedFunctionInfo> result = CompileToplevel(&compile_info);
1634 if (!result.is_null()) isolate->debug()->OnAfterCompile(script); 1676 if (!result.is_null()) isolate->debug()->OnAfterCompile(script);
1635 return result; 1677 return result;
1636 } 1678 }
1637 1679
1638 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo( 1680 Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 DCHECK(shared->is_compiled()); 1797 DCHECK(shared->is_compiled());
1756 function->set_literals(cached.literals); 1798 function->set_literals(cached.literals);
1757 } else if (shared->is_compiled()) { 1799 } else if (shared->is_compiled()) {
1758 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1800 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1759 JSFunction::EnsureLiterals(function); 1801 JSFunction::EnsureLiterals(function);
1760 } 1802 }
1761 } 1803 }
1762 1804
1763 } // namespace internal 1805 } // namespace internal
1764 } // namespace v8 1806 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698