| OLD | NEW |
| 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/effect-control-linearizer.h" | 5 #include "src/compiler/effect-control-linearizer.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 __ GotoUnless(check, &migrate); | 1095 __ GotoUnless(check, &migrate); |
| 1096 __ Goto(&done); | 1096 __ Goto(&done); |
| 1097 } else { | 1097 } else { |
| 1098 __ GotoIf(check, &done); | 1098 __ GotoIf(check, &done); |
| 1099 } | 1099 } |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 // Perform the (deferred) instance migration. | 1102 // Perform the (deferred) instance migration. |
| 1103 __ Bind(&migrate); | 1103 __ Bind(&migrate); |
| 1104 { | 1104 { |
| 1105 auto migration_failed = __ MakeLabel<2>(); | |
| 1106 auto retry_check_maps = __ MakeLabel<2>(); | |
| 1107 | |
| 1108 // If map is not deprecated the migration attempt does not make sense. | 1105 // If map is not deprecated the migration attempt does not make sense. |
| 1109 Node* bitfield3 = | 1106 Node* bitfield3 = |
| 1110 __ LoadField(AccessBuilder::ForMapBitField3(), value_map); | 1107 __ LoadField(AccessBuilder::ForMapBitField3(), value_map); |
| 1111 Node* if_not_deprecated = __ WordEqual( | 1108 Node* if_not_deprecated = __ WordEqual( |
| 1112 __ Word32And(bitfield3, __ Int32Constant(Map::Deprecated::kMask)), | 1109 __ Word32And(bitfield3, __ Int32Constant(Map::Deprecated::kMask)), |
| 1113 __ Int32Constant(0)); | 1110 __ Int32Constant(0)); |
| 1114 __ GotoIf(if_not_deprecated, &migration_failed); | 1111 __ DeoptimizeIf(DeoptimizeReason::kWrongMap, if_not_deprecated, |
| 1112 frame_state); |
| 1115 | 1113 |
| 1116 Operator::Properties properties = Operator::kNoDeopt | Operator::kNoThrow; | 1114 Operator::Properties properties = Operator::kNoDeopt | Operator::kNoThrow; |
| 1117 Runtime::FunctionId id = Runtime::kTryMigrateInstance; | 1115 Runtime::FunctionId id = Runtime::kTryMigrateInstance; |
| 1118 CallDescriptor const* desc = Linkage::GetRuntimeCallDescriptor( | 1116 CallDescriptor const* desc = Linkage::GetRuntimeCallDescriptor( |
| 1119 graph()->zone(), id, 1, properties, CallDescriptor::kNoFlags); | 1117 graph()->zone(), id, 1, properties, CallDescriptor::kNoFlags); |
| 1120 Node* result = | 1118 Node* result = |
| 1121 __ Call(desc, __ CEntryStubConstant(1), value, | 1119 __ Call(desc, __ CEntryStubConstant(1), value, |
| 1122 __ ExternalConstant(ExternalReference(id, isolate())), | 1120 __ ExternalConstant(ExternalReference(id, isolate())), |
| 1123 __ Int32Constant(1), __ NoContextConstant()); | 1121 __ Int32Constant(1), __ NoContextConstant()); |
| 1124 Node* check = ObjectIsSmi(result); | 1122 Node* check = ObjectIsSmi(result); |
| 1125 __ GotoIf(check, &retry_check_maps); | 1123 __ DeoptimizeIf(DeoptimizeReason::kInstanceMigrationFailed, check, |
| 1126 __ Goto(&migration_failed); | 1124 frame_state); |
| 1127 | |
| 1128 __ Bind(&migration_failed); | |
| 1129 __ DeoptimizeIf(DeoptimizeReason::kInstanceMigrationFailed, | |
| 1130 __ Int32Constant(1), frame_state); | |
| 1131 | |
| 1132 __ Goto(&retry_check_maps); | |
| 1133 __ Bind(&retry_check_maps); | |
| 1134 } | 1125 } |
| 1135 | 1126 |
| 1136 // Reload the current map of the {value}. | 1127 // Reload the current map of the {value}. |
| 1137 value_map = __ LoadField(AccessBuilder::ForMap(), value); | 1128 value_map = __ LoadField(AccessBuilder::ForMap(), value); |
| 1138 | 1129 |
| 1139 // Perform the map checks again. | 1130 // Perform the map checks again. |
| 1140 for (size_t i = 0; i < map_count; ++i) { | 1131 for (size_t i = 0; i < map_count; ++i) { |
| 1141 Node* map = __ HeapConstant(maps[i]); | 1132 Node* map = __ HeapConstant(maps[i]); |
| 1142 Node* check = __ WordEqual(value_map, map); | 1133 Node* check = __ WordEqual(value_map, map); |
| 1143 if (i == map_count - 1) { | 1134 if (i == map_count - 1) { |
| (...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 return isolate()->factory(); | 2786 return isolate()->factory(); |
| 2796 } | 2787 } |
| 2797 | 2788 |
| 2798 Isolate* EffectControlLinearizer::isolate() const { | 2789 Isolate* EffectControlLinearizer::isolate() const { |
| 2799 return jsgraph()->isolate(); | 2790 return jsgraph()->isolate(); |
| 2800 } | 2791 } |
| 2801 | 2792 |
| 2802 } // namespace compiler | 2793 } // namespace compiler |
| 2803 } // namespace internal | 2794 } // namespace internal |
| 2804 } // namespace v8 | 2795 } // namespace v8 |
| OLD | NEW |