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

Unified Diff: src/compiler/js-global-specialization.cc

Issue 1400483002: [turbofan] Compute proper type for globals with "constant type". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-global-specialization.cc
diff --git a/src/compiler/js-global-specialization.cc b/src/compiler/js-global-specialization.cc
index 4caed2e555d66032bef59839468c34f2280ecb4f..00ade7a9c8546b596c922482ff65b40407f4e308 100644
--- a/src/compiler/js-global-specialization.cc
+++ b/src/compiler/js-global-specialization.cc
@@ -145,17 +145,16 @@ Reduction JSGlobalSpecialization::ReduceLoadFromPropertyCell(
if (property_details.cell_type() == PropertyCellType::kConstantType &&
(flags() & kDeoptimizationEnabled)) {
dependencies()->AssumePropertyCell(property_cell);
- Type* property_cell_value_type = Type::Any();
- switch (property_cell->GetConstantType()) {
- case PropertyCellConstantType::kSmi:
- property_cell_value_type = Type::Intersect(
- Type::SignedSmall(), Type::TaggedSigned(), graph()->zone());
- break;
- case PropertyCellConstantType::kStableMap: {
- // TODO(bmeurer): Determine type based on the map's instance type.
- property_cell_value_type = Type::TaggedPointer();
- break;
- }
+ // Compute proper type based on the current value in the cell.
+ Type* property_cell_value_type;
+ if (property_cell_value->IsSmi()) {
+ property_cell_value_type = Type::Intersect(
+ Type::SignedSmall(), Type::TaggedSigned(), graph()->zone());
+ } else if (property_cell_value->IsNumber()) {
+ property_cell_value_type = Type::Intersect(
+ Type::Number(), Type::TaggedPointer(), graph()->zone());
+ } else {
+ property_cell_value_type = Type::Of(property_cell_value, graph()->zone());
}
Node* value = effect = graph()->NewNode(
simplified()->LoadField(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698