Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 2609013002: [turbofan] Use InternalizedString feedback abstract/strict equality comparisons. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/type-info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <tuple> 5 #include <tuple>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/execution.h" 9 #include "src/execution.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 const char* lhs = inputs[i].c_str(); 1791 const char* lhs = inputs[i].c_str();
1792 const char* rhs = inputs[j].c_str(); 1792 const char* rhs = inputs[j].c_str();
1793 1793
1794 FeedbackVectorSpec feedback_spec(&zone); 1794 FeedbackVectorSpec feedback_spec(&zone);
1795 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); 1795 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot();
1796 Handle<i::TypeFeedbackVector> vector = 1796 Handle<i::TypeFeedbackVector> vector =
1797 NewTypeFeedbackVector(isolate, &feedback_spec); 1797 NewTypeFeedbackVector(isolate, &feedback_spec);
1798 1798
1799 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); 1799 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1);
1800 Register r0(0); 1800 Register r0(0);
1801 builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs)) 1801 builder.LoadLiteral(factory->InternalizeUtf8String(lhs))
1802 .StoreAccumulatorInRegister(r0) 1802 .StoreAccumulatorInRegister(r0)
1803 .LoadLiteral(factory->NewStringFromAsciiChecked(rhs)) 1803 .LoadLiteral(factory->InternalizeUtf8String(rhs))
1804 .CompareOperation(comparison, r0, vector->GetIndex(slot)) 1804 .CompareOperation(comparison, r0, vector->GetIndex(slot))
1805 .Return(); 1805 .Return();
1806 1806
1807 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); 1807 Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
1808 InterpreterTester tester(isolate, bytecode_array, vector); 1808 InterpreterTester tester(isolate, bytecode_array, vector);
1809 auto callable = tester.GetCallable<>(); 1809 auto callable = tester.GetCallable<>();
1810 Handle<Object> return_value = callable().ToHandleChecked(); 1810 Handle<Object> return_value = callable().ToHandleChecked();
1811 CHECK(return_value->IsBoolean()); 1811 CHECK(return_value->IsBoolean());
1812 CHECK_EQ(return_value->BooleanValue(), 1812 CHECK_EQ(return_value->BooleanValue(),
1813 CompareC(comparison, inputs[i], inputs[j])); 1813 CompareC(comparison, inputs[i], inputs[j]));
1814 Object* feedback = vector->Get(slot); 1814 Object* feedback = vector->Get(slot);
1815 CHECK(feedback->IsSmi()); 1815 CHECK(feedback->IsSmi());
1816 CHECK_EQ(CompareOperationFeedback::kString, 1816 int const expected_feedback =
1817 static_cast<Smi*>(feedback)->value()); 1817 Token::IsOrderedRelationalCompareOp(comparison)
1818 ? CompareOperationFeedback::kString
1819 : CompareOperationFeedback::kInternalizedString;
1820 CHECK_EQ(expected_feedback, static_cast<Smi*>(feedback)->value());
1818 } 1821 }
1819 } 1822 }
1820 } 1823 }
1821 } 1824 }
1822 1825
1823 1826
1824 TEST(InterpreterMixedComparisons) { 1827 TEST(InterpreterMixedComparisons) {
1825 // This test compares a HeapNumber with a String. The latter is 1828 // This test compares a HeapNumber with a String. The latter is
1826 // convertible to a HeapNumber so comparison will be between numeric 1829 // convertible to a HeapNumber so comparison will be between numeric
1827 // values except for the strict comparisons where no conversion is 1830 // values except for the strict comparisons where no conversion is
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
4827 auto callable = tester.GetCallable<>(); 4830 auto callable = tester.GetCallable<>();
4828 4831
4829 Handle<i::Object> return_value = callable().ToHandleChecked(); 4832 Handle<i::Object> return_value = callable().ToHandleChecked();
4830 CHECK(return_value->SameValue(*tests[i].second)); 4833 CHECK(return_value->SameValue(*tests[i].second));
4831 } 4834 }
4832 } 4835 }
4833 4836
4834 } // namespace interpreter 4837 } // namespace interpreter
4835 } // namespace internal 4838 } // namespace internal
4836 } // namespace v8 4839 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698