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* const context, Node* const map, | 22 void BranchIfFastRegExp(Node* const context, Node* const object, |
23 Label* const if_isunmodified, | 23 Node* const map, Label* const if_isunmodified, |
24 Label* const if_ismodified); | 24 Label* const if_ismodified); |
25 | 25 |
26 protected: | 26 protected: |
27 Node* FastLoadLastIndex(Node* regexp); | 27 Node* FastLoadLastIndex(Node* regexp); |
28 Node* SlowLoadLastIndex(Node* context, Node* regexp); | 28 Node* SlowLoadLastIndex(Node* context, Node* regexp); |
29 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath); | 29 Node* LoadLastIndex(Node* context, Node* regexp, bool is_fastpath); |
30 | 30 |
31 void FastStoreLastIndex(Node* regexp, Node* value); | 31 void FastStoreLastIndex(Node* regexp, Node* value); |
32 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); | 32 void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); |
33 void StoreLastIndex(Node* context, Node* regexp, Node* value, | 33 void StoreLastIndex(Node* context, Node* regexp, Node* value, |
34 bool is_fastpath); | 34 bool is_fastpath); |
35 | 35 |
36 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp, | 36 Node* ConstructNewResultFromMatchInfo(Node* const context, Node* const regexp, |
37 Node* const match_info, | 37 Node* const match_info, |
38 Node* const string); | 38 Node* const string); |
39 | 39 |
40 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context, | 40 Node* RegExpPrototypeExecBodyWithoutResult(Node* const context, |
41 Node* const regexp, | 41 Node* const regexp, |
42 Node* const string, | 42 Node* const string, |
43 Label* if_didnotmatch, | 43 Label* if_didnotmatch, |
44 const bool is_fastpath); | 44 const bool is_fastpath); |
45 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp, | 45 Node* RegExpPrototypeExecBody(Node* const context, Node* const regexp, |
46 Node* const string, const bool is_fastpath); | 46 Node* const string, const bool is_fastpath); |
47 | 47 |
48 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver, | 48 Node* ThrowIfNotJSReceiver(Node* context, Node* maybe_receiver, |
49 MessageTemplate::Template msg_template, | 49 MessageTemplate::Template msg_template, |
50 char const* method_name); | 50 char const* method_name); |
51 | 51 |
52 // Analogous to BranchIfFastRegExp, for use in asserts. | 52 // Analogous to BranchIfFastRegExp, for use in asserts. |
53 Node* IsFastRegExpMap(Node* const context, Node* const map); | 53 Node* IsFastRegExpMap(Node* const context, Node* const object, |
| 54 Node* const map); |
54 | 55 |
55 Node* IsInitialRegExpMap(Node* context, Node* map); | 56 Node* IsInitialRegExpMap(Node* context, Node* object, Node* map); |
56 void BranchIfFastRegExpResult(Node* context, Node* map, | 57 void BranchIfFastRegExpResult(Node* context, Node* map, |
57 Label* if_isunmodified, Label* if_ismodified); | 58 Label* if_isunmodified, Label* if_ismodified); |
58 | 59 |
59 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath); | 60 Node* FlagsGetter(Node* const context, Node* const regexp, bool is_fastpath); |
60 | 61 |
61 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag); | 62 Node* FastFlagGetter(Node* const regexp, JSRegExp::Flag flag); |
62 Node* SlowFlagGetter(Node* const context, Node* const regexp, | 63 Node* SlowFlagGetter(Node* const context, Node* const regexp, |
63 JSRegExp::Flag flag); | 64 JSRegExp::Flag flag); |
64 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag, | 65 Node* FlagGetter(Node* const context, Node* const regexp, JSRegExp::Flag flag, |
65 bool is_fastpath); | 66 bool is_fastpath); |
(...skipping 23 matching lines...) Expand all Loading... |
89 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string, | 90 Node* ReplaceGlobalCallableFastPath(Node* context, Node* regexp, Node* string, |
90 Node* replace_callable); | 91 Node* replace_callable); |
91 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string, | 92 Node* ReplaceSimpleStringFastPath(Node* context, Node* regexp, Node* string, |
92 Node* replace_string); | 93 Node* replace_string); |
93 }; | 94 }; |
94 | 95 |
95 } // namespace internal | 96 } // namespace internal |
96 } // namespace v8 | 97 } // namespace v8 |
97 | 98 |
98 #endif // V8_BUILTINS_BUILTINS_REGEXP_H_ | 99 #endif // V8_BUILTINS_BUILTINS_REGEXP_H_ |
OLD | NEW |