OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 public: | 141 public: |
142 ArraySlice(Handle<ByteArray> array, size_t offset) | 142 ArraySlice(Handle<ByteArray> array, size_t offset) |
143 : array_(array), offset_(offset) {} | 143 : array_(array), offset_(offset) {} |
144 Handle<ByteArray> array() { return array_; } | 144 Handle<ByteArray> array() { return array_; } |
145 // Offset in the byte array data. | 145 // Offset in the byte array data. |
146 size_t offset() { return offset_; } | 146 size_t offset() { return offset_; } |
147 // Offset from the ByteArray pointer. | 147 // Offset from the ByteArray pointer. |
148 size_t base_offset() { | 148 size_t base_offset() { |
149 return ByteArray::kHeaderSize - kHeapObjectTag + offset_; | 149 return ByteArray::kHeaderSize - kHeapObjectTag + offset_; |
150 } | 150 } |
151 template <typename T> | 151 void* location() { |
152 T* location() { | 152 return reinterpret_cast<void*>(array_->GetDataStartAddress() + offset_); |
153 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset_); | |
154 } | 153 } |
155 template <typename T> | 154 template <typename T> |
156 T& at(int idx) { | 155 T& at(int idx) { |
157 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset_)[idx]; | 156 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset_)[idx]; |
158 } | 157 } |
159 private: | 158 private: |
160 Handle<ByteArray> array_; | 159 Handle<ByteArray> array_; |
161 size_t offset_; | 160 size_t offset_; |
162 }; | 161 }; |
163 | 162 |
(...skipping 10 matching lines...) Expand all Loading... |
174 ArraySlice GetBuffer(Vector<T> values); | 173 ArraySlice GetBuffer(Vector<T> values); |
175 private: | 174 private: |
176 size_t byte_array_size_; | 175 size_t byte_array_size_; |
177 Handle<ByteArray> current_byte_array_; | 176 Handle<ByteArray> current_byte_array_; |
178 int current_byte_array_free_offset_; | 177 int current_byte_array_free_offset_; |
179 }; | 178 }; |
180 | 179 |
181 } } // namespace v8::internal | 180 } } // namespace v8::internal |
182 | 181 |
183 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 182 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
OLD | NEW |