| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); | 2725 EXPECT((retval >> kSmiTagShift) == kSmiTestValue); |
| 2726 } | 2726 } |
| 2727 #endif | 2727 #endif |
| 2728 | 2728 |
| 2729 | 2729 |
| 2730 TEST_CASE(ExceptionHandlers) { | 2730 TEST_CASE(ExceptionHandlers) { |
| 2731 const int kNumEntries = 6; | 2731 const int kNumEntries = 6; |
| 2732 // Add an exception handler table to the code. | 2732 // Add an exception handler table to the code. |
| 2733 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); | 2733 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); |
| 2734 exception_handlers ^= ExceptionHandlers::New(kNumEntries); | 2734 exception_handlers ^= ExceptionHandlers::New(kNumEntries); |
| 2735 exception_handlers.SetHandlerEntry(0, 10, 20); | 2735 exception_handlers.SetHandlerInfo(0, 10, -1, 20); |
| 2736 exception_handlers.SetHandlerEntry(1, 20, 30); | 2736 exception_handlers.SetHandlerInfo(1, 20, 25, 30); |
| 2737 exception_handlers.SetHandlerEntry(2, 30, 40); | 2737 exception_handlers.SetHandlerInfo(2, 30, 35, 40); |
| 2738 exception_handlers.SetHandlerEntry(3, 10, 40); | 2738 exception_handlers.SetHandlerInfo(3, 10, 15, 40); |
| 2739 exception_handlers.SetHandlerEntry(4, 10, 80); | 2739 exception_handlers.SetHandlerInfo(4, 10, 15, 80); |
| 2740 exception_handlers.SetHandlerEntry(5, 80, 150); | 2740 exception_handlers.SetHandlerInfo(5, 80, 1, 150); |
| 2741 | 2741 |
| 2742 extern void GenerateIncrement(Assembler* assembler); | 2742 extern void GenerateIncrement(Assembler* assembler); |
| 2743 Assembler _assembler_; | 2743 Assembler _assembler_; |
| 2744 GenerateIncrement(&_assembler_); | 2744 GenerateIncrement(&_assembler_); |
| 2745 Code& code = Code::Handle(Code::FinalizeCode( | 2745 Code& code = Code::Handle(Code::FinalizeCode( |
| 2746 *CreateFunction("Test_Code"), &_assembler_)); | 2746 *CreateFunction("Test_Code"), &_assembler_)); |
| 2747 code.set_exception_handlers(exception_handlers); | 2747 code.set_exception_handlers(exception_handlers); |
| 2748 | 2748 |
| 2749 // Verify the exception handler table entries by accessing them. | 2749 // Verify the exception handler table entries by accessing them. |
| 2750 const ExceptionHandlers& handlers = | 2750 const ExceptionHandlers& handlers = |
| 2751 ExceptionHandlers::Handle(code.exception_handlers()); | 2751 ExceptionHandlers::Handle(code.exception_handlers()); |
| 2752 EXPECT_EQ(kNumEntries, handlers.Length()); | 2752 EXPECT_EQ(kNumEntries, handlers.Length()); |
| 2753 RawExceptionHandlers::HandlerInfo info; |
| 2754 handlers.GetHandlerInfo(0, &info); |
| 2753 EXPECT_EQ(10, handlers.TryIndex(0)); | 2755 EXPECT_EQ(10, handlers.TryIndex(0)); |
| 2756 EXPECT_EQ(10, info.try_index); |
| 2757 EXPECT_EQ(-1, info.outer_try_index); |
| 2754 EXPECT_EQ(20, handlers.HandlerPC(0)); | 2758 EXPECT_EQ(20, handlers.HandlerPC(0)); |
| 2759 EXPECT_EQ(20, info.handler_pc); |
| 2755 EXPECT_EQ(80, handlers.TryIndex(5)); | 2760 EXPECT_EQ(80, handlers.TryIndex(5)); |
| 2756 EXPECT_EQ(150, handlers.HandlerPC(5)); | 2761 EXPECT_EQ(150, handlers.HandlerPC(5)); |
| 2757 } | 2762 } |
| 2758 | 2763 |
| 2759 | 2764 |
| 2760 TEST_CASE(PcDescriptors) { | 2765 TEST_CASE(PcDescriptors) { |
| 2761 const int kNumEntries = 6; | 2766 const int kNumEntries = 6; |
| 2762 // Add PcDescriptors to the code. | 2767 // Add PcDescriptors to the code. |
| 2763 PcDescriptors& descriptors = PcDescriptors::Handle(); | 2768 PcDescriptors& descriptors = PcDescriptors::Handle(); |
| 2764 descriptors ^= PcDescriptors::New(kNumEntries); | 2769 descriptors ^= PcDescriptors::New(kNumEntries); |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3548 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); | 3553 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); |
| 3549 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); | 3554 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); |
| 3550 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); | 3555 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); |
| 3551 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); | 3556 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); |
| 3552 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); | 3557 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); |
| 3553 } | 3558 } |
| 3554 | 3559 |
| 3555 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 3560 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 3556 | 3561 |
| 3557 } // namespace dart | 3562 } // namespace dart |
| OLD | NEW |