OLD | NEW |
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 Loading... |
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 |
OLD | NEW |