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

Unified Diff: test/cctest/interpreter/source-position-matcher.h

Issue 2042633002: [interpreter] Ensure optimizations preserve source positions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
Index: test/cctest/interpreter/source-position-matcher.h
diff --git a/test/cctest/interpreter/source-position-matcher.h b/test/cctest/interpreter/source-position-matcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..eea53542b43552db45e9fdd0de5a55c6387696b8
--- /dev/null
+++ b/test/cctest/interpreter/source-position-matcher.h
@@ -0,0 +1,52 @@
+// 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 TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
+#define TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_
+
+#include "src/interpreter/source-position-table.h"
+#include "src/objects.h"
+#include "src/v8.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+class SourcePositionMatcher final {
+ public:
+ explicit SourcePositionMatcher(int number_of_locals)
+ : number_of_locals_(number_of_locals) {}
+
+ bool Match(Handle<BytecodeArray> original, Handle<BytecodeArray> optimized);
+
+ private:
+ bool NewExpressionPositionsInOptimized(
+ const std::vector<PositionTableEntry>* const original_positions,
+ const std::vector<PositionTableEntry>* const optimized_positions);
+
+ bool CompareExpressionPositions(
+ const std::vector<PositionTableEntry>* const original_positions,
+ const std::vector<PositionTableEntry>* const optimized_positions);
+
+ void StripUnneededExpressionPositions(
+ Handle<BytecodeArray> bytecode_array,
+ std::vector<PositionTableEntry>* positions);
+
+ bool ExpressionPositionIsNeeded(Handle<BytecodeArray> bytecode_array,
+ int start_offset, int end_offset);
+
+ void MoveToNextStatement(
+ SourcePositionTableIterator* iterator,
+ std::vector<PositionTableEntry>* expression_positions);
+
+ int number_of_locals() const { return number_of_locals_; }
rmcilroy 2016/06/07 09:46:11 This seems unused. Are you intending to add a test
oth 2016/06/07 13:46:18 Removed, at least for now. I think the check is pr
+
+ const int number_of_locals_;
+};
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
+
+#endif // TEST_CCTEST_INTERPRETER_SOURCE_POSITION_COMPARER_H_

Powered by Google App Engine
This is Rietveld 408576698