OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 | 62 |
63 namespace v8 { | 63 namespace v8 { |
64 namespace internal { | 64 namespace internal { |
65 | 65 |
66 Handle<Object> RegExpImpl::CreateRegExpLiteral(Handle<JSFunction> constructor, | 66 Handle<Object> RegExpImpl::CreateRegExpLiteral(Handle<JSFunction> constructor, |
67 Handle<String> pattern, | 67 Handle<String> pattern, |
68 Handle<String> flags, | 68 Handle<String> flags, |
69 bool* has_pending_exception) { | 69 bool* has_pending_exception) { |
70 // Call the construct code with 2 arguments. | 70 // Call the construct code with 2 arguments. |
71 Object** argv[2] = { Handle<Object>::cast(pattern).location(), | 71 Handle<Object> argv[] = { pattern, flags }; |
72 Handle<Object>::cast(flags).location() }; | 72 return Execution::New(constructor, ARRAY_SIZE(argv), argv, |
73 return Execution::New(constructor, 2, argv, has_pending_exception); | 73 has_pending_exception); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> str) { | 77 static JSRegExp::Flags RegExpFlagsFromString(Handle<String> str) { |
78 int flags = JSRegExp::NONE; | 78 int flags = JSRegExp::NONE; |
79 for (int i = 0; i < str->length(); i++) { | 79 for (int i = 0; i < str->length(); i++) { |
80 switch (str->Get(i)) { | 80 switch (str->Get(i)) { |
81 case 'i': | 81 case 'i': |
82 flags |= JSRegExp::IGNORE_CASE; | 82 flags |= JSRegExp::IGNORE_CASE; |
83 break; | 83 break; |
(...skipping 5249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5333 } | 5333 } |
5334 | 5334 |
5335 return compiler.Assemble(¯o_assembler, | 5335 return compiler.Assemble(¯o_assembler, |
5336 node, | 5336 node, |
5337 data->capture_count, | 5337 data->capture_count, |
5338 pattern); | 5338 pattern); |
5339 } | 5339 } |
5340 | 5340 |
5341 | 5341 |
5342 }} // namespace v8::internal | 5342 }} // namespace v8::internal |
OLD | NEW |