OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 assembler->Bind(&do_fdec); | 1752 assembler->Bind(&do_fdec); |
1753 { | 1753 { |
1754 Node* fdec_value = var_fdec_value.value(); | 1754 Node* fdec_value = var_fdec_value.value(); |
1755 Node* one = assembler->Float64Constant(1.0); | 1755 Node* one = assembler->Float64Constant(1.0); |
1756 Node* fdec_result = assembler->Float64Sub(fdec_value, one); | 1756 Node* fdec_result = assembler->Float64Sub(fdec_value, one); |
1757 Node* result = assembler->ChangeFloat64ToTagged(fdec_result); | 1757 Node* result = assembler->ChangeFloat64ToTagged(fdec_result); |
1758 assembler->Return(result); | 1758 assembler->Return(result); |
1759 } | 1759 } |
1760 } | 1760 } |
1761 | 1761 |
| 1762 void InstanceOfStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| 1763 typedef CodeStubAssembler::Label Label; |
| 1764 typedef compiler::Node Node; |
| 1765 |
| 1766 Node* object = assembler->Parameter(0); |
| 1767 Node* callable = assembler->Parameter(1); |
| 1768 Node* context = assembler->Parameter(2); |
| 1769 |
| 1770 Label return_runtime(assembler, Label::kDeferred); |
| 1771 |
| 1772 // Check if no one installed @@hasInstance somewhere. |
| 1773 assembler->GotoUnless( |
| 1774 assembler->WordEqual( |
| 1775 assembler->LoadObjectField( |
| 1776 assembler->LoadRoot(Heap::kHasInstanceProtectorRootIndex), |
| 1777 PropertyCell::kValueOffset), |
| 1778 assembler->SmiConstant(Smi::FromInt(Isolate::kArrayProtectorValid))), |
| 1779 &return_runtime); |
| 1780 |
| 1781 // Check if {callable} is a valid receiver. |
| 1782 assembler->GotoIf(assembler->WordIsSmi(callable), &return_runtime); |
| 1783 assembler->GotoIf( |
| 1784 assembler->Word32Equal( |
| 1785 assembler->Word32And( |
| 1786 assembler->LoadMapBitField(assembler->LoadMap(callable)), |
| 1787 assembler->Int32Constant(1 << Map::kIsCallable)), |
| 1788 assembler->Int32Constant(0)), |
| 1789 &return_runtime); |
| 1790 |
| 1791 // Use the inline OrdinaryHasInstance directly. |
| 1792 assembler->Return(assembler->OrdinaryHasInstance(context, callable, object)); |
| 1793 |
| 1794 // TODO(bmeurer): Use GetPropertyStub here once available. |
| 1795 assembler->Bind(&return_runtime); |
| 1796 assembler->TailCallRuntime(Runtime::kInstanceOf, context, object, callable); |
| 1797 } |
| 1798 |
1762 namespace { | 1799 namespace { |
1763 | 1800 |
1764 enum RelationalComparisonMode { | 1801 enum RelationalComparisonMode { |
1765 kLessThan, | 1802 kLessThan, |
1766 kLessThanOrEqual, | 1803 kLessThanOrEqual, |
1767 kGreaterThan, | 1804 kGreaterThan, |
1768 kGreaterThanOrEqual | 1805 kGreaterThanOrEqual |
1769 }; | 1806 }; |
1770 | 1807 |
1771 void GenerateAbstractRelationalComparison(CodeStubAssembler* assembler, | 1808 void GenerateAbstractRelationalComparison(CodeStubAssembler* assembler, |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 if (type->Is(Type::UntaggedPointer())) { | 4465 if (type->Is(Type::UntaggedPointer())) { |
4429 return Representation::External(); | 4466 return Representation::External(); |
4430 } | 4467 } |
4431 | 4468 |
4432 DCHECK(!type->Is(Type::Untagged())); | 4469 DCHECK(!type->Is(Type::Untagged())); |
4433 return Representation::Tagged(); | 4470 return Representation::Tagged(); |
4434 } | 4471 } |
4435 | 4472 |
4436 } // namespace internal | 4473 } // namespace internal |
4437 } // namespace v8 | 4474 } // namespace v8 |
OLD | NEW |