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

Unified Diff: src/compiler/types.cc

Issue 2681273002: [turbofan] Utilize the fact that empty string is canonicalized. (Closed)
Patch Set: Feedback. Cleanup. 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/compiler/types.h ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/types.cc
diff --git a/src/compiler/types.cc b/src/compiler/types.cc
index 8a6484ec49132653f5225997c442cd8ffbc352f2..3b1da08ad2ab063f4f5cda8f72e74a68c2d766b7 100644
--- a/src/compiler/types.cc
+++ b/src/compiler/types.cc
@@ -464,7 +464,7 @@ HeapConstantType::HeapConstantType(BitsetType::bitset bitset,
i::Handle<i::HeapObject> object)
: TypeBase(kHeapConstant), bitset_(bitset), object_(object) {
DCHECK(!object->IsHeapNumber());
- DCHECK(!object->IsString());
+ DCHECK_IMPLIES(object->IsString(), object->IsInternalizedString());
}
// -----------------------------------------------------------------------------
@@ -840,17 +840,8 @@ Type* Type::NewConstant(i::Handle<i::Object> value, Zone* zone) {
return Range(v, v, zone);
} else if (value->IsHeapNumber()) {
return NewConstant(value->Number(), zone);
- } else if (value->IsString()) {
- bitset b = BitsetType::Lub(*value);
- DCHECK(b == BitsetType::kInternalizedString ||
- b == BitsetType::kOtherString);
- if (b == BitsetType::kInternalizedString) {
- return Type::InternalizedString();
- } else if (b == BitsetType::kOtherString) {
- return Type::OtherString();
- } else {
- UNREACHABLE();
- }
+ } else if (value->IsString() && !value->IsInternalizedString()) {
+ return Type::OtherString();
}
return HeapConstant(i::Handle<i::HeapObject>::cast(value), zone);
}
« no previous file with comments | « src/compiler/types.h ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698