OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 static bool NotWord(uc16 c) { | 563 static bool NotWord(uc16 c) { |
564 return !IsRegExpWord(c); | 564 return !IsRegExpWord(c); |
565 } | 565 } |
566 | 566 |
567 | 567 |
568 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { | 568 static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { |
569 Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); | 569 Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); |
570 ZoneList<CharacterRange>* ranges = | 570 ZoneList<CharacterRange>* ranges = |
571 new(&zone) ZoneList<CharacterRange>(2, &zone); | 571 new(&zone) ZoneList<CharacterRange>(2, &zone); |
572 CharacterRange::AddClassEscape(c, ranges, &zone); | 572 CharacterRange::AddClassEscape(c, ranges, false, &zone); |
573 for (uc32 i = 0; i < (1 << 16); i++) { | 573 for (uc32 i = 0; i < (1 << 16); i++) { |
574 bool in_class = false; | 574 bool in_class = false; |
575 for (int j = 0; !in_class && j < ranges->length(); j++) { | 575 for (int j = 0; !in_class && j < ranges->length(); j++) { |
576 CharacterRange& range = ranges->at(j); | 576 CharacterRange& range = ranges->at(j); |
577 in_class = (range.from() <= i && i <= range.to()); | 577 in_class = (range.from() <= i && i <= range.to()); |
578 } | 578 } |
579 CHECK_EQ(pred(i), in_class); | 579 CHECK_EQ(pred(i), in_class); |
580 } | 580 } |
581 } | 581 } |
582 | 582 |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 v8::Local<v8::String> external = | 2025 v8::Local<v8::String> external = |
2026 v8::String::NewExternalOneByte(isolate, new UncachedExternalString()) | 2026 v8::String::NewExternalOneByte(isolate, new UncachedExternalString()) |
2027 .ToLocalChecked(); | 2027 .ToLocalChecked(); |
2028 CHECK(v8::Utils::OpenHandle(*external)->map() == | 2028 CHECK(v8::Utils::OpenHandle(*external)->map() == |
2029 CcTest::i_isolate()->heap()->short_external_one_byte_string_map()); | 2029 CcTest::i_isolate()->heap()->short_external_one_byte_string_map()); |
2030 v8::Local<v8::Object> global = env->Global(); | 2030 v8::Local<v8::Object> global = env->Global(); |
2031 global->Set(env.local(), v8_str("external"), external).FromJust(); | 2031 global->Set(env.local(), v8_str("external"), external).FromJust(); |
2032 CompileRun("var re = /y(.)/; re.test('ab');"); | 2032 CompileRun("var re = /y(.)/; re.test('ab');"); |
2033 ExpectString("external.substring(1).match(re)[1]", "z"); | 2033 ExpectString("external.substring(1).match(re)[1]", "z"); |
2034 } | 2034 } |
OLD | NEW |