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

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

Issue 10795: Fixes to RegExp-IA32. (Closed)
Patch Set: 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
Index: src/regexp-macro-assembler-tracer.h
diff --git a/src/regexp-macro-assembler-tracer.h b/src/regexp-macro-assembler-tracer.h
new file mode 100644
index 0000000000000000000000000000000000000000..30d5bfc4c0dc54cb0ea8bab92b3a7a62606d8f9d
--- /dev/null
+++ b/src/regexp-macro-assembler-tracer.h
@@ -0,0 +1,131 @@
+// Copyright 2008 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef REGEXP_MACRO_ASSEMBLER_TRACER_H_
+#define REGEXP_MACRO_ASSEMBLER_TRACER_H_
+
+namespace v8 { namespace internal {
+
+// Decorator on a RegExpMacroAssembler that write all calls.
+class RegExpMacroAssemblerTracer: public RegExpMacroAssembler {
+ public:
+ explicit RegExpMacroAssemblerTracer(RegExpMacroAssembler* assembler);
+ virtual ~RegExpMacroAssemblerTracer();
+
+ virtual void AdvanceCurrentPosition(int by); // Signed cp change.
+ virtual void AdvanceRegister(int reg, int by); // r[reg] += by.
+ virtual void Backtrack();
+ virtual void Bind(Label* label);
+ // Check the current character against a bitmap. The range of the current
+ // character must be from start to start + length_of_bitmap_in_bits.
Erik Corry 2008/11/27 13:04:36 I think the indivdual method comments should be re
+ virtual void CheckBitmap(
+ uc16 start, // The bitmap is indexed from this character.
+ Label* bitmap, // Where the bitmap is emitted.
+ Label* on_zero); // Where to go if the bit is 0. Fall through on 1.
+ // Dispatch after looking the current character up in a 2-bits-per-entry
+ // map. The destinations vector has up to 4 labels.
+ virtual void CheckCharacter(uc16 c, Label* on_equal);
+ virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
+ virtual void CheckCharacterLT(uc16 limit, Label* on_less);
+ // Check the current character for a match with a literal string. If we
+ // fail to match then goto the on_failure label. End of input always
+ // matches. If the label is NULL then we should pop a backtrack address off
+ // the stack abnd go to that.
+ virtual void CheckCharacters(
+ Vector<const uc16> str,
+ int cp_offset,
+ Label* on_failure);
+ // Check the current input position against a register. If the register is
+ // equal to the current position then go to the label. If the label is NULL
+ // then backtrack instead.
+ virtual void CheckCurrentPosition(
+ int register_index,
+ Label* on_equal);
+ virtual void CheckNotBackReference(int start_reg, Label* on_no_match);
+ virtual void CheckNotBackReferenceIgnoreCase(int start_reg,
+ Label* on_no_match);
+ // Check the current character for a match with a literal character. If we
+ // fail to match then goto the on_failure label. End of input always
+ // matches. If the label is NULL then we should pop a backtrack address off
+ // the stack and go to that.
+ virtual void CheckNotCharacter(uc16 c, Label* on_not_equal);
+ // Bitwise or the current character with the given constant and then
+ // check for a match with c.
+ virtual void CheckNotCharacterAfterOr(uc16 c,
+ uc16 or_with,
+ Label* on_not_equal);
+ // Subtract a constant from the current character, then or with the given
+ // constant and then check for a match with c.
+ virtual void CheckNotCharacterAfterMinusOr(uc16 c,
+ uc16 minus_then_or_with,
+ Label* on_not_equal);
+ // Dispatch after looking the current character up in a byte map. The
+ // destinations vector has up to 256 labels.
+ virtual void DispatchByteMap(
+ uc16 start,
+ Label* byte_map,
+ const Vector<Label*>& destinations);
+ virtual void DispatchHalfNibbleMap(
+ uc16 start,
+ Label* half_nibble_map,
+ const Vector<Label*>& destinations);
+ // Dispatch after looking the high byte of the current character up in a byte
+ // map. The destinations vector has up to 256 labels.
+ virtual void DispatchHighByteMap(
+ byte start,
+ Label* byte_map,
+ const Vector<Label*>& destinations);
+ virtual void EmitOrLink(Label* label);
+ virtual void Fail();
+ virtual Handle<Object> GetCode();
+ virtual void GoTo(Label* label);
+ // Check whether a register is >= a given constant and go to a label if it
+ // is. Backtracks instead if the label is NULL.
+ virtual void IfRegisterGE(int reg, int comparand, Label* if_ge);
+ // Check whether a register is < a given constant and go to a label if it is.
+ // Backtracks instead if the label is NULL.
+ virtual void IfRegisterLT(int reg, int comparand, Label* if_lt);
+ virtual IrregexpImplementation Implementation();
+ virtual void LoadCurrentCharacter(int cp_offset, Label* on_end_of_input);
+ virtual void PopCurrentPosition();
+ virtual void PopRegister(int register_index);
+ virtual void PushBacktrack(Label* label);
+ virtual void PushCurrentPosition();
+ virtual void PushRegister(int register_index);
+ virtual void ReadCurrentPositionFromRegister(int reg);
+ virtual void ReadStackPointerFromRegister(int reg);
+ virtual void SetRegister(int register_index, int to);
+ virtual void Succeed();
+ virtual void WriteCurrentPositionToRegister(int reg);
+ virtual void WriteStackPointerToRegister(int reg);
+ private:
+ RegExpMacroAssembler* assembler_;
+};
+
+} } // namespace v8::internal
+
+#endif // REGEXP_MACRO_ASSEMBLER_TRACER_H_

Powered by Google App Engine
This is Rietveld 408576698