OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 // TODO(rmcilroy): Remove this define after this flag is turned on globally | 5 // TODO(rmcilroy): Remove this define after this flag is turned on globally |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2846 | 2846 |
2847 | 2847 |
2848 TEST(RegExpLiterals) { | 2848 TEST(RegExpLiterals) { |
2849 InitializedHandleScope handle_scope; | 2849 InitializedHandleScope handle_scope; |
2850 BytecodeGeneratorHelper helper; | 2850 BytecodeGeneratorHelper helper; |
2851 Zone zone; | 2851 Zone zone; |
2852 | 2852 |
2853 FeedbackVectorSpec feedback_spec(&zone); | 2853 FeedbackVectorSpec feedback_spec(&zone); |
2854 FeedbackVectorSlot slot1 = feedback_spec.AddCallICSlot(); | 2854 FeedbackVectorSlot slot1 = feedback_spec.AddCallICSlot(); |
2855 FeedbackVectorSlot slot2 = feedback_spec.AddLoadICSlot(); | 2855 FeedbackVectorSlot slot2 = feedback_spec.AddLoadICSlot(); |
| 2856 uint8_t i_flags = JSRegExp::kIgnoreCase; |
2856 | 2857 |
2857 Handle<i::TypeFeedbackVector> vector = | 2858 Handle<i::TypeFeedbackVector> vector = |
2858 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 2859 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
2859 | 2860 |
2860 ExpectedSnippet<const char*> snippets[] = { | 2861 ExpectedSnippet<const char*> snippets[] = { |
2861 {"return /ab+d/;", | 2862 {"return /ab+d/;", |
2862 1 * kPointerSize, | 2863 0 * kPointerSize, |
2863 1, | 2864 1, |
2864 10, | 2865 6, |
2865 { | 2866 { |
2866 B(LdaConstant), U8(0), // | 2867 B(LdaConstant), U8(0), // |
2867 B(Star), R(0), // | 2868 B(CreateRegExpLiteral), U8(0), U8(0), // |
2868 B(LdaConstant), U8(1), // | 2869 B(Return), // |
2869 B(CreateRegExpLiteral), U8(0), R(0), // | |
2870 B(Return), // | |
2871 }, | 2870 }, |
2872 2, | 2871 1, |
2873 {"", "ab+d"}}, | 2872 {"ab+d"}}, |
2874 {"return /(\\w+)\\s(\\w+)/i;", | 2873 {"return /(\\w+)\\s(\\w+)/i;", |
2875 1 * kPointerSize, | 2874 0 * kPointerSize, |
2876 1, | 2875 1, |
2877 10, | 2876 6, |
2878 { | 2877 { |
2879 B(LdaConstant), U8(0), // | 2878 B(LdaConstant), U8(0), // |
2880 B(Star), R(0), // | 2879 B(CreateRegExpLiteral), U8(0), U8(i_flags), // |
2881 B(LdaConstant), U8(1), // | 2880 B(Return), // |
2882 B(CreateRegExpLiteral), U8(0), R(0), // | |
2883 B(Return), // | |
2884 }, | 2881 }, |
2885 2, | 2882 1, |
2886 {"i", "(\\w+)\\s(\\w+)"}}, | 2883 {"(\\w+)\\s(\\w+)"}}, |
2887 {"return /ab+d/.exec('abdd');", | 2884 {"return /ab+d/.exec('abdd');", |
2888 3 * kPointerSize, | 2885 3 * kPointerSize, |
2889 1, | 2886 1, |
2890 27, | 2887 23, |
2891 { | 2888 { |
2892 B(LdaConstant), U8(0), // | 2889 B(LdaConstant), U8(0), // |
2893 B(Star), R(2), // | 2890 B(CreateRegExpLiteral), U8(0), U8(0), // |
2894 B(LdaConstant), U8(1), // | |
2895 B(CreateRegExpLiteral), U8(0), R(2), // | |
2896 B(Star), R(1), // | 2891 B(Star), R(1), // |
2897 B(LoadICSloppy), R(1), U8(2), U8(vector->GetIndex(slot2)), // | 2892 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
2898 B(Star), R(0), // | 2893 B(Star), R(0), // |
2899 B(LdaConstant), U8(3), // | 2894 B(LdaConstant), U8(2), // |
2900 B(Star), R(2), // | 2895 B(Star), R(2), // |
2901 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 2896 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
2902 B(Return), // | 2897 B(Return), // |
2903 }, | 2898 }, |
2904 4, | 2899 3, |
2905 {"", "ab+d", "exec", "abdd"}}, | 2900 {"ab+d", "exec", "abdd"}}, |
2906 }; | 2901 }; |
2907 | 2902 |
2908 for (size_t i = 0; i < arraysize(snippets); i++) { | 2903 for (size_t i = 0; i < arraysize(snippets); i++) { |
2909 Handle<BytecodeArray> bytecode_array = | 2904 Handle<BytecodeArray> bytecode_array = |
2910 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 2905 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
2911 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 2906 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
2912 } | 2907 } |
2913 } | 2908 } |
2914 | 2909 |
2915 | 2910 |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5483 for (size_t i = 0; i < arraysize(snippets); i++) { | 5478 for (size_t i = 0; i < arraysize(snippets); i++) { |
5484 Handle<BytecodeArray> bytecode_array = | 5479 Handle<BytecodeArray> bytecode_array = |
5485 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5480 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
5486 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5481 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
5487 } | 5482 } |
5488 } | 5483 } |
5489 | 5484 |
5490 } // namespace interpreter | 5485 } // namespace interpreter |
5491 } // namespace internal | 5486 } // namespace internal |
5492 } // namespace v8 | 5487 } // namespace v8 |
OLD | NEW |