| 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
| 6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 | 10 |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 Bind(&if_done); | 1302 Bind(&if_done); |
| 1303 return var_result.value(); | 1303 return var_result.value(); |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, | 1306 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, |
| 1307 uint32_t mask) { | 1307 uint32_t mask) { |
| 1308 return Word32Shr(Word32And(word32, Int32Constant(mask)), | 1308 return Word32Shr(Word32And(word32, Int32Constant(mask)), |
| 1309 Int32Constant(shift)); | 1309 Int32Constant(shift)); |
| 1310 } | 1310 } |
| 1311 | 1311 |
| 1312 #define ENABLE_TRAMPOLINE_WORKAROUND 0 |
| 1313 |
| 1314 void CodeStubAssembler::Boom() { |
| 1315 Node* object = IntPtrConstant(1); |
| 1316 Node* context = NoContextConstant(); |
| 1317 |
| 1318 Label call_runtime(this), return_true(this); |
| 1319 |
| 1320 Label if_keyisindex(this), if_keyisnotindex(this); |
| 1321 { |
| 1322 Label if_ok(this); |
| 1323 Branch(WordEqual(object, IntPtrConstant(1)), &return_true, &if_ok); |
| 1324 Bind(&if_ok); |
| 1325 } |
| 1326 Branch(WordEqual(object, IntPtrConstant(2)), &if_keyisnotindex, |
| 1327 &call_runtime); |
| 1328 |
| 1329 Bind(&if_keyisnotindex); |
| 1330 { |
| 1331 Variable var_boom(this, MachineRepresentation::kWord32); |
| 1332 |
| 1333 #if ENABLE_TRAMPOLINE_WORKAROUND |
| 1334 Label return_true_trampo(this); |
| 1335 #endif |
| 1336 Label outer_loop(this, &var_boom); |
| 1337 var_boom.Bind(Int32Constant(1)); |
| 1338 Goto(&outer_loop); |
| 1339 Bind(&outer_loop); |
| 1340 { |
| 1341 Label next_outer(this); |
| 1342 { |
| 1343 Label if_isfastmap(this), if_isslowmap(this); |
| 1344 Branch(WordEqual(object, IntPtrConstant(10)), &if_isfastmap, |
| 1345 &if_isslowmap); |
| 1346 |
| 1347 Bind(&if_isfastmap); |
| 1348 { |
| 1349 Label inner_loop(this, &var_boom); |
| 1350 Goto(&inner_loop); |
| 1351 Bind(&inner_loop); |
| 1352 { |
| 1353 #if ENABLE_TRAMPOLINE_WORKAROUND |
| 1354 Branch(WordEqual(object, IntPtrConstant(20)), &next_outer, |
| 1355 &return_true_trampo); |
| 1356 #else |
| 1357 Branch(WordEqual(object, IntPtrConstant(20)), &next_outer, |
| 1358 &return_true); |
| 1359 #endif |
| 1360 } |
| 1361 } |
| 1362 |
| 1363 Bind(&if_isslowmap); |
| 1364 { |
| 1365 #if ENABLE_TRAMPOLINE_WORKAROUND |
| 1366 Goto(&return_true_trampo); |
| 1367 #else |
| 1368 Goto(&return_true); |
| 1369 #endif |
| 1370 } |
| 1371 } |
| 1372 Bind(&next_outer); |
| 1373 var_boom.Bind(Int32Constant(2)); |
| 1374 Goto(&outer_loop); |
| 1375 |
| 1376 #if ENABLE_TRAMPOLINE_WORKAROUND |
| 1377 Bind(&return_true_trampo); |
| 1378 Goto(&return_true); |
| 1379 #endif |
| 1380 } |
| 1381 } |
| 1382 |
| 1383 Bind(&return_true); |
| 1384 Return(BooleanConstant(true)); |
| 1385 |
| 1386 Bind(&call_runtime); |
| 1387 TailCallRuntime(Runtime::kSystemBreak, context); |
| 1388 } |
| 1389 |
| 1312 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, | 1390 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, |
| 1313 Variable* var_index, Label* if_keyisunique, | 1391 Variable* var_index, Label* if_keyisunique, |
| 1314 Label* call_runtime) { | 1392 Label* call_runtime) { |
| 1315 DCHECK_EQ(MachineRepresentation::kWord32, var_index->rep()); | 1393 DCHECK_EQ(MachineRepresentation::kWord32, var_index->rep()); |
| 1316 | 1394 |
| 1317 Label if_keyissmi(this), if_keyisnotsmi(this); | 1395 Label if_keyissmi(this), if_keyisnotsmi(this); |
| 1318 Branch(WordIsSmi(key), &if_keyissmi, &if_keyisnotsmi); | 1396 Branch(WordIsSmi(key), &if_keyissmi, &if_keyisnotsmi); |
| 1319 Bind(&if_keyissmi); | 1397 Bind(&if_keyissmi); |
| 1320 { | 1398 { |
| 1321 // Negative smi keys are named properties. Handle in the runtime. | 1399 // Negative smi keys are named properties. Handle in the runtime. |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 } | 1694 } |
| 1617 return IntPtrAdd( | 1695 return IntPtrAdd( |
| 1618 IntPtrConstant(base_size), | 1696 IntPtrConstant(base_size), |
| 1619 (element_size_shift >= 0) | 1697 (element_size_shift >= 0) |
| 1620 ? WordShl(index_node, IntPtrConstant(element_size_shift)) | 1698 ? WordShl(index_node, IntPtrConstant(element_size_shift)) |
| 1621 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 1699 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
| 1622 } | 1700 } |
| 1623 | 1701 |
| 1624 } // namespace internal | 1702 } // namespace internal |
| 1625 } // namespace v8 | 1703 } // namespace v8 |
| OLD | NEW |