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

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

Issue 2592383002: Revert of [regexp] Remove IsRegExp intrinsic (Closed)
Patch Set: Created 4 years 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
117 TEST(IsTypedArray) { 138 TEST(IsTypedArray) {
118 HandleAndZoneScope handles; 139 HandleAndZoneScope handles;
119 140
120 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), 141 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
121 Runtime::kInlineIsTypedArray); 142 Runtime::kInlineIsTypedArray);
122 Factory* factory = handles.main_isolate()->factory(); 143 Factory* factory = handles.main_isolate()->factory();
123 144
124 CHECK_EQ(*factory->false_value(), 145 CHECK_EQ(*factory->false_value(),
125 *helper.Invoke(helper.NewObject("new Date()"))); 146 *helper.Invoke(helper.NewObject("new Date()")));
126 CHECK_EQ(*factory->false_value(), 147 CHECK_EQ(*factory->false_value(),
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 ->SameValue(*helper.NewObject("'Date'"))); 284 ->SameValue(*helper.NewObject("'Date'")));
264 CHECK(helper.Invoke(helper.NewObject("new Set")) 285 CHECK(helper.Invoke(helper.NewObject("new Set"))
265 ->SameValue(*helper.NewObject("'Set'"))); 286 ->SameValue(*helper.NewObject("'Set'")));
266 CHECK(helper.Invoke(helper.NewObject("/x/")) 287 CHECK(helper.Invoke(helper.NewObject("/x/"))
267 ->SameValue(*helper.NewObject("'RegExp'"))); 288 ->SameValue(*helper.NewObject("'RegExp'")));
268 } 289 }
269 290
270 } // namespace interpreter 291 } // namespace interpreter
271 } // namespace internal 292 } // namespace internal
272 } // namespace v8 293 } // 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