| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(), | 247 InvokeIntrinsicHelper sub_string_helper(isolate, handles.main_zone(), |
| 248 Runtime::kInlineSubString); | 248 Runtime::kInlineSubString); |
| 249 CHECK(sub_string_helper | 249 CHECK(sub_string_helper |
| 250 .Invoke(sub_string_helper.NewObject("'foobar'"), | 250 .Invoke(sub_string_helper.NewObject("'foobar'"), |
| 251 sub_string_helper.NewObject("3"), | 251 sub_string_helper.NewObject("3"), |
| 252 sub_string_helper.NewObject("6")) | 252 sub_string_helper.NewObject("6")) |
| 253 ->SameValue(*sub_string_helper.NewObject("'bar'"))); | 253 ->SameValue(*sub_string_helper.NewObject("'bar'"))); |
| 254 } | 254 } |
| 255 | 255 |
| 256 TEST(ValueOf) { |
| 257 HandleAndZoneScope handles; |
| 258 Isolate* isolate = handles.main_isolate(); |
| 259 Factory* factory = isolate->factory(); |
| 260 InvokeIntrinsicHelper helper(handles.main_isolate(), handles.main_zone(), |
| 261 Runtime::kInlineValueOf); |
| 262 |
| 263 CHECK_EQ(Smi::FromInt(1234), *helper.Invoke(helper.NewObject("1234"))); |
| 264 CHECK_EQ(Smi::FromInt(5678), |
| 265 *helper.Invoke(helper.NewObject("new Object(5678)"))); |
| 266 |
| 267 CHECK_EQ(*factory->true_value(), *helper.Invoke(helper.NewObject("true"))); |
| 268 CHECK_EQ(*factory->false_value(), |
| 269 *helper.Invoke(helper.NewObject("new Object(false)"))); |
| 270 |
| 271 CHECK(helper.Invoke(helper.NewObject("'foobar'")) |
| 272 ->SameValue(*helper.NewObject("'foobar'"))); |
| 273 CHECK(helper.Invoke(helper.NewObject("new Object('foobar')")) |
| 274 ->SameValue(*helper.NewObject("'foobar'"))); |
| 275 } |
| 276 |
| 256 } // namespace interpreter | 277 } // namespace interpreter |
| 257 } // namespace internal | 278 } // namespace internal |
| 258 } // namespace v8 | 279 } // namespace v8 |
| OLD | NEW |