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

Side by Side Diff: test/unittests/compiler/js-typed-lowering-unittest.cc

Issue 2681273002: [turbofan] Utilize the fact that empty string is canonicalized. (Closed)
Patch Set: Feedback. Cleanup. Created 3 years, 10 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/compiler/types.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/js-operator.h" 10 #include "src/compiler/js-operator.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 TEST_F(JSTypedLoweringTest, JSToBooleanWithReceiverOrNullOrUndefined) { 124 TEST_F(JSTypedLoweringTest, JSToBooleanWithReceiverOrNullOrUndefined) {
125 Node* input = Parameter(Type::ReceiverOrNullOrUndefined(), 0); 125 Node* input = Parameter(Type::ReceiverOrNullOrUndefined(), 0);
126 Node* context = Parameter(Type::Any(), 1); 126 Node* context = Parameter(Type::Any(), 1);
127 Reduction r = Reduce(graph()->NewNode( 127 Reduction r = Reduce(graph()->NewNode(
128 javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); 128 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
129 ASSERT_TRUE(r.Changed()); 129 ASSERT_TRUE(r.Changed());
130 EXPECT_THAT(r.replacement(), IsBooleanNot(IsObjectIsUndetectable(input))); 130 EXPECT_THAT(r.replacement(), IsBooleanNot(IsObjectIsUndetectable(input)));
131 } 131 }
132 132
133 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) {
134 Node* input = Parameter(Type::String(), 0);
135 Node* context = Parameter(Type::Any(), 1);
136 Reduction r = Reduce(graph()->NewNode(
137 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
138 ASSERT_TRUE(r.Changed());
139 EXPECT_THAT(r.replacement(),
140 IsBooleanNot(IsReferenceEqual(
141 input, IsHeapConstant(factory()->empty_string()))));
142 }
143
133 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { 144 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) {
134 Node* input = Parameter(Type::Any(), 0); 145 Node* input = Parameter(Type::Any(), 0);
135 Node* context = Parameter(Type::Any(), 1); 146 Node* context = Parameter(Type::Any(), 1);
136 Reduction r = Reduce(graph()->NewNode( 147 Reduction r = Reduce(graph()->NewNode(
137 javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); 148 javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
138 ASSERT_FALSE(r.Changed()); 149 ASSERT_FALSE(r.Changed());
139 } 150 }
140 151
141 152
142 // ----------------------------------------------------------------------------- 153 // -----------------------------------------------------------------------------
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 EmptyFrameState(), effect, control)); 1018 EmptyFrameState(), effect, control));
1008 ASSERT_TRUE(r.Changed()); 1019 ASSERT_TRUE(r.Changed());
1009 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor( 1020 EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
1010 NumberOperationHint::kNumberOrOddball, lhs, 1021 NumberOperationHint::kNumberOrOddball, lhs,
1011 rhs, effect, control)); 1022 rhs, effect, control));
1012 } 1023 }
1013 1024
1014 } // namespace compiler 1025 } // namespace compiler
1015 } // namespace internal 1026 } // namespace internal
1016 } // namespace v8 1027 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/types.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698