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

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

Issue 1659463007: [turbofan] Remove untested no-deoptimization code path from JSGlobalObjectSpecialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/js-global-object-specialization.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-global-object-specialization.cc
diff --git a/src/compiler/js-global-object-specialization.cc b/src/compiler/js-global-object-specialization.cc
index e6f01b3efb3fc5e094b9e6693c5ea63bf4705bd3..0f4f75d98f7e55667546eab2c7acff2e3bcf17fa 100644
--- a/src/compiler/js-global-object-specialization.cc
+++ b/src/compiler/js-global-object-specialization.cc
@@ -27,11 +27,10 @@ struct JSGlobalObjectSpecialization::ScriptContextTableLookupResult {
JSGlobalObjectSpecialization::JSGlobalObjectSpecialization(
- Editor* editor, JSGraph* jsgraph, Flags flags,
+ Editor* editor, JSGraph* jsgraph,
MaybeHandle<Context> native_context, CompilationDependencies* dependencies)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
- flags_(flags),
native_context_(native_context),
dependencies_(dependencies),
type_cache_(TypeCache::Get()) {}
@@ -49,7 +48,6 @@ Reduction JSGlobalObjectSpecialization::Reduce(Node* node) {
return NoChange();
}
-
Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode());
Handle<Name> name = LoadGlobalParametersOf(node->op()).name();
@@ -88,47 +86,36 @@ Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) {
return Replace(value);
}
- // Load from non-configurable, data property on the global can be lowered to
- // a field load, even without deoptimization, because the property cannot be
- // deleted or reconfigured to an accessor/interceptor property. Yet, if
- // deoptimization support is available, we can constant-fold certain global
- // properties or at least lower them to field loads annotated with more
- // precise type feedback.
- Type* property_cell_value_type = Type::Tagged();
- if (flags() & kDeoptimizationEnabled) {
- // Record a code dependency on the cell if we can benefit from the
- // additional feedback, or the global property is configurable (i.e.
- // can be deleted or reconfigured to an accessor property).
- if (property_details.cell_type() != PropertyCellType::kMutable ||
- property_details.IsConfigurable()) {
- dependencies()->AssumePropertyCell(property_cell);
- }
+ // Record a code dependency on the cell if we can benefit from the
+ // additional feedback, or the global property is configurable (i.e.
+ // can be deleted or reconfigured to an accessor property).
+ if (property_details.cell_type() != PropertyCellType::kMutable ||
+ property_details.IsConfigurable()) {
+ dependencies()->AssumePropertyCell(property_cell);
+ }
- // Load from constant/undefined global property can be constant-folded.
- if ((property_details.cell_type() == PropertyCellType::kConstant ||
- property_details.cell_type() == PropertyCellType::kUndefined)) {
- Node* value = jsgraph()->Constant(property_cell_value);
- ReplaceWithValue(node, value);
- return Replace(value);
- }
+ // Load from constant/undefined global property can be constant-folded.
+ if (property_details.cell_type() == PropertyCellType::kConstant ||
+ property_details.cell_type() == PropertyCellType::kUndefined) {
+ Node* value = jsgraph()->Constant(property_cell_value);
+ ReplaceWithValue(node, value);
+ return Replace(value);
+ }
- // Load from constant type cell can benefit from type feedback.
- if (property_details.cell_type() == PropertyCellType::kConstantType) {
- // Compute proper type based on the current value in the cell.
- if (property_cell_value->IsSmi()) {
- property_cell_value_type = type_cache_.kSmi;
- } else if (property_cell_value->IsNumber()) {
- property_cell_value_type = type_cache_.kHeapNumber;
- } else {
- Handle<Map> property_cell_value_map(
- Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
- property_cell_value_type =
- Type::Class(property_cell_value_map, graph()->zone());
- }
+ // Load from constant type cell can benefit from type feedback.
+ Type* property_cell_value_type = Type::Tagged();
+ if (property_details.cell_type() == PropertyCellType::kConstantType) {
+ // Compute proper type based on the current value in the cell.
+ if (property_cell_value->IsSmi()) {
+ property_cell_value_type = type_cache_.kSmi;
+ } else if (property_cell_value->IsNumber()) {
+ property_cell_value_type = type_cache_.kHeapNumber;
+ } else {
+ Handle<Map> property_cell_value_map(
+ Handle<HeapObject>::cast(property_cell_value)->map(), isolate());
+ property_cell_value_type =
+ Type::Class(property_cell_value_map, graph()->zone());
}
- } else if (property_details.IsConfigurable()) {
- // Access to configurable global properties requires deoptimization support.
- return NoChange();
}
Node* value = effect = graph()->NewNode(
simplified()->LoadField(
@@ -178,9 +165,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
return NoChange();
}
case PropertyCellType::kConstant: {
- // Store to constant property cell requires deoptimization support,
- // because we might even need to eager deoptimize for mismatch.
- if (!(flags() & kDeoptimizationEnabled)) return NoChange();
+ // Record a code dependency on the cell, and just deoptimize if the new
+ // value doesn't match the previous value stored inside the cell.
dependencies()->AssumePropertyCell(property_cell);
Node* check =
graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value,
@@ -197,9 +183,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
break;
}
case PropertyCellType::kConstantType: {
- // Store to constant-type property cell requires deoptimization support,
- // because we might even need to eager deoptimize for mismatch.
- if (!(flags() & kDeoptimizationEnabled)) return NoChange();
+ // Record a code dependency on the cell, and just deoptimize if the new
+ // values' type doesn't match the type of the previous value in the cell.
dependencies()->AssumePropertyCell(property_cell);
Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
Type* property_cell_value_type = Type::TaggedSigned();
@@ -243,13 +228,11 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
}
case PropertyCellType::kMutable: {
// Store to non-configurable, data property on the global can be lowered
- // to a field store, even without deoptimization, because the property
- // cannot be deleted or reconfigured to an accessor/interceptor property.
+ // to a field store, even without recording a code dependency on the cell,
+ // because the property cannot be deleted or reconfigured to an accessor
+ // or interceptor property.
if (property_details.IsConfigurable()) {
- // With deoptimization support, we can lower stores even to configurable
- // data properties on the global object, by adding a code dependency on
- // the cell.
- if (!(flags() & kDeoptimizationEnabled)) return NoChange();
+ // Protect lowering by recording a code dependency on the cell.
dependencies()->AssumePropertyCell(property_cell);
}
effect = graph()->NewNode(
« no previous file with comments | « src/compiler/js-global-object-specialization.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698