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/interface-descriptors.h" | 5 #include "src/interface-descriptors.h" |
6 #include "src/isolate.h" | 6 #include "src/isolate.h" |
7 #include "test/cctest/compiler/function-tester.h" | 7 #include "test/cctest/compiler/function-tester.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 Handle<Code> code = m.GenerateCode(); | 324 Handle<Code> code = m.GenerateCode(); |
325 Handle<JSFunction> function = CreateFunctionFromCode(kNumParams, code); | 325 Handle<JSFunction> function = CreateFunctionFromCode(kNumParams, code); |
326 Handle<Object> args[] = {Handle<Smi>(Smi::FromInt(23), isolate), | 326 Handle<Object> args[] = {Handle<Smi>(Smi::FromInt(23), isolate), |
327 Handle<Smi>(Smi::FromInt(34), isolate)}; | 327 Handle<Smi>(Smi::FromInt(34), isolate)}; |
328 MaybeHandle<Object> result = | 328 MaybeHandle<Object> result = |
329 Execution::Call(isolate, function, isolate->factory()->undefined_value(), | 329 Execution::Call(isolate, function, isolate->factory()->undefined_value(), |
330 arraysize(args), args); | 330 arraysize(args), args); |
331 CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); | 331 CHECK_EQ(57, Handle<Smi>::cast(result.ToHandleChecked())->value()); |
332 } | 332 } |
333 | 333 |
| 334 TEST(SplitEdgeBranchMerge) { |
| 335 Isolate* isolate(CcTest::InitIsolateOnce()); |
| 336 VoidDescriptor descriptor(isolate); |
| 337 CodeStubAssemblerTester m(isolate, descriptor); |
| 338 CodeStubAssembler::Label l1(&m), merge(&m); |
| 339 m.Branch(m.Int32Constant(1), &l1, &merge); |
| 340 m.Bind(&l1); |
| 341 m.Goto(&merge); |
| 342 m.Bind(&merge); |
| 343 USE(m.GenerateCode()); |
| 344 } |
| 345 |
| 346 TEST(SplitEdgeSwitchMerge) { |
| 347 Isolate* isolate(CcTest::InitIsolateOnce()); |
| 348 VoidDescriptor descriptor(isolate); |
| 349 CodeStubAssemblerTester m(isolate, descriptor); |
| 350 CodeStubAssembler::Label l1(&m), l2(&m), l3(&m), default_label(&m); |
| 351 CodeStubAssembler::Label* labels[] = {&l1, &l2}; |
| 352 int32_t values[] = {1, 2}; |
| 353 m.Branch(m.Int32Constant(1), &l3, &l1); |
| 354 m.Bind(&l3); |
| 355 m.Switch(m.Int32Constant(2), &default_label, values, labels, 2); |
| 356 m.Bind(&l1); |
| 357 m.Goto(&l2); |
| 358 m.Bind(&l2); |
| 359 m.Goto(&default_label); |
| 360 m.Bind(&default_label); |
| 361 USE(m.GenerateCode()); |
| 362 } |
| 363 |
334 } // namespace compiler | 364 } // namespace compiler |
335 } // namespace internal | 365 } // namespace internal |
336 } // namespace v8 | 366 } // namespace v8 |
OLD | NEW |