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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 2395783002: Revert of [turbofan] Osr value typing + dynamic type checks on entry. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/bytecode-graph-builder.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 782
783 AstGraphBuilder::Environment* 783 AstGraphBuilder::Environment*
784 AstGraphBuilder::Environment::CopyAsUnreachable() { 784 AstGraphBuilder::Environment::CopyAsUnreachable() {
785 Environment* env = new (zone()) Environment(this, nullptr); 785 Environment* env = new (zone()) Environment(this, nullptr);
786 env->MarkAsUnreachable(); 786 env->MarkAsUnreachable();
787 return env; 787 return env;
788 } 788 }
789 789
790 AstGraphBuilder::Environment* AstGraphBuilder::Environment::CopyForOsrEntry() { 790 AstGraphBuilder::Environment* AstGraphBuilder::Environment::CopyForOsrEntry() {
791 LivenessAnalyzerBlock* copy_block = 791 return new (zone())
792 liveness_block() == nullptr ? nullptr 792 Environment(this, builder_->liveness_analyzer()->NewBlock());
793 : builder_->liveness_analyzer()->NewBlock();
794 return new (zone()) Environment(this, copy_block);
795 } 793 }
796 794
797 AstGraphBuilder::Environment* 795 AstGraphBuilder::Environment*
798 AstGraphBuilder::Environment::CopyAndShareLiveness() { 796 AstGraphBuilder::Environment::CopyAndShareLiveness() {
799 if (liveness_block() != nullptr) { 797 if (liveness_block() != nullptr) {
800 // Finish the current liveness block before copying. 798 // Finish the current liveness block before copying.
801 liveness_block_ = builder_->liveness_analyzer()->NewBlock(liveness_block()); 799 liveness_block_ = builder_->liveness_analyzer()->NewBlock(liveness_block());
802 } 800 }
803 Environment* env = new (zone()) Environment(this, liveness_block()); 801 Environment* env = new (zone()) Environment(this, liveness_block());
804 return env; 802 return env;
(...skipping 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 4195
4198 void AstGraphBuilder::Environment::PrepareForOsrEntry() { 4196 void AstGraphBuilder::Environment::PrepareForOsrEntry() {
4199 int size = static_cast<int>(values()->size()); 4197 int size = static_cast<int>(values()->size());
4200 Graph* graph = builder_->graph(); 4198 Graph* graph = builder_->graph();
4201 4199
4202 // Set the control and effect to the OSR loop entry. 4200 // Set the control and effect to the OSR loop entry.
4203 Node* osr_loop_entry = graph->NewNode(builder_->common()->OsrLoopEntry(), 4201 Node* osr_loop_entry = graph->NewNode(builder_->common()->OsrLoopEntry(),
4204 graph->start(), graph->start()); 4202 graph->start(), graph->start());
4205 UpdateControlDependency(osr_loop_entry); 4203 UpdateControlDependency(osr_loop_entry);
4206 UpdateEffectDependency(osr_loop_entry); 4204 UpdateEffectDependency(osr_loop_entry);
4207
4208 // Set OSR values. 4205 // Set OSR values.
4209 for (int i = 0; i < size; ++i) { 4206 for (int i = 0; i < size; ++i) {
4210 values()->at(i) = 4207 values()->at(i) =
4211 graph->NewNode(builder_->common()->OsrValue(i), osr_loop_entry); 4208 graph->NewNode(builder_->common()->OsrValue(i), osr_loop_entry);
4212 } 4209 }
4213 4210
4214 // Set the innermost context. 4211 // Set the contexts.
4212 // The innermost context is the OSR value, and the outer contexts are
4213 // reconstructed by dynamically walking up the context chain.
4214 Node* osr_context = nullptr;
4215 const Operator* op =
4216 builder_->javascript()->LoadContext(0, Context::PREVIOUS_INDEX, true);
4215 const Operator* op_inner = 4217 const Operator* op_inner =
4216 builder_->common()->OsrValue(Linkage::kOsrContextSpillSlotIndex); 4218 builder_->common()->OsrValue(Linkage::kOsrContextSpillSlotIndex);
4217 contexts()->back() = graph->NewNode(op_inner, osr_loop_entry);
4218
4219 // Create a checkpoint.
4220 Node* frame_state = Checkpoint(builder_->info()->osr_ast_id());
4221 Node* checkpoint = graph->NewNode(common()->Checkpoint(), frame_state,
4222 osr_loop_entry, osr_loop_entry);
4223 UpdateEffectDependency(checkpoint);
4224
4225 // Create the OSR guard nodes.
4226 const Operator* guard_op =
4227 builder_->common()->OsrGuard(OsrGuardType::kUninitialized);
4228 Node* effect = checkpoint;
4229 for (int i = 0; i < size; ++i) {
4230 values()->at(i) = effect =
4231 graph->NewNode(guard_op, values()->at(i), effect, osr_loop_entry);
4232 }
4233 contexts()->back() = effect =
4234 graph->NewNode(guard_op, contexts()->back(), effect, osr_loop_entry);
4235
4236 // The innermost context is the OSR value, and the outer contexts are
4237 // reconstructed by dynamically walking up the context chain.
4238 const Operator* load_op =
4239 builder_->javascript()->LoadContext(0, Context::PREVIOUS_INDEX, true);
4240 Node* osr_context = effect = contexts()->back();
4241 int last = static_cast<int>(contexts()->size() - 1); 4219 int last = static_cast<int>(contexts()->size() - 1);
4242 for (int i = last - 1; i >= 0; i--) { 4220 for (int i = last; i >= 0; i--) {
4243 osr_context = effect = 4221 osr_context = (i == last) ? graph->NewNode(op_inner, osr_loop_entry)
4244 graph->NewNode(load_op, osr_context, effect, osr_loop_entry); 4222 : graph->NewNode(op, osr_context, osr_context,
4223 osr_loop_entry);
4245 contexts()->at(i) = osr_context; 4224 contexts()->at(i) = osr_context;
4246 } 4225 }
4247 UpdateEffectDependency(effect);
4248 } 4226 }
4249 4227
4250 void AstGraphBuilder::Environment::PrepareForLoop(BitVector* assigned) { 4228 void AstGraphBuilder::Environment::PrepareForLoop(BitVector* assigned) {
4251 int size = static_cast<int>(values()->size()); 4229 int size = static_cast<int>(values()->size());
4252 4230
4253 Node* control = builder_->NewLoop(); 4231 Node* control = builder_->NewLoop();
4254 if (assigned == nullptr) { 4232 if (assigned == nullptr) {
4255 // Assume that everything is updated in the loop. 4233 // Assume that everything is updated in the loop.
4256 for (int i = 0; i < size; ++i) { 4234 for (int i = 0; i < size; ++i) {
4257 values()->at(i) = builder_->NewPhi(1, values()->at(i), control); 4235 values()->at(i) = builder_->NewPhi(1, values()->at(i), control);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 // Phi does not exist yet, introduce one. 4331 // Phi does not exist yet, introduce one.
4354 value = NewPhi(inputs, value, control); 4332 value = NewPhi(inputs, value, control);
4355 value->ReplaceInput(inputs - 1, other); 4333 value->ReplaceInput(inputs - 1, other);
4356 } 4334 }
4357 return value; 4335 return value;
4358 } 4336 }
4359 4337
4360 } // namespace compiler 4338 } // namespace compiler
4361 } // namespace internal 4339 } // namespace internal
4362 } // namespace v8 4340 } // namespace v8
OLDNEW
« 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