| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/typed-optimization.h" | 5 #include "src/compiler/typed-optimization.h" |
| 6 | 6 |
| 7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return ReduceSelect(node); | 91 return ReduceSelect(node); |
| 92 default: | 92 default: |
| 93 break; | 93 break; |
| 94 } | 94 } |
| 95 return NoChange(); | 95 return NoChange(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 namespace { | 98 namespace { |
| 99 | 99 |
| 100 MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) { | 100 MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) { |
| 101 if (object_type->IsHeapConstant() && | 101 if (object_type->IsHeapConstant()) { |
| 102 object_type->AsHeapConstant()->Value()->IsHeapObject()) { | 102 Handle<Map> object_map(object_type->AsHeapConstant()->Value()->map()); |
| 103 Handle<Map> object_map( | |
| 104 Handle<HeapObject>::cast(object_type->AsHeapConstant()->Value()) | |
| 105 ->map()); | |
| 106 if (object_map->is_stable()) return object_map; | 103 if (object_map->is_stable()) return object_map; |
| 107 } | 104 } |
| 108 return MaybeHandle<Map>(); | 105 return MaybeHandle<Map>(); |
| 109 } | 106 } |
| 110 | 107 |
| 111 } // namespace | 108 } // namespace |
| 112 | 109 |
| 113 Reduction TypedOptimization::ReduceCheckMaps(Node* node) { | 110 Reduction TypedOptimization::ReduceCheckMaps(Node* node) { |
| 114 // The CheckMaps(o, ...map...) can be eliminated if map is stable, | 111 // The CheckMaps(o, ...map...) can be eliminated if map is stable, |
| 115 // o has type Constant(object) and map == object->map, and either | 112 // o has type Constant(object) and map == object->map, and either |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 244 |
| 248 Isolate* TypedOptimization::isolate() const { return jsgraph()->isolate(); } | 245 Isolate* TypedOptimization::isolate() const { return jsgraph()->isolate(); } |
| 249 | 246 |
| 250 SimplifiedOperatorBuilder* TypedOptimization::simplified() const { | 247 SimplifiedOperatorBuilder* TypedOptimization::simplified() const { |
| 251 return jsgraph()->simplified(); | 248 return jsgraph()->simplified(); |
| 252 } | 249 } |
| 253 | 250 |
| 254 } // namespace compiler | 251 } // namespace compiler |
| 255 } // namespace internal | 252 } // namespace internal |
| 256 } // namespace v8 | 253 } // namespace v8 |
| OLD | NEW |