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

Unified Diff: regexp2000/src/regexp-macro-assembler.h

Issue 10942: Start IA32 implemenetation of regexp2k (Closed)
Patch Set: Addressed review comments Created 12 years, 1 month 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 | « regexp2000/src/jsregexp.cc ('k') | regexp2000/src/regexp-macro-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: regexp2000/src/regexp-macro-assembler.h
diff --git a/regexp2000/src/regexp-macro-assembler.h b/regexp2000/src/regexp-macro-assembler.h
index 73d1f7ee6d3c76a7dafef204c4381d1b2955b35e..244c2a0059843df09b227f6f9980062ec7a0e6f5 100644
--- a/regexp2000/src/regexp-macro-assembler.h
+++ b/regexp2000/src/regexp-macro-assembler.h
@@ -39,7 +39,7 @@ struct DisjunctDecisionRow {
class RegExpMacroAssembler {
public:
- RegExpMacroAssembler() { }
+ RegExpMacroAssembler();
virtual ~RegExpMacroAssembler();
virtual void Bind(Label* label) = 0;
virtual void EmitOrLink(Label* label) = 0;
@@ -116,10 +116,49 @@ class RegExpMacroAssembler {
virtual Re2kImplementation Implementation() = 0;
virtual Handle<Object> GetCode() = 0;
+
private:
};
+template <typename T>
+struct ArraySlice {
+public:
+ ArraySlice(Handle<ByteArray> array, size_t offset)
+ : array_(array), offset_(offset) {}
+ Handle<ByteArray> array() { return array_; }
+ // Offset in the byte array data.
+ size_t offset() { return offset_; }
+ // Offset from the ByteArray pointer.
+ size_t base_offset() {
+ return kHeaderSize - kHeapObjectTag + offset;
+ }
+ T* operator*() {
+ return reinterpret_cast<T*>(array_->GetDataStartAddress() + offset);
+ }
+ T& operator[](int idx) {
+ return reinterpret_cast<T*>(array_->getDataStartAddress() + offset)[idx];
+ }
+private:
+ const Handle<ByteArray> array_;
+ const size_t offset_;
+};
+
+
+class ByteArrayProvider {
+ public:
+ ByteArrayProvider(int initial_size);
+ // Provides a place to put "size" elements of type T. The information
+ // can be stored in the provided ByteArray at the "offset". The offset is
+ // aligned to an "align"-boundary
+ template <typename T>
+ ArraySlice<T> GetBuffer(int size, int align);
+ private:
+ const int byte_array_size_;
+ Handle<ByteArray> current_byte_array_;
+ int current_byte_array_free_offset_;
+};
+
} } // namespace v8::internal
#endif // V8_REGEXP_MACRO_ASSEMBLER_H_
« no previous file with comments | « regexp2000/src/jsregexp.cc ('k') | regexp2000/src/regexp-macro-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698