| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_BUILTINS_BUILTINS_REGEXP_H_ | |
| 6 #define V8_BUILTINS_BUILTINS_REGEXP_H_ | |
| 7 | |
| 8 #include "src/code-stub-assembler.h" | |
| 9 | |
| 10 namespace v8 { | |
| 11 namespace internal { | |
| 12 | |
| 13 typedef compiler::Node Node; | |
| 14 typedef compiler::CodeAssemblerState CodeAssemblerState; | |
| 15 typedef compiler::CodeAssemblerLabel CodeAssemblerLabel; | |
| 16 | |
| 17 class RegExpBuiltinsAssembler : public CodeStubAssembler { | |
| 18 public: | |
| 19 explicit RegExpBuiltinsAssembler(CodeAssemblerState* state) | |
| 20 : CodeStubAssembler(state) {} | |
| 21 | |
| 22 void BranchIfFastRegExp(Node* const context, Node* const map, | |
| 23 Label* const if_isunmodified, | |
| 24 Label* const if_ismodified); | |
| 25 | |
| 26 protected: | |
| 27 Node* FastLoadLastIndex(Node* regexp); | |
| 28 Node* SlowLoadLastIndex(Node* context, Node* regexp); | |
| 29 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath); | |
| 30 | |
| 31 void FastStoreLastIndex(Node* regexp, Node* value); | |
| 32 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); | |
| 33 void StoreLastIndex(Node* context, Node* regexp, Node* value, | |
| 34 bool is_fastpath); | |
| 35 | |
| 36 // Loads {var_string_start} and {var_string_end} with the corresponding | |
| 37 // offsets into the given {string_data}. | |
| 38 void GetStringPointers(Node* const string_data, Node* const offset, | |
| 39 Node* const last_index, Node* const string_length, | |
| 40 String::Encoding encoding, Variable* var_string_start, | |
| 41 Variable* var_string_end); | |
| 42 | |
| 43 // Low level logic around the actual call into generated Irregexp code. | |
| 44 Node* IrregexpExec(Node* const context, Node* const regexp, | |
| 45 Node* const string, Node* const last_index, | |
| 46 Node* const match_info); | |
| 47 | |
| 48 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp, | |
| 49 Node* const match_info, | |
| 50 Node* const string); | |
| 51 | |
| 52 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context, | |
| 53 Node* const regexp, | |
| 54 Node* const string, | |
| 55 Label* if_didnotmatch, | |
| 56 const bool is_fastpath); | |
| 57 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp, | |
| 58 Node* const string, const bool is_fastpath); | |
| 59 | |
| 60 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver, | |
| 61 MessageTemplate::Template msg_template, | |
| 62 char const* method_name); | |
| 63 | |
| 64 // Analogous to BranchIfFastRegExp, for use in asserts. | |
| 65 Node* IsFastRegExpMap(Node* const context, Node* const map); | |
| 66 | |
| 67 Node* IsInitialRegExpMap(Node* context, Node* map); | |
| 68 void BranchIfFastRegExpResult(Node* context, Node* map, | |
| 69 Label* if_isunmodified, Label* if_ismodified); | |
| 70 | |
| 71 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath); | |
| 72 | |
| 73 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag); | |
| 74 Node* SlowFlagGetter(Node* const context, Node* const regexp, | |
| 75 JSRegExp::Flag flag); | |
| 76 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag, | |
| 77 bool is_fastpath); | |
| 78 void FlagGetter(JSRegExp::Flag flag, v8::Isolate::UseCounterFeature counter, | |
| 79 const char* method_name); | |
| 80 | |
| 81 Node* IsRegExp(Node* const context, Node* const maybe_receiver); | |
| 82 Node* RegExpInitialize(Node* const context, Node* const regexp, | |
| 83 Node* const maybe_pattern, Node* const maybe_flags); | |
| 84 | |
| 85 Node* RegExpExec(Node* context, Node* regexp, Node* string); | |
| 86 | |
| 87 Node* AdvanceStringIndex(Node* const string, Node* const index, | |
| 88 Node* const is_unicode); | |
| 89 | |
| 90 void RegExpPrototypeMatchBody(Node* const context, Node* const regexp, | |
| 91 Node* const string, const bool is_fastpath); | |
| 92 | |
| 93 void RegExpPrototypeSearchBodyFast(Node* const context, Node* const regexp, | |
| 94 Node* const string); | |
| 95 void RegExpPrototypeSearchBodySlow(Node* const context, Node* const regexp, | |
| 96 Node* const string); | |
| 97 | |
| 98 void RegExpPrototypeSplitBody(Node* const context, Node* const regexp, | |
| 99 Node* const string, Node* const limit); | |
| 100 | |
| 101 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string, | |
| 102 Node* replace_callable); | |
| 103 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string, | |
| 104 Node* replace_string); | |
| 105 }; | |
| 106 | |
| 107 } // namespace internal | |
| 108 } // namespace v8 | |
| 109 | |
| 110 #endif // V8_BUILTINS_BUILTINS_REGEXP_H_ | |
| OLD | NEW |