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

Side by Side Diff: src/compiler.cc

Issue 2267693002: [interpreter] Allow mixed stacks if bytecode is preserved. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adapt test. Created 4 years, 3 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 | « no previous file | test/cctest/test-compiler.cc » ('j') | test/cctest/test-compiler.cc » ('J')
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 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 940
941 // TODO(4280): For now we do not switch generators or async functions to 941 // TODO(4280): For now we do not switch generators or async functions to
942 // baseline code because there might be suspended activations stored in 942 // baseline code because there might be suspended activations stored in
943 // generator objects on the heap. We could eventually go directly to 943 // generator objects on the heap. We could eventually go directly to
944 // TurboFan in this case. 944 // TurboFan in this case.
945 if (function->shared()->is_resumable()) { 945 if (function->shared()->is_resumable()) {
946 return MaybeHandle<Code>(); 946 return MaybeHandle<Code>();
947 } 947 }
948 948
949 // TODO(4280): For now we disable switching to baseline code in the presence 949 // TODO(4280): For now we disable switching to baseline code in the presence
950 // of interpreter activations of the given function. The reasons are: 950 // of interpreter activations of the given function. The reasons is that the
951 // 1) The debugger assumes each function is either full-code or bytecode. 951 // underlying bytecode is cleared below.
rmcilroy 2016/08/22 15:33:03 nit - could you update the comment to mention we o
Michael Starzinger 2016/08/22 15:44:22 Done.
952 // 2) The underlying bytecode is cleared below, breaking stack unwinding. 952 if (!FLAG_ignition_preserve_bytecode) {
953 InterpreterActivationsFinder activations_finder(function->shared()); 953 InterpreterActivationsFinder activations_finder(function->shared());
954 if (HasInterpreterActivations(isolate, &activations_finder)) { 954 if (HasInterpreterActivations(isolate, &activations_finder)) {
955 if (FLAG_trace_opt) {
956 OFStream os(stdout);
957 os << "[unable to switch " << Brief(*function) << " due to activations]"
958 << std::endl;
959 }
960
961 if (activations_finder.MarkActivationsForBaselineOnReturn(isolate)) {
962 if (FLAG_trace_opt) { 955 if (FLAG_trace_opt) {
963 OFStream os(stdout); 956 OFStream os(stdout);
964 os << "[marking " << Brief(function->shared()) 957 os << "[unable to switch " << Brief(*function) << " due to activations]"
965 << " for baseline recompilation on return]" << std::endl; 958 << std::endl;
966 } 959 }
960
961 if (activations_finder.MarkActivationsForBaselineOnReturn(isolate)) {
962 if (FLAG_trace_opt) {
963 OFStream os(stdout);
964 os << "[marking " << Brief(function->shared())
965 << " for baseline recompilation on return]" << std::endl;
966 }
967 }
968
969 return MaybeHandle<Code>();
967 } 970 }
968
969 return MaybeHandle<Code>();
970 } 971 }
971 972
972 if (FLAG_trace_opt) { 973 if (FLAG_trace_opt) {
973 OFStream os(stdout); 974 OFStream os(stdout);
974 os << "[switching method " << Brief(*function) << " to baseline code]" 975 os << "[switching method " << Brief(*function) << " to baseline code]"
975 << std::endl; 976 << std::endl;
976 } 977 }
977 978
978 // Parse and update CompilationInfo with the results. 979 // Parse and update CompilationInfo with the results.
979 if (!Parser::ParseStatic(info.parse_info())) return MaybeHandle<Code>(); 980 if (!Parser::ParseStatic(info.parse_info())) return MaybeHandle<Code>();
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 CompilationInfo unoptimized(info->parse_info(), info->closure()); 1408 CompilationInfo unoptimized(info->parse_info(), info->closure());
1408 unoptimized.EnableDeoptimizationSupport(); 1409 unoptimized.EnableDeoptimizationSupport();
1409 1410
1410 // TODO(4280): For now we do not switch generators or async functions to 1411 // TODO(4280): For now we do not switch generators or async functions to
1411 // baseline code because there might be suspended activations stored in 1412 // baseline code because there might be suspended activations stored in
1412 // generator objects on the heap. We could eventually go directly to 1413 // generator objects on the heap. We could eventually go directly to
1413 // TurboFan in this case. 1414 // TurboFan in this case.
1414 if (shared->is_resumable()) return false; 1415 if (shared->is_resumable()) return false;
1415 1416
1416 // TODO(4280): For now we disable switching to baseline code in the presence 1417 // TODO(4280): For now we disable switching to baseline code in the presence
1417 // of interpreter activations of the given function. The reasons are: 1418 // of interpreter activations of the given function. The reasons is that the
1418 // 1) The debugger assumes each function is either full-code or bytecode. 1419 // underlying bytecode is cleared below. The expensive check for activations
1419 // 2) The underlying bytecode is cleared below, breaking stack unwinding. 1420 // only needs to be done when the given function has bytecode, otherwise we
1420 // The expensive check for activations only needs to be done when the given 1421 // can be sure there are no activations.
rmcilroy 2016/08/22 15:33:03 And here
Michael Starzinger 2016/08/22 15:44:22 Done.
1421 // function has bytecode, otherwise we can be sure there are no activations. 1422 if (!FLAG_ignition_preserve_bytecode && shared->HasBytecodeArray()) {
1422 if (shared->HasBytecodeArray()) {
1423 InterpreterActivationsFinder activations_finder(*shared); 1423 InterpreterActivationsFinder activations_finder(*shared);
1424 if (HasInterpreterActivations(info->isolate(), &activations_finder)) { 1424 if (HasInterpreterActivations(info->isolate(), &activations_finder)) {
1425 return false; 1425 return false;
1426 } 1426 }
1427 } 1427 }
1428 1428
1429 // If the current code has reloc info for serialization, also include 1429 // If the current code has reloc info for serialization, also include
1430 // reloc info for serialization for the new code, so that deopt support 1430 // reloc info for serialization for the new code, so that deopt support
1431 // can be added without losing IC state. 1431 // can be added without losing IC state.
1432 if (shared->code()->kind() == Code::FUNCTION && 1432 if (shared->code()->kind() == Code::FUNCTION &&
1433 shared->code()->has_reloc_info_for_serialization()) { 1433 shared->code()->has_reloc_info_for_serialization()) {
1434 unoptimized.PrepareForSerializing(); 1434 unoptimized.PrepareForSerializing();
1435 } 1435 }
1436 EnsureFeedbackMetadata(&unoptimized); 1436 EnsureFeedbackMetadata(&unoptimized);
1437 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; 1437 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false;
1438 1438
1439 // TODO(4280): For now we play it safe and remove the bytecode array when we 1439 // TODO(4280): For now we play it safe and remove the bytecode array when we
1440 // switch to baseline code. We might consider keeping around the bytecode so 1440 // switch to baseline code. We might consider keeping around the bytecode so
1441 // that it can be used as the "source of truth" eventually. 1441 // that it can be used as the "source of truth" eventually.
rmcilroy 2016/08/22 15:33:03 nit - could you update the comment
Michael Starzinger 2016/08/22 15:44:23 Done.
1442 if (shared->HasBytecodeArray()) { 1442 if (!FLAG_ignition_preserve_bytecode && shared->HasBytecodeArray()) {
1443 if (!FLAG_ignition_preserve_bytecode) shared->ClearBytecodeArray(); 1443 shared->ClearBytecodeArray();
1444 } 1444 }
1445 1445
1446 // The scope info might not have been set if a lazily compiled 1446 // The scope info might not have been set if a lazily compiled
1447 // function is inlined before being called for the first time. 1447 // function is inlined before being called for the first time.
1448 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { 1448 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) {
1449 InstallSharedScopeInfo(info, shared); 1449 InstallSharedScopeInfo(info, shared);
1450 } 1450 }
1451 1451
1452 // Install compilation result on the shared function info 1452 // Install compilation result on the shared function info
1453 shared->EnableDeoptimizationSupport(*unoptimized.code()); 1453 shared->EnableDeoptimizationSupport(*unoptimized.code());
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 DCHECK(shared->is_compiled()); 1966 DCHECK(shared->is_compiled());
1967 function->set_literals(cached.literals); 1967 function->set_literals(cached.literals);
1968 } else if (shared->is_compiled()) { 1968 } else if (shared->is_compiled()) {
1969 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1969 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1970 JSFunction::EnsureLiterals(function); 1970 JSFunction::EnsureLiterals(function);
1971 } 1971 }
1972 } 1972 }
1973 1973
1974 } // namespace internal 1974 } // namespace internal
1975 } // namespace v8 1975 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-compiler.cc » ('j') | test/cctest/test-compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698