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

Unified Diff: src/compiler/js-inlining.cc

Issue 1213383002: [turbofan] Disallow cross native context inlining. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-inlining.cc
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc
index 1251952ab0d1e8ab02b82dbe9025546297c9edb7..81bfd98fd5551f88d9a432a2b3335c0aef53ff66 100644
--- a/src/compiler/js-inlining.cc
+++ b/src/compiler/js-inlining.cc
@@ -251,6 +251,22 @@ Reduction JSInliner::Reduce(Node* node) {
return NoChange();
}
+ // Disallow cross native-context inlining for now. This means that all parts
+ // of the resulting code will operate on the same global object.
+ // This also prevents cross context leaks for asm.js code, where we could
+ // inline functions from a different context and hold on to that context (and
+ // closure) from the code object.
+ // TODO(turbofan): We might want to revisit this restriction later when we
+ // have a need for this, and we know how to model different native contexts
+ // in the same graph in a compositional way.
+ if (function->context()->native_context() !=
+ info_->context()->native_context()) {
+ TRACE("Not inlining %s into %s because of different native contexts\n",
+ function->shared()->DebugName()->ToCString().get(),
+ info_->shared_info()->DebugName()->ToCString().get());
+ return NoChange();
+ }
+
// TODO(turbofan): TranslatedState::GetAdaptedArguments() currently relies on
// not inlining recursive functions. We might want to relax that at some
// point.
@@ -278,7 +294,7 @@ Reduction JSInliner::Reduce(Node* node) {
if (info.scope()->arguments() != NULL && is_sloppy(info.language_mode())) {
// For now do not inline functions that use their arguments array.
- TRACE("Not Inlining %s into %s because inlinee uses arguments array\n",
+ TRACE("Not inlining %s into %s because inlinee uses arguments array\n",
function->shared()->DebugName()->ToCString().get(),
info_->shared_info()->DebugName()->ToCString().get());
return NoChange();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698