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

Side by Side Diff: src/jsregexp.cc

Issue 6603028: Merge revisions 7030:7051 from bleeding_edge to isolates branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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
« no previous file with comments | « src/json.js ('k') | src/liveobjectlist.cc » ('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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 return JSRegExp::Flags(flags); 90 return JSRegExp::Flags(flags);
91 } 91 }
92 92
93 93
94 static inline void ThrowRegExpException(Handle<JSRegExp> re, 94 static inline void ThrowRegExpException(Handle<JSRegExp> re,
95 Handle<String> pattern, 95 Handle<String> pattern,
96 Handle<String> error_text, 96 Handle<String> error_text,
97 const char* message) { 97 const char* message) {
98 Isolate* isolate = re->GetIsolate(); 98 Isolate* isolate = re->GetIsolate();
99 Handle<JSArray> array = isolate->factory()->NewJSArray(2); 99 Factory* factory = isolate->factory();
100 SetElement(array, 0, pattern); 100 Handle<FixedArray> elements = factory->NewFixedArray(2);
101 SetElement(array, 1, error_text); 101 elements->set(0, *pattern);
102 Handle<Object> regexp_err = isolate->factory()->NewSyntaxError(message, 102 elements->set(1, *error_text);
103 array); 103 Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
104 Handle<Object> regexp_err = factory->NewSyntaxError(message, array);
104 isolate->Throw(*regexp_err); 105 isolate->Throw(*regexp_err);
105 } 106 }
106 107
107 108
108 // Generic RegExp methods. Dispatches to implementation specific methods. 109 // Generic RegExp methods. Dispatches to implementation specific methods.
109 110
110 111
111 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, 112 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
112 Handle<String> pattern, 113 Handle<String> pattern,
113 Handle<String> flag_str) { 114 Handle<String> flag_str) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return false; 331 return false;
331 } 332 }
332 RegExpEngine::CompilationResult result = 333 RegExpEngine::CompilationResult result =
333 RegExpEngine::Compile(&compile_data, 334 RegExpEngine::Compile(&compile_data,
334 flags.is_ignore_case(), 335 flags.is_ignore_case(),
335 flags.is_multiline(), 336 flags.is_multiline(),
336 pattern, 337 pattern,
337 is_ascii); 338 is_ascii);
338 if (result.error_message != NULL) { 339 if (result.error_message != NULL) {
339 // Unable to compile regexp. 340 // Unable to compile regexp.
340 Handle<JSArray> array = isolate->factory()->NewJSArray(2); 341 Factory* factory = isolate->factory();
341 SetElement(array, 0, pattern); 342 Handle<FixedArray> elements = factory->NewFixedArray(2);
342 SetElement(array, 343 elements->set(0, *pattern);
343 1, 344 Handle<String> error_message =
344 isolate->factory()-> 345 factory->NewStringFromUtf8(CStrVector(result.error_message));
345 NewStringFromUtf8(CStrVector(result.error_message))); 346 elements->set(1, *error_message);
347 Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
346 Handle<Object> regexp_err = 348 Handle<Object> regexp_err =
347 isolate->factory()->NewSyntaxError("malformed_regexp", array); 349 factory->NewSyntaxError("malformed_regexp", array);
348 isolate->Throw(*regexp_err); 350 isolate->Throw(*regexp_err);
349 re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err); 351 re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err);
350 return false; 352 return false;
351 } 353 }
352 354
353 Handle<FixedArray> data = Handle<FixedArray>(FixedArray::cast(re->data())); 355 Handle<FixedArray> data = Handle<FixedArray>(FixedArray::cast(re->data()));
354 data->set(JSRegExp::code_index(is_ascii), result.code); 356 data->set(JSRegExp::code_index(is_ascii), result.code);
355 int register_max = IrregexpMaxRegisterCount(*data); 357 int register_max = IrregexpMaxRegisterCount(*data);
356 if (result.num_registers > register_max) { 358 if (result.num_registers > register_max) {
357 SetIrregexpMaxRegisterCount(*data, result.num_registers); 359 SetIrregexpMaxRegisterCount(*data, result.num_registers);
(...skipping 4995 matching lines...) Expand 10 before | Expand all | Expand 10 after
5353 } 5355 }
5354 5356
5355 return compiler.Assemble(&macro_assembler, 5357 return compiler.Assemble(&macro_assembler,
5356 node, 5358 node,
5357 data->capture_count, 5359 data->capture_count,
5358 pattern); 5360 pattern);
5359 } 5361 }
5360 5362
5361 5363
5362 }} // namespace v8::internal 5364 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json.js ('k') | src/liveobjectlist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698