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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/json.js ('k') | src/liveobjectlist.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
===================================================================
--- src/jsregexp.cc (revision 7051)
+++ src/jsregexp.cc (working copy)
@@ -96,11 +96,12 @@
Handle<String> error_text,
const char* message) {
Isolate* isolate = re->GetIsolate();
- Handle<JSArray> array = isolate->factory()->NewJSArray(2);
- SetElement(array, 0, pattern);
- SetElement(array, 1, error_text);
- Handle<Object> regexp_err = isolate->factory()->NewSyntaxError(message,
- array);
+ Factory* factory = isolate->factory();
+ Handle<FixedArray> elements = factory->NewFixedArray(2);
+ elements->set(0, *pattern);
+ elements->set(1, *error_text);
+ Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
+ Handle<Object> regexp_err = factory->NewSyntaxError(message, array);
isolate->Throw(*regexp_err);
}
@@ -337,14 +338,15 @@
is_ascii);
if (result.error_message != NULL) {
// Unable to compile regexp.
- Handle<JSArray> array = isolate->factory()->NewJSArray(2);
- SetElement(array, 0, pattern);
- SetElement(array,
- 1,
- isolate->factory()->
- NewStringFromUtf8(CStrVector(result.error_message)));
+ Factory* factory = isolate->factory();
+ Handle<FixedArray> elements = factory->NewFixedArray(2);
+ elements->set(0, *pattern);
+ Handle<String> error_message =
+ factory->NewStringFromUtf8(CStrVector(result.error_message));
+ elements->set(1, *error_message);
+ Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
Handle<Object> regexp_err =
- isolate->factory()->NewSyntaxError("malformed_regexp", array);
+ factory->NewSyntaxError("malformed_regexp", array);
isolate->Throw(*regexp_err);
re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err);
return false;
« 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