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

Side by Side Diff: test/cctest/test-feedback-vector.h

Issue 1384673002: The metadata part of TypeFeedbackVector is extracted to TypeFeedbackMetadata array. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 5 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 | « test/cctest/interpreter/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.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 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 #ifndef V8_TEST_FEEDBACK_VECTOR_H_ 5 #ifndef V8_TEST_FEEDBACK_VECTOR_H_
6 #define V8_TEST_FEEDBACK_VECTOR_H_ 6 #define V8_TEST_FEEDBACK_VECTOR_H_
7 7
8 #include "src/objects.h" 8 #include "src/objects.h"
9 9
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 // Helper class that allows to write tests in a slot size independent manner. 14 // Helper class that allows to write tests in a slot size independent manner.
15 // Use helper.slot(X) to get X'th slot identifier. 15 // Use helper.slot(X) to get X'th slot identifier.
16 class FeedbackVectorHelper { 16 class FeedbackVectorHelper {
17 public: 17 public:
18 explicit FeedbackVectorHelper(Handle<TypeFeedbackVector> vector) 18 explicit FeedbackVectorHelper(Handle<TypeFeedbackVector> vector)
19 : vector_(vector) { 19 : vector_(vector) {
20 int slot_count = vector->Slots(); 20 int slot_count = vector->slot_count();
21 slots_.reserve(slot_count); 21 slots_.reserve(slot_count);
22 TypeFeedbackMetadataIterator iter(vector); 22 TypeFeedbackMetadataIterator iter(vector->metadata());
23 while (iter.HasNext()) { 23 while (iter.HasNext()) {
24 FeedbackVectorSlot slot = iter.Next(); 24 FeedbackVectorSlot slot = iter.Next();
25 slots_.push_back(slot); 25 slots_.push_back(slot);
26 } 26 }
27 } 27 }
28 28
29 Handle<TypeFeedbackVector> vector() { return vector_; } 29 Handle<TypeFeedbackVector> vector() { return vector_; }
30 30
31 // Returns slot identifier by numerical index. 31 // Returns slot identifier by numerical index.
32 FeedbackVectorSlot slot(int index) const { return slots_[index]; } 32 FeedbackVectorSlot slot(int index) const { return slots_[index]; }
33 33
34 // Returns the number of slots in the feedback vector. 34 // Returns the number of slots in the feedback vector.
35 int slot_count() const { return static_cast<int>(slots_.size()); } 35 int slot_count() const { return static_cast<int>(slots_.size()); }
36 36
37 private: 37 private:
38 Handle<TypeFeedbackVector> vector_; 38 Handle<TypeFeedbackVector> vector_;
39 std::vector<FeedbackVectorSlot> slots_; 39 std::vector<FeedbackVectorSlot> slots_;
40 }; 40 };
41 41
42 template <typename Spec>
43 Handle<TypeFeedbackVector> NewTypeFeedbackVector(Isolate* isolate, Spec* spec) {
44 Handle<TypeFeedbackMetadata> metadata =
45 TypeFeedbackMetadata::New(isolate, spec);
46 return TypeFeedbackVector::New(isolate, metadata);
47 }
48
49
42 } // namespace internal 50 } // namespace internal
43 } // namespace v8 51 } // namespace v8
44 52
45 #endif 53 #endif
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/cctest/test-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698