diff options
Diffstat (limited to 'deps/v8/src/compiler/js-global-object-specialization.cc')
-rw-r--r-- | deps/v8/src/compiler/js-global-object-specialization.cc | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/deps/v8/src/compiler/js-global-object-specialization.cc b/deps/v8/src/compiler/js-global-object-specialization.cc index d8c9f17fd4..5ced04e9c1 100644 --- a/deps/v8/src/compiler/js-global-object-specialization.cc +++ b/deps/v8/src/compiler/js-global-object-specialization.cc @@ -12,7 +12,7 @@ #include "src/compiler/node-properties.h" #include "src/compiler/simplified-operator.h" #include "src/lookup.h" -#include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! +#include "src/objects-inl.h" #include "src/type-cache.h" namespace v8 { @@ -74,6 +74,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) { // properties of the global object here (represented as PropertyCell). LookupIterator it(global_object, name, LookupIterator::OWN); if (it.state() != LookupIterator::DATA) return NoChange(); + if (!it.GetHolder<JSObject>()->IsJSGlobalObject()) return NoChange(); Handle<PropertyCell> property_cell = it.GetPropertyCell(); PropertyDetails property_details = property_cell->property_details(); Handle<Object> property_cell_value(property_cell->value(), isolate()); @@ -130,7 +131,6 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode()); Handle<Name> name = StoreGlobalParametersOf(node->op()).name(); Node* value = NodeProperties::GetValueInput(node, 0); - Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); Node* effect = NodeProperties::GetEffectInput(node); Node* control = NodeProperties::GetControlInput(node); @@ -154,6 +154,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { // properties of the global object here (represented as PropertyCell). LookupIterator it(global_object, name, LookupIterator::OWN); if (it.state() != LookupIterator::DATA) return NoChange(); + if (!it.GetHolder<JSObject>()->IsJSGlobalObject()) return NoChange(); Handle<PropertyCell> property_cell = it.GetPropertyCell(); PropertyDetails property_details = property_cell->property_details(); Handle<Object> property_cell_value(property_cell->value(), isolate()); @@ -168,37 +169,35 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { // 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, - jsgraph()->Constant(property_cell_value)); - control = graph()->NewNode(common()->DeoptimizeUnless(), check, - frame_state, effect, control); + Node* check = graph()->NewNode(simplified()->ReferenceEqual(), value, + jsgraph()->Constant(property_cell_value)); + effect = + graph()->NewNode(simplified()->CheckIf(), check, effect, control); break; } case PropertyCellType::kConstantType: { // 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(); + Type* property_cell_value_type; if (property_cell_value->IsHeapObject()) { - // Deoptimize if the {value} is a Smi. - control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, - effect, control); - - // Load the {value} map check against the {property_cell} map. - Node* value_map = effect = - graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), - value, effect, control); + // Check that the {value} is a HeapObject. + value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), + value, effect, control); + + // Check {value} map agains the {property_cell} map. Handle<Map> property_cell_value_map( Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); - check = graph()->NewNode( - simplified()->ReferenceEqual(Type::Any()), value_map, - jsgraph()->HeapConstant(property_cell_value_map)); + effect = graph()->NewNode( + simplified()->CheckMaps(1), value, + jsgraph()->HeapConstant(property_cell_value_map), effect, control); property_cell_value_type = Type::TaggedPointer(); + } else { + // Check that the {value} is a Smi. + value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), + value, effect, control); + property_cell_value_type = Type::TaggedSigned(); } - control = graph()->NewNode(common()->DeoptimizeUnless(), check, - frame_state, effect, control); effect = graph()->NewNode( simplified()->StoreField( AccessBuilder::ForPropertyCellValue(property_cell_value_type)), |