| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 template <typename T> | 124 template <typename T> |
| 125 struct ArraySlice { | 125 struct ArraySlice { |
| 126 public: | 126 public: |
| 127 ArraySlice(Handle<ByteArray> array, size_t offset) | 127 ArraySlice(Handle<ByteArray> array, size_t offset) |
| 128 : array_(array), offset_(offset) {} | 128 : array_(array), offset_(offset) {} |
| 129 Handle<ByteArray> array() { return array_; } | 129 Handle<ByteArray> array() { return array_; } |
| 130 // Offset in the byte array data. | 130 // Offset in the byte array data. |
| 131 size_t offset() { return offset_; } | 131 size_t offset() { return offset_; } |
| 132 // Offset from the ByteArray pointer. | 132 // Offset from the ByteArray pointer. |
| 133 size_t base_offset() { | 133 size_t base_offset() { |
| 134 return kHeaderSize - kHeapObjectTag + offset; | 134 return ByteArray::kHeaderSize - kHeapObjectTag + offset; |
| 135 } | 135 } |
| 136 T* operator*() { | 136 T* operator*() { |
| 137 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset); | 137 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset); |
| 138 } | 138 } |
| 139 T& operator[](int idx) { | 139 T& operator[](int idx) { |
| 140 return reinterpret_cast<T*>(array_->getDataStartAddress() + offset)[idx]; | 140 return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset)[idx]; |
| 141 } | 141 } |
| 142 private: | 142 private: |
| 143 const Handle<ByteArray> array_; | 143 const Handle<ByteArray> array_; |
| 144 const size_t offset_; | 144 const size_t offset_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 | 147 |
| 148 class ByteArrayProvider { | 148 class ByteArrayProvider { |
| 149 public: | 149 public: |
| 150 ByteArrayProvider(int initial_size); | 150 ByteArrayProvider(int initial_size); |
| 151 // Provides a place to put "size" elements of type T. The information | 151 // Provides a place to put "size" elements of type T. The information |
| 152 // can be stored in the provided ByteArray at the "offset". The offset is | 152 // can be stored in the provided ByteArray at the "offset". The offset is |
| 153 // aligned to an "align"-boundary | 153 // aligned to an "align"-boundary |
| 154 template <typename T> | 154 template <typename T> |
| 155 ArraySlice<T> GetBuffer(int size, int align); | 155 ArraySlice<T> GetBuffer(int size, int align); |
| 156 private: | 156 private: |
| 157 const int byte_array_size_; | 157 const int byte_array_size_; |
| 158 Handle<ByteArray> current_byte_array_; | 158 Handle<ByteArray> current_byte_array_; |
| 159 int current_byte_array_free_offset_; | 159 int current_byte_array_free_offset_; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| 163 | 163 |
| 164 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 164 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
| OLD | NEW |