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

Unified Diff: src/compiler/bytecode-analysis.h

Issue 2519983002: [ignition] Replace branch+loop analysis with a single pass (Closed)
Patch Set: Update comments Created 4 years, 1 month 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 | « src/DEPS ('k') | src/compiler/bytecode-analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-analysis.h
diff --git a/src/compiler/bytecode-analysis.h b/src/compiler/bytecode-analysis.h
new file mode 100644
index 0000000000000000000000000000000000000000..f50b00f2c696ecd0acf07ef2d8c7276267555df4
--- /dev/null
+++ b/src/compiler/bytecode-analysis.h
@@ -0,0 +1,56 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_COMPILER_BYTECODE_ANALYSIS_H_
+#define V8_COMPILER_BYTECODE_ANALYSIS_H_
+
+#include "src/handles.h"
+#include "src/zone/zone-containers.h"
+
+namespace v8 {
+namespace internal {
+
+class BytecodeArray;
+
+namespace compiler {
+
+class BytecodeAnalysis BASE_EMBEDDED {
+ public:
+ BytecodeAnalysis(Handle<BytecodeArray> bytecode_array, Zone* zone);
+
+ // Analyze the bytecodes to find the loop ranges and nesting. No other
+ // methods in this class return valid information until this has been called.
+ void Analyze();
+
+ // Return true if the given offset is a loop header
+ bool IsLoopHeader(int offset) const;
+ // Get the loop header offset of the containing loop for arbitrary
+ // {offset}, or -1 if the {offset} is not inside any loop.
+ int GetLoopOffsetFor(int offset) const;
+ // Gets the loop header offset of the parent loop of the loop header
+ // at {header_offset}, or -1 for outer-most loops.
+ int GetParentLoopFor(int header_offset) const;
+
+ private:
+ void PushLoop(int loop_header, int loop_end);
+
+ Zone* zone() const { return zone_; }
+ Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
+
+ Handle<BytecodeArray> bytecode_array_;
+ Zone* zone_;
+
+ ZoneStack<int> loop_stack_;
+
+ ZoneMap<int, int> end_to_header_;
+ ZoneMap<int, int> header_to_parent_;
+
+ DISALLOW_COPY_AND_ASSIGN(BytecodeAnalysis);
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_BYTECODE_ANALYSIS_H_
« no previous file with comments | « src/DEPS ('k') | src/compiler/bytecode-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698