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

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

Issue 2128233002: [Interpreter] Add ClassOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/interpreter/interpreter-intrinsics.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 "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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true"))); 260 CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true")));
261 CHECK_EQ(*factory->false_value(), 261 CHECK_EQ(*factory->false_value(),
262 *helper.Invoke(helper.NewObject("new Object(false)"))); 262 *helper.Invoke(helper.NewObject("new Object(false)")));
263 263
264 CHECK(helper.Invoke(helper.NewObject("'foobar'")) 264 CHECK(helper.Invoke(helper.NewObject("'foobar'"))
265 ->SameValue(*helper.NewObject("'foobar'"))); 265 ->SameValue(*helper.NewObject("'foobar'")));
266 CHECK(helper.Invoke(helper.NewObject("new Object('foobar')")) 266 CHECK(helper.Invoke(helper.NewObject("new Object('foobar')"))
267 ->SameValue(*helper.NewObject("'foobar'"))); 267 ->SameValue(*helper.NewObject("'foobar'")));
268 } 268 }
269 269
270 TEST(ClassOf) {
271 HandleAndZoneScope handles;
272 Isolate* isolate = handles.main_isolate();
273 Factory* factory = isolate->factory();
274 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(),
275 Runtime::kInlineClassOf);
276 CHECK_EQ(*helper.Invoke(helper.NewObject("123")), *factory->null_value());
277 CHECK_EQ(*helper.Invoke(helper.NewObject("'true'")), *factory->null_value());
278 CHECK_EQ(*helper.Invoke(helper.NewObject("'foo'")), *factory->null_value());
279 CHECK(helper.Invoke(helper.NewObject("({a:1})"))
280 ->SameValue(*helper.NewObject("'Object'")));
281 CHECK(helper.Invoke(helper.NewObject("(function foo() {})"))
282 ->SameValue(*helper.NewObject("'Function'")));
283 CHECK(helper.Invoke(helper.NewObject("new Date()"))
284 ->SameValue(*helper.NewObject("'Date'")));
285 CHECK(helper.Invoke(helper.NewObject("new Set"))
286 ->SameValue(*helper.NewObject("'Set'")));
287 CHECK(helper.Invoke(helper.NewObject("/x/"))
288 ->SameValue(*helper.NewObject("'RegExp'")));
289 }
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 | « src/interpreter/interpreter-intrinsics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698