| 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
| 5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
| 7 #include "src/frames.h" | 7 #include "src/frames.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 7305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7316 Bind(&if_notequal); | 7316 Bind(&if_notequal); |
| 7317 { | 7317 { |
| 7318 result.Bind(BooleanConstant(mode == kNegateResult)); | 7318 result.Bind(BooleanConstant(mode == kNegateResult)); |
| 7319 Goto(&end); | 7319 Goto(&end); |
| 7320 } | 7320 } |
| 7321 | 7321 |
| 7322 Bind(&end); | 7322 Bind(&end); |
| 7323 return result.value(); | 7323 return result.value(); |
| 7324 } | 7324 } |
| 7325 | 7325 |
| 7326 Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs, | 7326 Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, Node* context) { |
| 7327 Node* context) { | |
| 7328 // Here's pseudo-code for the algorithm below in case of kDontNegateResult | 7327 // Here's pseudo-code for the algorithm below in case of kDontNegateResult |
| 7329 // mode; for kNegateResult mode we properly negate the result. | 7328 // mode; for kNegateResult mode we properly negate the result. |
| 7330 // | 7329 // |
| 7331 // if (lhs == rhs) { | 7330 // if (lhs == rhs) { |
| 7332 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; | 7331 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; |
| 7333 // return true; | 7332 // return true; |
| 7334 // } | 7333 // } |
| 7335 // if (!lhs->IsSmi()) { | 7334 // if (!lhs->IsSmi()) { |
| 7336 // if (lhs->IsHeapNumber()) { | 7335 // if (lhs->IsHeapNumber()) { |
| 7337 // if (rhs->IsSmi()) { | 7336 // if (rhs->IsSmi()) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7466 Node* rhs_instance_type = LoadInstanceType(rhs); | 7465 Node* rhs_instance_type = LoadInstanceType(rhs); |
| 7467 | 7466 |
| 7468 // Check if {rhs} is also a String. | 7467 // Check if {rhs} is also a String. |
| 7469 Label if_rhsisstring(this, Label::kDeferred), | 7468 Label if_rhsisstring(this, Label::kDeferred), |
| 7470 if_rhsisnotstring(this); | 7469 if_rhsisnotstring(this); |
| 7471 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, | 7470 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, |
| 7472 &if_rhsisnotstring); | 7471 &if_rhsisnotstring); |
| 7473 | 7472 |
| 7474 Bind(&if_rhsisstring); | 7473 Bind(&if_rhsisstring); |
| 7475 { | 7474 { |
| 7476 Callable callable = (mode == kDontNegateResult) | 7475 Callable callable = CodeFactory::StringEqual(isolate()); |
| 7477 ? CodeFactory::StringEqual(isolate()) | |
| 7478 : CodeFactory::StringNotEqual(isolate()); | |
| 7479 result.Bind(CallStub(callable, context, lhs, rhs)); | 7476 result.Bind(CallStub(callable, context, lhs, rhs)); |
| 7480 Goto(&end); | 7477 Goto(&end); |
| 7481 } | 7478 } |
| 7482 | 7479 |
| 7483 Bind(&if_rhsisnotstring); | 7480 Bind(&if_rhsisnotstring); |
| 7484 Goto(&if_notequal); | 7481 Goto(&if_notequal); |
| 7485 } | 7482 } |
| 7486 | 7483 |
| 7487 Bind(&if_lhsisnotstring); | 7484 Bind(&if_lhsisnotstring); |
| 7488 Goto(&if_notequal); | 7485 Goto(&if_notequal); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7523 } | 7520 } |
| 7524 | 7521 |
| 7525 Bind(&if_rhsisnotnumber); | 7522 Bind(&if_rhsisnotnumber); |
| 7526 Goto(&if_notequal); | 7523 Goto(&if_notequal); |
| 7527 } | 7524 } |
| 7528 } | 7525 } |
| 7529 } | 7526 } |
| 7530 | 7527 |
| 7531 Bind(&if_equal); | 7528 Bind(&if_equal); |
| 7532 { | 7529 { |
| 7533 result.Bind(BooleanConstant(mode == kDontNegateResult)); | 7530 result.Bind(TrueConstant()); |
| 7534 Goto(&end); | 7531 Goto(&end); |
| 7535 } | 7532 } |
| 7536 | 7533 |
| 7537 Bind(&if_notequal); | 7534 Bind(&if_notequal); |
| 7538 { | 7535 { |
| 7539 result.Bind(BooleanConstant(mode == kNegateResult)); | 7536 result.Bind(FalseConstant()); |
| 7540 Goto(&end); | 7537 Goto(&end); |
| 7541 } | 7538 } |
| 7542 | 7539 |
| 7543 Bind(&end); | 7540 Bind(&end); |
| 7544 return result.value(); | 7541 return result.value(); |
| 7545 } | 7542 } |
| 7546 | 7543 |
| 7547 // ECMA#sec-samevalue | 7544 // ECMA#sec-samevalue |
| 7548 // This algorithm differs from the Strict Equality Comparison Algorithm in its | 7545 // This algorithm differs from the Strict Equality Comparison Algorithm in its |
| 7549 // treatment of signed zeroes and NaNs. | 7546 // treatment of signed zeroes and NaNs. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7614 Bind(&if_floatnotequal); | 7611 Bind(&if_floatnotequal); |
| 7615 { | 7612 { |
| 7616 var_result.Bind(int_false); | 7613 var_result.Bind(int_false); |
| 7617 Goto(&out); | 7614 Goto(&out); |
| 7618 } | 7615 } |
| 7619 } | 7616 } |
| 7620 } | 7617 } |
| 7621 | 7618 |
| 7622 Bind(&strict_equal); | 7619 Bind(&strict_equal); |
| 7623 { | 7620 { |
| 7624 Node* const is_equal = StrictEqual(kDontNegateResult, lhs, rhs, context); | 7621 Node* const is_equal = StrictEqual(lhs, rhs, context); |
| 7625 Node* const result = WordEqual(is_equal, TrueConstant()); | 7622 Node* const result = WordEqual(is_equal, TrueConstant()); |
| 7626 var_result.Bind(result); | 7623 var_result.Bind(result); |
| 7627 Goto(&out); | 7624 Goto(&out); |
| 7628 } | 7625 } |
| 7629 | 7626 |
| 7630 Bind(&out); | 7627 Bind(&out); |
| 7631 return var_result.value(); | 7628 return var_result.value(); |
| 7632 } | 7629 } |
| 7633 | 7630 |
| 7634 Node* CodeStubAssembler::ForInFilter(Node* key, Node* object, Node* context) { | 7631 Node* CodeStubAssembler::ForInFilter(Node* key, Node* object, Node* context) { |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8416 formatted.c_str(), TENURED); | 8413 formatted.c_str(), TENURED); |
| 8417 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8414 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
| 8418 HeapConstant(string)); | 8415 HeapConstant(string)); |
| 8419 } | 8416 } |
| 8420 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8417 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
| 8421 #endif | 8418 #endif |
| 8422 } | 8419 } |
| 8423 | 8420 |
| 8424 } // namespace internal | 8421 } // namespace internal |
| 8425 } // namespace v8 | 8422 } // namespace v8 |
| OLD | NEW |