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

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

Issue 2591923003: [regexp] Remove IsRegExp intrinsic (Closed)
Patch Set: Rebase 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
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/interpreter-intrinsics.h" 7 #include "src/interpreter/interpreter-intrinsics.h"
8 #include "test/cctest/interpreter/interpreter-tester.h" 8 #include "test/cctest/interpreter/interpreter-tester.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)"))); 107 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("(/x/)")));
108 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined())); 108 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined()));
109 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null())); 109 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null()));
110 CHECK_EQ(*factory->false_value(), 110 CHECK_EQ(*factory->false_value(),
111 *helper.Invoke(helper.NewObject("'string'"))); 111 *helper.Invoke(helper.NewObject("'string'")));
112 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42"))); 112 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42")));
113 CHECK_EQ(*factory->true_value(), 113 CHECK_EQ(*factory->true_value(),
114 *helper.Invoke(helper.NewObject("new Proxy({},{})"))); 114 *helper.Invoke(helper.NewObject("new Proxy({},{})")));
115 } 115 }
116 116
117 TEST(IsRegExp) {
118 HandleAndZoneScope handles;
119
120 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
121 Runtime::kInlineIsRegExp);
122 Factory* factory = handles.main_isolate()->factory();
123
124 CHECK_EQ(*factory->false_value(),
125 *helper.Invoke(helper.NewObject("new Date()")));
126 CHECK_EQ(*factory->false_value(),
127 *helper.Invoke(helper.NewObject("(function() {})")));
128 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("([1])")));
129 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("({})")));
130 CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("(/x/)")));
131 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Undefined()));
132 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.Null()));
133 CHECK_EQ(*factory->false_value(),
134 *helper.Invoke(helper.NewObject("'string'")));
135 CHECK_EQ(*factory->false_value(), *helper.Invoke(helper.NewObject("42")));
136 }
137
138 TEST(IsTypedArray) { 117 TEST(IsTypedArray) {
139 HandleAndZoneScope handles; 118 HandleAndZoneScope handles;
140 119
141 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), 120 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
142 Runtime::kInlineIsTypedArray); 121 Runtime::kInlineIsTypedArray);
143 Factory* factory = handles.main_isolate()->factory(); 122 Factory* factory = handles.main_isolate()->factory();
144 123
145 CHECK_EQ(*factory->false_value(), 124 CHECK_EQ(*factory->false_value(),
146 *helper.Invoke(helper.NewObject("new Date()"))); 125 *helper.Invoke(helper.NewObject("new Date()")));
147 CHECK_EQ(*factory->false_value(), 126 CHECK_EQ(*factory->false_value(),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ->SameValue(*helper.NewObject("'Date'"))); 263 ->SameValue(*helper.NewObject("'Date'")));
285 CHECK(helper.Invoke(helper.NewObject("new Set")) 264 CHECK(helper.Invoke(helper.NewObject("new Set"))
286 ->SameValue(*helper.NewObject("'Set'"))); 265 ->SameValue(*helper.NewObject("'Set'")));
287 CHECK(helper.Invoke(helper.NewObject("/x/")) 266 CHECK(helper.Invoke(helper.NewObject("/x/"))
288 ->SameValue(*helper.NewObject("'RegExp'"))); 267 ->SameValue(*helper.NewObject("'RegExp'")));
289 } 268 }
290 269
291 } // namespace interpreter 270 } // namespace interpreter
292 } // namespace internal 271 } // namespace internal
293 } // namespace v8 272 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-intrinsics.cc ('k') | test/mjsunit/constant-fold-control-instructions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698