OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BUILTINS_BUILTINS_REGEXP_H_ | 5 #ifndef V8_BUILTINS_BUILTINS_REGEXP_H_ |
6 #define V8_BUILTINS_BUILTINS_REGEXP_H_ | 6 #define V8_BUILTINS_BUILTINS_REGEXP_H_ |
7 | 7 |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 typedef compiler::Node Node; | 13 typedef compiler::Node Node; |
14 typedef compiler::CodeAssemblerState CodeAssemblerState; | 14 typedef compiler::CodeAssemblerState CodeAssemblerState; |
15 typedef compiler::CodeAssemblerLabel CodeAssemblerLabel; | 15 typedef compiler::CodeAssemblerLabel CodeAssemblerLabel; |
16 | 16 |
17 class RegExpBuiltinsAssembler : public CodeStubAssembler { | 17 class RegExpBuiltinsAssembler : public CodeStubAssembler { |
18 public: | 18 public: |
19 explicit RegExpBuiltinsAssembler(CodeAssemblerState* state) | 19 explicit RegExpBuiltinsAssembler(CodeAssemblerState* state) |
20 : CodeStubAssembler(state) {} | 20 : CodeStubAssembler(state) {} |
21 | 21 |
22 void BranchIfFastRegExp(Node* context, Node* map, Label* if_isunmodified, | 22 void BranchIfFastRegExp(Node* const context, Node* const map, |
23 Label* if_ismodified); | 23 Label* const if_isunmodified, |
| 24 Label* const if_ismodified); |
24 | 25 |
25 protected: | 26 protected: |
26 Node* FastLoadLastIndex(Node* regexp); | 27 Node* FastLoadLastIndex(Node* regexp); |
27 Node* SlowLoadLastIndex(Node* context, Node* regexp); | 28 Node* SlowLoadLastIndex(Node* context, Node* regexp); |
28 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath); | 29 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath); |
29 | 30 |
30 void FastStoreLastIndex(Node* regexp, Node* value); | 31 void FastStoreLastIndex(Node* regexp, Node* value); |
31 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); | 32 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); |
32 void StoreLastIndex(Node* context, Node* regexp, Node* value, | 33 void StoreLastIndex(Node* context, Node* regexp, Node* value, |
33 bool is_fastpath); | 34 bool is_fastpath); |
34 | 35 |
35 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp, | 36 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp, |
36 Node* const match_info, | 37 Node* const match_info, |
37 Node* const string); | 38 Node* const string); |
38 | 39 |
39 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context, | 40 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context, |
40 Node* const regexp, | 41 Node* const regexp, |
41 Node* const string, | 42 Node* const string, |
42 Label* if_didnotmatch, | 43 Label* if_didnotmatch, |
43 const bool is_fastpath); | 44 const bool is_fastpath); |
44 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp, | 45 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp, |
45 Node* const string, const bool is_fastpath); | 46 Node* const string, const bool is_fastpath); |
46 | 47 |
47 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver, | 48 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver, |
48 MessageTemplate::Template msg_template, | 49 MessageTemplate::Template msg_template, |
49 char const* method_name); | 50 char const* method_name); |
50 | 51 |
| 52 // Analogous to BranchIfFastRegExp, for use in asserts. |
| 53 Node* IsFastRegExpMap(Node* const context, Node* const map); |
| 54 |
51 Node* IsInitialRegExpMap(Node* context, Node* map); | 55 Node* IsInitialRegExpMap(Node* context, Node* map); |
52 void BranchIfFastRegExpResult(Node* context, Node* map, | 56 void BranchIfFastRegExpResult(Node* context, Node* map, |
53 Label* if_isunmodified, Label* if_ismodified); | 57 Label* if_isunmodified, Label* if_ismodified); |
54 | 58 |
55 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath); | 59 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath); |
56 | 60 |
57 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag); | 61 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag); |
58 Node* SlowFlagGetter(Node* const context, Node* const regexp, | 62 Node* SlowFlagGetter(Node* const context, Node* const regexp, |
59 JSRegExp::Flag flag); | 63 JSRegExp::Flag flag); |
60 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag, | 64 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag, |
(...skipping 24 matching lines...) Expand all Loading... |
85 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string, | 89 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string, |
86 Node* replace_callable); | 90 Node* replace_callable); |
87 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string, | 91 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string, |
88 Node* replace_string); | 92 Node* replace_string); |
89 }; | 93 }; |
90 | 94 |
91 } // namespace internal | 95 } // namespace internal |
92 } // namespace v8 | 96 } // namespace v8 |
93 | 97 |
94 #endif // V8_BUILTINS_BUILTINS_REGEXP_H_ | 98 #endif // V8_BUILTINS_BUILTINS_REGEXP_H_ |
OLD | NEW |