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

Unified Diff: src/factory.cc

Issue 2683903002: Fix missing cases of empty_string canonicalization (Closed)
Patch Set: make LSan happy Created 3 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/arm64/macro-assembler-arm64.cc ('k') | src/mips/macro-assembler-mips.h » ('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 a876f9f6fc3ae0ec933f4bdffc848903cab95b8d..24f3a0ada74d549b4e368fd8328bb63366cc41c1 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -820,6 +820,7 @@ MaybeHandle<String> Factory::NewExternalStringFromOneByte(
if (length > static_cast<size_t>(String::kMaxLength)) {
THROW_NEW_ERROR(isolate(), NewInvalidStringLengthError(), String);
}
+ if (length == 0) return empty_string();
Handle<Map> map;
if (resource->IsCompressible()) {
@@ -844,6 +845,7 @@ MaybeHandle<String> Factory::NewExternalStringFromTwoByte(
if (length > static_cast<size_t>(String::kMaxLength)) {
THROW_NEW_ERROR(isolate(), NewInvalidStringLengthError(), String);
}
+ if (length == 0) return empty_string();
// For small strings we check whether the resource contains only
// one byte characters. If yes, we use a different string map.
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698