Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: src/jsregexp.cc

Issue 501323002: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 namespace v8 { 47 namespace v8 {
48 namespace internal { 48 namespace internal {
49 49
50 MaybeHandle<Object> RegExpImpl::CreateRegExpLiteral( 50 MaybeHandle<Object> RegExpImpl::CreateRegExpLiteral(
51 Handle<JSFunction> constructor, 51 Handle<JSFunction> constructor,
52 Handle<String> pattern, 52 Handle<String> pattern,
53 Handle<String> flags) { 53 Handle<String> flags) {
54 // Call the construct code with 2 arguments. 54 // Call the construct code with 2 arguments.
55 Handle<Object> argv[] = { pattern, flags }; 55 Handle<Object> argv[] = { pattern, flags };
56 return Execution::New(constructor, ARRAY_SIZE(argv), argv); 56 return Execution::New(constructor, arraysize(argv), argv);
57 } 57 }
58 58
59 59
60 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> str) { 60 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> str) {
61 int flags = JSRegExp::NONE; 61 int flags = JSRegExp::NONE;
62 for (int i = 0; i < str->length(); i++) { 62 for (int i = 0; i < str->length(); i++) {
63 switch (str->Get(i)) { 63 switch (str->Get(i)) {
64 case 'i': 64 case 'i':
65 flags |= JSRegExp::IGNORE_CASE; 65 flags |= JSRegExp::IGNORE_CASE;
66 break; 66 break;
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3581 }; 3581 };
3582 3582
3583 3583
3584 // The '2' variant is has inclusive from and exclusive to. 3584 // The '2' variant is has inclusive from and exclusive to.
3585 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12, 3585 // This covers \s as defined in ECMA-262 5.1, 15.10.2.12,
3586 // which include WhiteSpace (7.2) or LineTerminator (7.3) values. 3586 // which include WhiteSpace (7.2) or LineTerminator (7.3) values.
3587 static const int kSpaceRanges[] = { '\t', '\r' + 1, ' ', ' ' + 1, 3587 static const int kSpaceRanges[] = { '\t', '\r' + 1, ' ', ' ' + 1,
3588 0x00A0, 0x00A1, 0x1680, 0x1681, 0x180E, 0x180F, 0x2000, 0x200B, 3588 0x00A0, 0x00A1, 0x1680, 0x1681, 0x180E, 0x180F, 0x2000, 0x200B,
3589 0x2028, 0x202A, 0x202F, 0x2030, 0x205F, 0x2060, 0x3000, 0x3001, 3589 0x2028, 0x202A, 0x202F, 0x2030, 0x205F, 0x2060, 0x3000, 0x3001,
3590 0xFEFF, 0xFF00, 0x10000 }; 3590 0xFEFF, 0xFF00, 0x10000 };
3591 static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges); 3591 static const int kSpaceRangeCount = arraysize(kSpaceRanges);
3592 3592
3593 static const int kWordRanges[] = { 3593 static const int kWordRanges[] = {
3594 '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, 0x10000 }; 3594 '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, 0x10000 };
3595 static const int kWordRangeCount = ARRAY_SIZE(kWordRanges); 3595 static const int kWordRangeCount = arraysize(kWordRanges);
3596 static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 }; 3596 static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 };
3597 static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges); 3597 static const int kDigitRangeCount = arraysize(kDigitRanges);
3598 static const int kSurrogateRanges[] = { 0xd800, 0xe000, 0x10000 }; 3598 static const int kSurrogateRanges[] = { 0xd800, 0xe000, 0x10000 };
3599 static const int kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges); 3599 static const int kSurrogateRangeCount = arraysize(kSurrogateRanges);
3600 static const int kLineTerminatorRanges[] = { 0x000A, 0x000B, 0x000D, 0x000E, 3600 static const int kLineTerminatorRanges[] = { 0x000A, 0x000B, 0x000D, 0x000E,
3601 0x2028, 0x202A, 0x10000 }; 3601 0x2028, 0x202A, 0x10000 };
3602 static const int kLineTerminatorRangeCount = ARRAY_SIZE(kLineTerminatorRanges); 3602 static const int kLineTerminatorRangeCount = arraysize(kLineTerminatorRanges);
3603 3603
3604 3604
3605 void BoyerMoorePositionInfo::Set(int character) { 3605 void BoyerMoorePositionInfo::Set(int character) {
3606 SetInterval(Interval(character, character)); 3606 SetInterval(Interval(character, character));
3607 } 3607 }
3608 3608
3609 3609
3610 void BoyerMoorePositionInfo::SetInterval(const Interval& interval) { 3610 void BoyerMoorePositionInfo::SetInterval(const Interval& interval) {
3611 s_ = AddRange(s_, kSpaceRanges, kSpaceRangeCount, interval); 3611 s_ = AddRange(s_, kSpaceRanges, kSpaceRangeCount, interval);
3612 w_ = AddRange(w_, kWordRanges, kWordRangeCount, interval); 3612 w_ = AddRange(w_, kWordRanges, kWordRangeCount, interval);
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after
6104 } 6104 }
6105 6105
6106 return compiler.Assemble(&macro_assembler, 6106 return compiler.Assemble(&macro_assembler,
6107 node, 6107 node,
6108 data->capture_count, 6108 data->capture_count,
6109 pattern); 6109 pattern);
6110 } 6110 }
6111 6111
6112 6112
6113 }} // namespace v8::internal 6113 }} // namespace v8::internal
OLDNEW
« src/base/macros.h ('K') | « src/isolate.cc ('k') | src/lithium-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698