| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 if (dominator->opcode() == IrOpcode::kCheckMaps && | 904 if (dominator->opcode() == IrOpcode::kCheckMaps && |
| 905 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { | 905 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { |
| 906 ZoneHandleSet<Map> const& maps = | 906 ZoneHandleSet<Map> const& maps = |
| 907 CheckMapsParametersOf(dominator->op()).maps(); | 907 CheckMapsParametersOf(dominator->op()).maps(); |
| 908 // Check if all maps have the given {instance_type}. | 908 // Check if all maps have the given {instance_type}. |
| 909 for (size_t i = 0; i < maps.size(); ++i) { | 909 for (size_t i = 0; i < maps.size(); ++i) { |
| 910 if (maps[i]->instance_type() != instance_type) return false; | 910 if (maps[i]->instance_type() != instance_type) return false; |
| 911 } | 911 } |
| 912 return true; | 912 return true; |
| 913 } | 913 } |
| 914 switch (dominator->opcode()) { | 914 // The instance type doesn't change for JSReceiver values, so we |
| 915 case IrOpcode::kStoreField: { | 915 // don't need to pay attention to potentially side-effecting nodes |
| 916 FieldAccess const& access = FieldAccessOf(dominator->op()); | 916 // here. Strings and internal structures like FixedArray and |
| 917 if (access.base_is_tagged == kTaggedBase && | 917 // FixedDoubleArray are weird here, but we don't use this function then. |
| 918 access.offset == HeapObject::kMapOffset) { | 918 DCHECK_LE(FIRST_JS_RECEIVER_TYPE, instance_type); |
| 919 return false; | 919 DCHECK_EQ(1, dominator->op()->EffectOutputCount()); |
| 920 } | 920 if (dominator->op()->EffectInputCount() != 1) { |
| 921 break; | 921 // Didn't find any appropriate CheckMaps node. |
| 922 } | 922 return false; |
| 923 case IrOpcode::kStoreElement: | |
| 924 case IrOpcode::kStoreTypedElement: | |
| 925 break; | |
| 926 default: { | |
| 927 DCHECK_EQ(1, dominator->op()->EffectOutputCount()); | |
| 928 if (dominator->op()->EffectInputCount() != 1 || | |
| 929 !dominator->op()->HasProperty(Operator::kNoWrite)) { | |
| 930 // Didn't find any appropriate CheckMaps node. | |
| 931 return false; | |
| 932 } | |
| 933 break; | |
| 934 } | |
| 935 } | 923 } |
| 936 dominator = NodeProperties::GetEffectInput(dominator); | 924 dominator = NodeProperties::GetEffectInput(dominator); |
| 937 } | 925 } |
| 938 } | 926 } |
| 939 | 927 |
| 940 } // namespace | 928 } // namespace |
| 941 | 929 |
| 942 // ES6 section 20.3.3.1 Date.now ( ) | 930 // ES6 section 20.3.3.1 Date.now ( ) |
| 943 Reduction JSBuiltinReducer::ReduceDateNow(Node* node) { | 931 Reduction JSBuiltinReducer::ReduceDateNow(Node* node) { |
| 944 NodeProperties::RemoveValueInputs(node); | 932 NodeProperties::RemoveValueInputs(node); |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 return jsgraph()->simplified(); | 2158 return jsgraph()->simplified(); |
| 2171 } | 2159 } |
| 2172 | 2160 |
| 2173 JSOperatorBuilder* JSBuiltinReducer::javascript() const { | 2161 JSOperatorBuilder* JSBuiltinReducer::javascript() const { |
| 2174 return jsgraph()->javascript(); | 2162 return jsgraph()->javascript(); |
| 2175 } | 2163 } |
| 2176 | 2164 |
| 2177 } // namespace compiler | 2165 } // namespace compiler |
| 2178 } // namespace internal | 2166 } // namespace internal |
| 2179 } // namespace v8 | 2167 } // namespace v8 |
| OLD | NEW |