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

Unified Diff: src/factory.cc

Issue 2736383003: [regexp] Properly flatten string during initialization (Closed)
Patch Set: Better DCHECKs Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 340bd50a774554834fa08c07166fde4546df100e..e19b331491a7a32735c3dae8e3ca42f21bbebfed 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -711,10 +711,20 @@ MaybeHandle<String> Factory::NewConsString(Handle<String> left,
NewRawTwoByteString(length).ToHandleChecked(), left, right);
}
+ bool one_byte = (is_one_byte || is_one_byte_data_in_two_byte_string);
+ return NewConsString(left, right, length, one_byte);
+}
+
+Handle<String> Factory::NewConsString(Handle<String> left, Handle<String> right,
+ int length, bool one_byte) {
+ DCHECK(!left->IsThinString());
+ DCHECK(!right->IsThinString());
+ DCHECK_GE(length, ConsString::kMinLength);
+ DCHECK_LE(length, String::kMaxLength);
+
Handle<ConsString> result =
- (is_one_byte || is_one_byte_data_in_two_byte_string)
- ? New<ConsString>(cons_one_byte_string_map(), NEW_SPACE)
- : New<ConsString>(cons_string_map(), NEW_SPACE);
+ one_byte ? New<ConsString>(cons_one_byte_string_map(), NEW_SPACE)
+ : New<ConsString>(cons_string_map(), NEW_SPACE);
DisallowHeapAllocation no_gc;
WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
« no previous file with comments | « src/factory.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698