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

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

Issue 2432043006: [turbofan] Remove dead state value validation. (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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.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/bytecode-branch-analysis.h" 10 #include "src/compiler/bytecode-branch-analysis.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 Node* GetEffectDependency() { return effect_dependency_; } 51 Node* GetEffectDependency() { return effect_dependency_; }
52 void UpdateEffectDependency(Node* dependency) { 52 void UpdateEffectDependency(Node* dependency) {
53 effect_dependency_ = dependency; 53 effect_dependency_ = dependency;
54 } 54 }
55 55
56 // Preserve a checkpoint of the environment for the IR graph. Any 56 // Preserve a checkpoint of the environment for the IR graph. Any
57 // further mutation of the environment will not affect checkpoints. 57 // further mutation of the environment will not affect checkpoints.
58 Node* Checkpoint(BailoutId bytecode_offset, OutputFrameStateCombine combine, 58 Node* Checkpoint(BailoutId bytecode_offset, OutputFrameStateCombine combine,
59 bool owner_has_exception); 59 bool owner_has_exception);
60 60
61 // Returns true if the state values are up to date with the current
62 // environment.
63 bool StateValuesAreUpToDate(int output_poke_offset, int output_poke_count);
64
65 // Control dependency tracked by this environment. 61 // Control dependency tracked by this environment.
66 Node* GetControlDependency() const { return control_dependency_; } 62 Node* GetControlDependency() const { return control_dependency_; }
67 void UpdateControlDependency(Node* dependency) { 63 void UpdateControlDependency(Node* dependency) {
68 control_dependency_ = dependency; 64 control_dependency_ = dependency;
69 } 65 }
70 66
71 Node* Context() const { return context_; } 67 Node* Context() const { return context_; }
72 void SetContext(Node* new_context) { context_ = new_context; } 68 void SetContext(Node* new_context) { context_ = new_context; }
73 69
74 Environment* CopyForConditional(); 70 Environment* CopyForConditional();
75 Environment* CopyForLoop(); 71 Environment* CopyForLoop();
76 Environment* CopyForOsrEntry(); 72 Environment* CopyForOsrEntry();
77 void Merge(Environment* other); 73 void Merge(Environment* other);
78 void PrepareForOsrEntry(); 74 void PrepareForOsrEntry();
79 75
80 void PrepareForLoopExit(Node* loop); 76 void PrepareForLoopExit(Node* loop);
81 77
82 private: 78 private:
83 Environment(const Environment* copy, LivenessAnalyzerBlock* liveness_block); 79 Environment(const Environment* copy, LivenessAnalyzerBlock* liveness_block);
84 void PrepareForLoop(); 80 void PrepareForLoop();
85 81
86 enum { kNotCached, kCached };
87
88 bool StateValuesAreUpToDate(Node** state_values, int offset, int count,
89 int output_poke_start, int output_poke_end,
90 int cached = kNotCached);
91 bool StateValuesRequireUpdate(Node** state_values, int offset, int count); 82 bool StateValuesRequireUpdate(Node** state_values, int offset, int count);
92 void UpdateStateValues(Node** state_values, int offset, int count); 83 void UpdateStateValues(Node** state_values, int offset, int count);
93 void UpdateStateValuesWithCache(Node** state_values, int offset, int count); 84 void UpdateStateValuesWithCache(Node** state_values, int offset, int count);
94 85
95 int RegisterToValuesIndex(interpreter::Register the_register) const; 86 int RegisterToValuesIndex(interpreter::Register the_register) const;
96 87
97 bool IsLivenessBlockConsistent() const; 88 bool IsLivenessBlockConsistent() const;
98 89
99 Zone* zone() const { return builder_->local_zone(); } 90 Zone* zone() const { return builder_->local_zone(); }
100 Graph* graph() const { return builder_->graph(); } 91 Graph* graph() const { return builder_->graph(); }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 if (owner_has_exception) { 482 if (owner_has_exception) {
492 liveness_block()->GetPredecessor()->Checkpoint(result); 483 liveness_block()->GetPredecessor()->Checkpoint(result);
493 } else { 484 } else {
494 liveness_block()->Checkpoint(result); 485 liveness_block()->Checkpoint(result);
495 } 486 }
496 } 487 }
497 488
498 return result; 489 return result;
499 } 490 }
500 491
501 bool BytecodeGraphBuilder::Environment::StateValuesAreUpToDate(
502 Node** state_values, int offset, int count, int output_poke_start,
503 int output_poke_end, int cached) {
504 DCHECK_LE(static_cast<size_t>(offset + count), values()->size());
505 if (cached == kNotCached) {
506 for (int i = 0; i < count; i++, offset++) {
507 if (offset < output_poke_start || offset >= output_poke_end) {
508 if ((*state_values)->InputAt(i) != values()->at(offset)) {
509 return false;
510 }
511 }
512 }
513 } else {
514 for (StateValuesAccess::TypedNode state_value :
515 StateValuesAccess(*state_values)) {
516 if (offset < output_poke_start || offset >= output_poke_end) {
517 if (state_value.node != values()->at(offset)) {
518 return false;
519 }
520 }
521 ++offset;
522 }
523 }
524 return true;
525 }
526
527
528 bool BytecodeGraphBuilder::Environment::StateValuesAreUpToDate(
529 int output_poke_offset, int output_poke_count) {
530 // Poke offset is relative to the top of the stack (i.e., the accumulator).
531 int output_poke_start = accumulator_base() - output_poke_offset;
532 int output_poke_end = output_poke_start + output_poke_count;
533 return StateValuesAreUpToDate(&parameters_state_values_, 0, parameter_count(),
534 output_poke_start, output_poke_end) &&
535 StateValuesAreUpToDate(&registers_state_values_, register_base(),
536 register_count(), output_poke_start,
537 output_poke_end, kCached) &&
538 StateValuesAreUpToDate(&accumulator_state_values_, accumulator_base(),
539 1, output_poke_start, output_poke_end);
540 }
541
542 BytecodeGraphBuilder::BytecodeGraphBuilder( 492 BytecodeGraphBuilder::BytecodeGraphBuilder(
543 Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, 493 Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
544 float invocation_frequency, SourcePositionTable* source_positions) 494 float invocation_frequency, SourcePositionTable* source_positions)
545 : local_zone_(local_zone), 495 : local_zone_(local_zone),
546 jsgraph_(jsgraph), 496 jsgraph_(jsgraph),
547 invocation_frequency_(invocation_frequency), 497 invocation_frequency_(invocation_frequency),
548 bytecode_array_(handle(info->shared_info()->bytecode_array())), 498 bytecode_array_(handle(info->shared_info()->bytecode_array())),
549 exception_handler_table_( 499 exception_handler_table_(
550 handle(HandlerTable::cast(bytecode_array()->handler_table()))), 500 handle(HandlerTable::cast(bytecode_array()->handler_table()))),
551 feedback_vector_(handle(info->closure()->feedback_vector())), 501 feedback_vector_(handle(info->closure()->feedback_vector())),
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 source_positions_->set_current_position(it->source_position()); 2198 source_positions_->set_current_position(it->source_position());
2249 it->Advance(); 2199 it->Advance();
2250 } else { 2200 } else {
2251 DCHECK_GT(it->code_offset(), offset); 2201 DCHECK_GT(it->code_offset(), offset);
2252 } 2202 }
2253 } 2203 }
2254 2204
2255 } // namespace compiler 2205 } // namespace compiler
2256 } // namespace internal 2206 } // namespace internal
2257 } // namespace v8 2207 } // namespace v8
OLDNEW
« 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