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

Side by Side Diff: src/vector.h

Issue 2551053002: [wasm] Always provide a wasm instance object at runtime (Closed)
Patch Set: Rebase Created 3 years, 12 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 | « src/runtime/runtime-debug.cc ('k') | src/wasm/wasm-module.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_VECTOR_H_ 5 #ifndef V8_VECTOR_H_
6 #define V8_VECTOR_H_ 6 #define V8_VECTOR_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 DeleteArray(start_); 112 DeleteArray(start_);
113 start_ = NULL; 113 start_ = NULL;
114 length_ = 0; 114 length_ = 0;
115 } 115 }
116 116
117 inline Vector<T> operator+(int offset) { 117 inline Vector<T> operator+(int offset) {
118 DCHECK(offset < length_); 118 DCHECK(offset < length_);
119 return Vector<T>(start_ + offset, length_ - offset); 119 return Vector<T>(start_ + offset, length_ - offset);
120 } 120 }
121 121
122 // Implicit conversion from Vector<T> to Vector<const T>.
123 inline operator Vector<const T>() { return Vector<const T>::cast(*this); }
124
122 // Factory method for creating empty vectors. 125 // Factory method for creating empty vectors.
123 static Vector<T> empty() { return Vector<T>(NULL, 0); } 126 static Vector<T> empty() { return Vector<T>(NULL, 0); }
124 127
125 template<typename S> 128 template<typename S>
126 static Vector<T> cast(Vector<S> input) { 129 static Vector<T> cast(Vector<S> input) {
127 return Vector<T>(reinterpret_cast<T*>(input.start()), 130 return Vector<T>(reinterpret_cast<T*>(input.start()),
128 input.length() * sizeof(S) / sizeof(T)); 131 input.length() * sizeof(S) / sizeof(T));
129 } 132 }
130 133
131 bool operator==(const Vector<T>& other) const { 134 bool operator==(const Vector<T>& other) const {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 210
208 template <typename T, int N> 211 template <typename T, int N>
209 inline Vector<T> ArrayVector(T (&arr)[N]) { 212 inline Vector<T> ArrayVector(T (&arr)[N]) {
210 return Vector<T>(arr); 213 return Vector<T>(arr);
211 } 214 }
212 215
213 } // namespace internal 216 } // namespace internal
214 } // namespace v8 217 } // namespace v8
215 218
216 #endif // V8_VECTOR_H_ 219 #endif // V8_VECTOR_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698