| 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 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
| 8 #include "src/frames.h" | 8 #include "src/frames.h" |
| 9 #include "src/ic/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 Node* CodeStubAssembler::WordIsSmi(Node* a) { | 491 Node* CodeStubAssembler::WordIsSmi(Node* a) { |
| 492 return WordEqual(WordAnd(a, IntPtrConstant(kSmiTagMask)), IntPtrConstant(0)); | 492 return WordEqual(WordAnd(a, IntPtrConstant(kSmiTagMask)), IntPtrConstant(0)); |
| 493 } | 493 } |
| 494 | 494 |
| 495 Node* CodeStubAssembler::WordIsPositiveSmi(Node* a) { | 495 Node* CodeStubAssembler::WordIsPositiveSmi(Node* a) { |
| 496 return WordEqual(WordAnd(a, IntPtrConstant(kSmiTagMask | kSmiSignMask)), | 496 return WordEqual(WordAnd(a, IntPtrConstant(kSmiTagMask | kSmiSignMask)), |
| 497 IntPtrConstant(0)); | 497 IntPtrConstant(0)); |
| 498 } | 498 } |
| 499 | 499 |
| 500 void CodeStubAssembler::BranchIfSameValueZero(Node* a, Node* b, Node* context, | |
| 501 Label* if_true, Label* if_false) { | |
| 502 Node* number_map = HeapNumberMapConstant(); | |
| 503 Label a_isnumber(this), a_isnotnumber(this), b_isnumber(this), a_isnan(this), | |
| 504 float_not_equal(this); | |
| 505 // If register A and register B are identical, goto `if_true` | |
| 506 GotoIf(WordEqual(a, b), if_true); | |
| 507 // If either register A or B are Smis, goto `if_false` | |
| 508 GotoIf(Word32Or(WordIsSmi(a), WordIsSmi(b)), if_false); | |
| 509 // GotoIf(WordIsSmi(b), if_false); | |
| 510 | |
| 511 Node* a_map = LoadMap(a); | |
| 512 Node* b_map = LoadMap(b); | |
| 513 Branch(WordEqual(a_map, number_map), &a_isnumber, &a_isnotnumber); | |
| 514 | |
| 515 // If both register A and B are HeapNumbers, return true if they are equal, | |
| 516 // or if both are NaN | |
| 517 Bind(&a_isnumber); | |
| 518 { | |
| 519 Branch(WordEqual(b_map, number_map), &b_isnumber, if_false); | |
| 520 | |
| 521 Bind(&b_isnumber); | |
| 522 Node* a_value = LoadHeapNumberValue(a); | |
| 523 Node* b_value = LoadHeapNumberValue(b); | |
| 524 BranchIfFloat64Equal(a_value, b_value, if_true, &float_not_equal); | |
| 525 | |
| 526 Bind(&float_not_equal); | |
| 527 BranchIfFloat64IsNaN(a_value, &a_isnan, if_false); | |
| 528 | |
| 529 Bind(&a_isnan); | |
| 530 BranchIfFloat64IsNaN(a_value, if_true, if_false); | |
| 531 } | |
| 532 | |
| 533 Bind(&a_isnotnumber); | |
| 534 { | |
| 535 Label a_isstring(this), a_isnotstring(this); | |
| 536 Node* a_instance_type = LoadMapInstanceType(a_map); | |
| 537 | |
| 538 Branch(Int32LessThan(a_instance_type, Int32Constant(FIRST_NONSTRING_TYPE)), | |
| 539 &a_isstring, &a_isnotstring); | |
| 540 | |
| 541 Bind(&a_isstring); | |
| 542 { | |
| 543 Label b_isstring(this), b_isnotstring(this); | |
| 544 Node* b_instance_type = LoadInstanceType(b_map); | |
| 545 | |
| 546 Branch( | |
| 547 Int32LessThan(b_instance_type, Int32Constant(FIRST_NONSTRING_TYPE)), | |
| 548 &b_isstring, if_false); | |
| 549 | |
| 550 Bind(&b_isstring); | |
| 551 { | |
| 552 Callable callable = CodeFactory::StringEqual(isolate()); | |
| 553 Node* result = CallStub(callable, context, a, b); | |
| 554 Branch(WordEqual(BooleanConstant(true), result), if_true, if_false); | |
| 555 } | |
| 556 } | |
| 557 | |
| 558 Bind(&a_isnotstring); | |
| 559 { | |
| 560 // Check if {lhs} is a Simd128Value. | |
| 561 Label a_issimd128value(this); | |
| 562 Branch(Word32Equal(a_instance_type, Int32Constant(SIMD128_VALUE_TYPE)), | |
| 563 &a_issimd128value, if_false); | |
| 564 | |
| 565 Bind(&a_issimd128value); | |
| 566 { | |
| 567 // Load the map of {rhs}. | |
| 568 BranchIfSimd128Equal(a, a_map, b, b_map, if_true, if_false); | |
| 569 } | |
| 570 } | |
| 571 } | |
| 572 } | |
| 573 | |
| 574 void CodeStubAssembler::BranchIfSimd128Equal(Node* lhs, Node* lhs_map, | 500 void CodeStubAssembler::BranchIfSimd128Equal(Node* lhs, Node* lhs_map, |
| 575 Node* rhs, Node* rhs_map, | 501 Node* rhs, Node* rhs_map, |
| 576 Label* if_equal, | 502 Label* if_equal, |
| 577 Label* if_notequal) { | 503 Label* if_notequal) { |
| 578 Label if_mapsame(this), if_mapnotsame(this); | 504 Label if_mapsame(this), if_mapnotsame(this); |
| 579 Branch(WordEqual(lhs_map, rhs_map), &if_mapsame, &if_mapnotsame); | 505 Branch(WordEqual(lhs_map, rhs_map), &if_mapsame, &if_mapnotsame); |
| 580 | 506 |
| 581 Bind(&if_mapsame); | 507 Bind(&if_mapsame); |
| 582 { | 508 { |
| 583 // Both {lhs} and {rhs} are Simd128Values with the same map, need special | 509 // Both {lhs} and {rhs} are Simd128Values with the same map, need special |
| (...skipping 4753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5337 Heap::kTheHoleValueRootIndex); | 5263 Heap::kTheHoleValueRootIndex); |
| 5338 | 5264 |
| 5339 // Store the WeakCell in the feedback vector. | 5265 // Store the WeakCell in the feedback vector. |
| 5340 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5266 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
| 5341 CodeStubAssembler::SMI_PARAMETERS); | 5267 CodeStubAssembler::SMI_PARAMETERS); |
| 5342 return cell; | 5268 return cell; |
| 5343 } | 5269 } |
| 5344 | 5270 |
| 5345 } // namespace internal | 5271 } // namespace internal |
| 5346 } // namespace v8 | 5272 } // namespace v8 |
| OLD | NEW |