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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 2388303006: Reland of "[turbofan] Osr value typing + dynamic type checks on entry. (patchset #5 id:80001 of htt… (Closed)
Patch Set: Tweaks Created 4 years, 2 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 | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index b292a2e49efd8e26020d9ad36a8ea96f1e150cc6..63ca86d7db914d4e90d4b869f404266072b22a63 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -788,8 +788,10 @@ AstGraphBuilder::Environment::CopyAsUnreachable() {
}
AstGraphBuilder::Environment* AstGraphBuilder::Environment::CopyForOsrEntry() {
- return new (zone())
- Environment(this, builder_->liveness_analyzer()->NewBlock());
+ LivenessAnalyzerBlock* copy_block =
+ liveness_block() == nullptr ? nullptr
+ : builder_->liveness_analyzer()->NewBlock();
+ return new (zone()) Environment(this, copy_block);
}
AstGraphBuilder::Environment*
@@ -4202,27 +4204,49 @@ void AstGraphBuilder::Environment::PrepareForOsrEntry() {
graph->start(), graph->start());
UpdateControlDependency(osr_loop_entry);
UpdateEffectDependency(osr_loop_entry);
+
// Set OSR values.
for (int i = 0; i < size; ++i) {
values()->at(i) =
graph->NewNode(builder_->common()->OsrValue(i), osr_loop_entry);
}
- // Set the contexts.
+ // Set the innermost context.
+ const Operator* op_inner =
+ builder_->common()->OsrValue(Linkage::kOsrContextSpillSlotIndex);
+ contexts()->back() = graph->NewNode(op_inner, osr_loop_entry);
+
+ // Create a checkpoint.
+ Node* frame_state = Checkpoint(builder_->info()->osr_ast_id());
+ Node* checkpoint = graph->NewNode(common()->Checkpoint(), frame_state,
+ osr_loop_entry, osr_loop_entry);
+ UpdateEffectDependency(checkpoint);
+
+ // Create the OSR guard nodes.
+ const Operator* guard_op =
+ builder_->info()->is_deoptimization_enabled()
+ ? builder_->common()->OsrGuard(OsrGuardType::kUninitialized)
+ : builder_->common()->OsrGuard(OsrGuardType::kAny);
+ Node* effect = checkpoint;
+ for (int i = 0; i < size; ++i) {
+ values()->at(i) = effect =
+ graph->NewNode(guard_op, values()->at(i), effect, osr_loop_entry);
+ }
+ contexts()->back() = effect =
+ graph->NewNode(guard_op, contexts()->back(), effect, osr_loop_entry);
+
// The innermost context is the OSR value, and the outer contexts are
// reconstructed by dynamically walking up the context chain.
- Node* osr_context = nullptr;
- const Operator* op =
+ const Operator* load_op =
builder_->javascript()->LoadContext(0, Context::PREVIOUS_INDEX, true);
- const Operator* op_inner =
- builder_->common()->OsrValue(Linkage::kOsrContextSpillSlotIndex);
+ Node* osr_context = effect = contexts()->back();
int last = static_cast<int>(contexts()->size() - 1);
- for (int i = last; i >= 0; i--) {
- osr_context = (i == last) ? graph->NewNode(op_inner, osr_loop_entry)
- : graph->NewNode(op, osr_context, osr_context,
- osr_loop_entry);
+ for (int i = last - 1; i >= 0; i--) {
+ osr_context = effect =
+ graph->NewNode(load_op, osr_context, osr_context, effect);
contexts()->at(i) = osr_context;
}
+ UpdateEffectDependency(effect);
}
void AstGraphBuilder::Environment::PrepareForLoop(BitVector* assigned) {
« no previous file with comments | « no previous file | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698