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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-global-specialization.h" 5 #include "src/compiler/js-global-specialization.h"
6 6
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/js-operator.h" 10 #include "src/compiler/js-operator.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 dependencies()->AssumePropertyCell(property_cell); 138 dependencies()->AssumePropertyCell(property_cell);
139 return Replace(node, property_cell_value); 139 return Replace(node, property_cell_value);
140 } 140 }
141 // Not much we can do if we run the generic pipeline here. 141 // Not much we can do if we run the generic pipeline here.
142 if (!(flags() & kTypingEnabled)) return NoChange(); 142 if (!(flags() & kTypingEnabled)) return NoChange();
143 // Load from constant type global property can benefit from representation 143 // Load from constant type global property can benefit from representation
144 // (and map) feedback with deoptimization support (requires code dependency). 144 // (and map) feedback with deoptimization support (requires code dependency).
145 if (property_details.cell_type() == PropertyCellType::kConstantType && 145 if (property_details.cell_type() == PropertyCellType::kConstantType &&
146 (flags() & kDeoptimizationEnabled)) { 146 (flags() & kDeoptimizationEnabled)) {
147 dependencies()->AssumePropertyCell(property_cell); 147 dependencies()->AssumePropertyCell(property_cell);
148 Type* property_cell_value_type = Type::Any(); 148 // Compute proper type based on the current value in the cell.
149 switch (property_cell->GetConstantType()) { 149 Type* property_cell_value_type;
150 case PropertyCellConstantType::kSmi: 150 if (property_cell_value->IsSmi()) {
151 property_cell_value_type = Type::Intersect( 151 property_cell_value_type = Type::Intersect(
152 Type::SignedSmall(), Type::TaggedSigned(), graph()->zone()); 152 Type::SignedSmall(), Type::TaggedSigned(), graph()->zone());
153 break; 153 } else if (property_cell_value->IsNumber()) {
154 case PropertyCellConstantType::kStableMap: { 154 property_cell_value_type = Type::Intersect(
155 // TODO(bmeurer): Determine type based on the map's instance type. 155 Type::Number(), Type::TaggedPointer(), graph()->zone());
156 property_cell_value_type = Type::TaggedPointer(); 156 } else {
157 break; 157 property_cell_value_type = Type::Of(property_cell_value, graph()->zone());
158 }
159 } 158 }
160 Node* value = effect = graph()->NewNode( 159 Node* value = effect = graph()->NewNode(
161 simplified()->LoadField( 160 simplified()->LoadField(
162 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), 161 AccessBuilder::ForPropertyCellValue(property_cell_value_type)),
163 jsgraph()->Constant(property_cell), effect, control); 162 jsgraph()->Constant(property_cell), effect, control);
164 return Replace(node, value, effect); 163 return Replace(node, value, effect);
165 } 164 }
166 // Load from non-configurable, data property on the global can be lowered to 165 // Load from non-configurable, data property on the global can be lowered to
167 // a field load, even without deoptimization, because the property cannot be 166 // a field load, even without deoptimization, because the property cannot be
168 // deleted or reconfigured to an accessor/interceptor property. 167 // deleted or reconfigured to an accessor/interceptor property.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 230 }
232 231
233 232
234 JSOperatorBuilder* JSGlobalSpecialization::javascript() const { 233 JSOperatorBuilder* JSGlobalSpecialization::javascript() const {
235 return jsgraph()->javascript(); 234 return jsgraph()->javascript();
236 } 235 }
237 236
238 } // namespace compiler 237 } // namespace compiler
239 } // namespace internal 238 } // namespace internal
240 } // namespace v8 239 } // namespace v8
OLDNEW
« 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