| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 v8::Script::Compile(v8_str(source))->Run(); | 1764 v8::Script::Compile(v8_str(source))->Run(); |
| 1765 i::CpuProfile* iprofile = iprofiler->GetProfile(0); | 1765 i::CpuProfile* iprofile = iprofiler->GetProfile(0); |
| 1766 iprofile->Print(); | 1766 iprofile->Print(); |
| 1767 { | 1767 { |
| 1768 const char* branch[] = {"", "opt_function0", "opt_function0"}; | 1768 const char* branch[] = {"", "opt_function0", "opt_function0"}; |
| 1769 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), | 1769 CHECK_EQ(reason(i::Deoptimizer::kNotAHeapNumber), |
| 1770 GetBranchDeoptReason(iprofile, branch, arraysize(branch))); | 1770 GetBranchDeoptReason(iprofile, branch, arraysize(branch))); |
| 1771 } | 1771 } |
| 1772 { | 1772 { |
| 1773 const char* branch[] = {"", "opt_function1", "opt_function1"}; | 1773 const char* branch[] = {"", "opt_function1", "opt_function1"}; |
| 1774 CHECK_EQ(reason(i::Deoptimizer::kNaN), | 1774 const char* deopt_reason = |
| 1775 GetBranchDeoptReason(iprofile, branch, arraysize(branch))); | 1775 GetBranchDeoptReason(iprofile, branch, arraysize(branch)); |
| 1776 if (deopt_reason != reason(i::Deoptimizer::kNaN) && |
| 1777 deopt_reason != reason(i::Deoptimizer::kLostPrecisionOrNaN)) { |
| 1778 FATAL(deopt_reason); |
| 1779 } |
| 1776 } | 1780 } |
| 1777 { | 1781 { |
| 1778 const char* branch[] = {"", "opt_function2", "opt_function2"}; | 1782 const char* branch[] = {"", "opt_function2", "opt_function2"}; |
| 1779 CHECK_EQ(reason(i::Deoptimizer::kDivisionByZero), | 1783 CHECK_EQ(reason(i::Deoptimizer::kDivisionByZero), |
| 1780 GetBranchDeoptReason(iprofile, branch, arraysize(branch))); | 1784 GetBranchDeoptReason(iprofile, branch, arraysize(branch))); |
| 1781 } | 1785 } |
| 1782 iprofiler->DeleteProfile(iprofile); | 1786 iprofiler->DeleteProfile(iprofile); |
| 1783 } | 1787 } |
| 1784 | 1788 |
| 1785 | 1789 |
| 1786 TEST(SourceLocation) { | 1790 TEST(SourceLocation) { |
| 1787 i::FLAG_always_opt = true; | 1791 i::FLAG_always_opt = true; |
| 1788 i::FLAG_hydrogen_track_positions = true; | 1792 i::FLAG_hydrogen_track_positions = true; |
| 1789 LocalContext env; | 1793 LocalContext env; |
| 1790 v8::HandleScope scope(CcTest::isolate()); | 1794 v8::HandleScope scope(CcTest::isolate()); |
| 1791 | 1795 |
| 1792 const char* source = | 1796 const char* source = |
| 1793 "function CompareStatementWithThis() {\n" | 1797 "function CompareStatementWithThis() {\n" |
| 1794 " if (this === 1) {}\n" | 1798 " if (this === 1) {}\n" |
| 1795 "}\n" | 1799 "}\n" |
| 1796 "CompareStatementWithThis();\n"; | 1800 "CompareStatementWithThis();\n"; |
| 1797 | 1801 |
| 1798 v8::Script::Compile(v8_str(source))->Run(); | 1802 v8::Script::Compile(v8_str(source))->Run(); |
| 1799 } | 1803 } |
| OLD | NEW |