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

Unified Diff: test/cctest/test-feedback-vector.h

Issue 1370303004: Distinction between FeedbackVectorICSlot and FeedbackVectorSlot eliminated. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed release builds Created 5 years, 3 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 | « test/cctest/test-compiler.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-feedback-vector.h
diff --git a/test/cctest/test-feedback-vector.h b/test/cctest/test-feedback-vector.h
new file mode 100644
index 0000000000000000000000000000000000000000..52f92d12479bbfe3f8aa7f9176cf4695901350ad
--- /dev/null
+++ b/test/cctest/test-feedback-vector.h
@@ -0,0 +1,45 @@
+// Copyright 2015 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_TEST_FEEDBACK_VECTOR_H_
+#define V8_TEST_FEEDBACK_VECTOR_H_
+
+#include "src/objects.h"
+
+
+namespace v8 {
+namespace internal {
+
+// Helper class that allows to write tests in a slot size independent manner.
+// Use helper.slot(X) to get X'th slot identifier.
+class FeedbackVectorHelper {
+ public:
+ explicit FeedbackVectorHelper(Handle<TypeFeedbackVector> vector)
+ : vector_(vector) {
+ int slot_count = vector->Slots();
+ slots_.reserve(slot_count);
+ TypeFeedbackMetadataIterator iter(vector);
+ while (iter.HasNext()) {
+ FeedbackVectorSlot slot = iter.Next();
+ slots_.push_back(slot);
+ }
+ }
+
+ Handle<TypeFeedbackVector> vector() { return vector_; }
+
+ // Returns slot identifier by numerical index.
+ FeedbackVectorSlot slot(int index) const { return slots_[index]; }
+
+ // Returns the number of slots in the feedback vector.
+ int slot_count() const { return static_cast<int>(slots_.size()); }
+
+ private:
+ Handle<TypeFeedbackVector> vector_;
+ std::vector<FeedbackVectorSlot> slots_;
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698