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

Side by Side Diff: src/jsregexp.cc

Issue 10693: Merged bleeding_edge -r 685:746 into regexp2000. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « src/ic-ia32.cc ('k') | src/log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return two_byte_string; 133 return two_byte_string;
134 } 134 }
135 135
136 136
137 // Converts a source string to a 16 bit flat string or a SlicedString containing 137 // Converts a source string to a 16 bit flat string or a SlicedString containing
138 // a 16 bit flat string). 138 // a 16 bit flat string).
139 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) { 139 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) {
140 StringShape shape(*pattern); 140 StringShape shape(*pattern);
141 if (!pattern->IsFlat(shape)) { 141 if (!pattern->IsFlat(shape)) {
142 FlattenString(pattern); 142 FlattenString(pattern);
143 shape = StringShape(*pattern);
143 } 144 }
144 Handle<String> flat_string(shape.IsCons() ? 145 Handle<String> flat_string(shape.IsCons() ?
145 String::cast(ConsString::cast(*pattern)->first()) : 146 String::cast(ConsString::cast(*pattern)->first()) :
146 *pattern); 147 *pattern);
147 ASSERT(flat_string->IsString()); 148 ASSERT(flat_string->IsString());
148 StringShape flat_shape(*flat_string); 149 StringShape flat_shape(*flat_string);
149 ASSERT(!flat_shape.IsCons()); 150 ASSERT(!flat_shape.IsCons());
150 ASSERT(flat_shape.IsSequential() || 151 ASSERT(flat_shape.IsSequential() ||
151 flat_shape.IsSliced() || 152 flat_shape.IsSliced() ||
152 flat_shape.IsExternal()); 153 flat_shape.IsExternal());
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 &code); 419 &code);
419 420
420 if (code == NULL) { 421 if (code == NULL) {
421 // Throw an exception. 422 // Throw an exception.
422 Handle<JSArray> array = Factory::NewJSArray(2); 423 Handle<JSArray> array = Factory::NewJSArray(2);
423 SetElement(array, 0, pattern); 424 SetElement(array, 0, pattern);
424 SetElement(array, 1, Factory::NewStringFromUtf8(CStrVector( 425 SetElement(array, 1, Factory::NewStringFromUtf8(CStrVector(
425 (error_message == NULL) ? "Unknown regexp error" : error_message))); 426 (error_message == NULL) ? "Unknown regexp error" : error_message)));
426 Handle<Object> regexp_err = 427 Handle<Object> regexp_err =
427 Factory::NewSyntaxError("malformed_regexp", array); 428 Factory::NewSyntaxError("malformed_regexp", array);
428 return Handle<Object>(Top::Throw(*regexp_err)); 429 Top::Throw(*regexp_err);
430 return Handle<Object>();
429 } 431 }
430 432
431 // Convert the return address to a ByteArray pointer. 433 // Convert the return address to a ByteArray pointer.
432 Handle<ByteArray> internal( 434 Handle<ByteArray> internal(
433 ByteArray::FromDataStartAddress(reinterpret_cast<Address>(code))); 435 ByteArray::FromDataStartAddress(reinterpret_cast<Address>(code)));
434 436
435 Handle<FixedArray> value = Factory::NewFixedArray(2); 437 Handle<FixedArray> value = Factory::NewFixedArray(2);
436 value->set(CAPTURE_INDEX, Smi::FromInt(number_of_captures)); 438 value->set(CAPTURE_INDEX, Smi::FromInt(number_of_captures));
437 value->set(INTERNAL_INDEX, *internal); 439 value->set(INTERNAL_INDEX, *internal);
438 Factory::SetRegExpData(re, JSRegExp::JSCRE, pattern, flags, value); 440 Factory::SetRegExpData(re, JSRegExp::JSCRE, pattern, flags, value);
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 analysis.Analyze(node); 1597 analysis.Analyze(node);
1596 return node; 1598 return node;
1597 } 1599 }
1598 1600
1599 1601
1600 RegExpMacroAssembler::~RegExpMacroAssembler() { 1602 RegExpMacroAssembler::~RegExpMacroAssembler() {
1601 } 1603 }
1602 1604
1603 1605
1604 }} // namespace v8::internal 1606 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic-ia32.cc ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698