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

Side by Side Diff: runtime/vm/object_test.cc

Issue 2572563004: Improve the casing of Stackmap and Stacktrace. (Closed)
Patch Set: Build fixes Created 4 years 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 | « runtime/vm/object_store.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 EXPECT(Smi::Cast(result).Value() == kSmiTestValue); 2782 EXPECT(Smi::Cast(result).Value() == kSmiTestValue);
2783 } 2783 }
2784 #endif // ARCH_IS_64_BIT 2784 #endif // ARCH_IS_64_BIT
2785 2785
2786 2786
2787 VM_TEST_CASE(ExceptionHandlers) { 2787 VM_TEST_CASE(ExceptionHandlers) {
2788 const int kNumEntries = 4; 2788 const int kNumEntries = 4;
2789 // Add an exception handler table to the code. 2789 // Add an exception handler table to the code.
2790 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle(); 2790 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
2791 exception_handlers ^= ExceptionHandlers::New(kNumEntries); 2791 exception_handlers ^= ExceptionHandlers::New(kNumEntries);
2792 const bool kNeedsStacktrace = true; 2792 const bool kNeedsStackTrace = true;
2793 const bool kNoStacktrace = false; 2793 const bool kNoStackTrace = false;
2794 exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStacktrace, false); 2794 exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStackTrace, false);
2795 exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStacktrace, false); 2795 exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStackTrace, false);
2796 exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStacktrace, true); 2796 exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStackTrace, true);
2797 exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStacktrace, true); 2797 exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStackTrace, true);
2798 2798
2799 extern void GenerateIncrement(Assembler * assembler); 2799 extern void GenerateIncrement(Assembler * assembler);
2800 Assembler _assembler_; 2800 Assembler _assembler_;
2801 GenerateIncrement(&_assembler_); 2801 GenerateIncrement(&_assembler_);
2802 Code& code = Code::Handle(Code::FinalizeCode( 2802 Code& code = Code::Handle(Code::FinalizeCode(
2803 Function::Handle(CreateFunction("Test_Code")), &_assembler_)); 2803 Function::Handle(CreateFunction("Test_Code")), &_assembler_));
2804 code.set_exception_handlers(exception_handlers); 2804 code.set_exception_handlers(exception_handlers);
2805 2805
2806 // Verify the exception handler table entries by accessing them. 2806 // Verify the exception handler table entries by accessing them.
2807 const ExceptionHandlers& handlers = 2807 const ExceptionHandlers& handlers =
2808 ExceptionHandlers::Handle(code.exception_handlers()); 2808 ExceptionHandlers::Handle(code.exception_handlers());
2809 EXPECT_EQ(kNumEntries, handlers.num_entries()); 2809 EXPECT_EQ(kNumEntries, handlers.num_entries());
2810 RawExceptionHandlers::HandlerInfo info; 2810 RawExceptionHandlers::HandlerInfo info;
2811 handlers.GetHandlerInfo(0, &info); 2811 handlers.GetHandlerInfo(0, &info);
2812 EXPECT_EQ(-1, handlers.OuterTryIndex(0)); 2812 EXPECT_EQ(-1, handlers.OuterTryIndex(0));
2813 EXPECT_EQ(-1, info.outer_try_index); 2813 EXPECT_EQ(-1, info.outer_try_index);
2814 EXPECT_EQ(20u, handlers.HandlerPCOffset(0)); 2814 EXPECT_EQ(20u, handlers.HandlerPCOffset(0));
2815 EXPECT(handlers.NeedsStacktrace(0)); 2815 EXPECT(handlers.NeedsStackTrace(0));
2816 EXPECT(!handlers.HasCatchAll(0)); 2816 EXPECT(!handlers.HasCatchAll(0));
2817 EXPECT_EQ(20u, info.handler_pc_offset); 2817 EXPECT_EQ(20u, info.handler_pc_offset);
2818 EXPECT_EQ(1, handlers.OuterTryIndex(3)); 2818 EXPECT_EQ(1, handlers.OuterTryIndex(3));
2819 EXPECT_EQ(150u, handlers.HandlerPCOffset(3)); 2819 EXPECT_EQ(150u, handlers.HandlerPCOffset(3));
2820 EXPECT(!handlers.NeedsStacktrace(3)); 2820 EXPECT(!handlers.NeedsStackTrace(3));
2821 EXPECT(handlers.HasCatchAll(3)); 2821 EXPECT(handlers.HasCatchAll(3));
2822 } 2822 }
2823 2823
2824 2824
2825 VM_TEST_CASE(PcDescriptors) { 2825 VM_TEST_CASE(PcDescriptors) {
2826 DescriptorList* builder = new DescriptorList(0); 2826 DescriptorList* builder = new DescriptorList(0);
2827 2827
2828 // kind, pc_offset, deopt_id, token_pos, try_index 2828 // kind, pc_offset, deopt_id, token_pos, try_index
2829 builder->AddDescriptor(RawPcDescriptors::kOther, 10, 1, TokenPosition(20), 1); 2829 builder->AddDescriptor(RawPcDescriptors::kOther, 10, 1, TokenPosition(20), 1);
2830 builder->AddDescriptor(RawPcDescriptors::kDeopt, 20, 2, TokenPosition(30), 0); 2830 builder->AddDescriptor(RawPcDescriptors::kDeopt, 20, 2, TokenPosition(30), 0);
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
4693 // utf32->utf16 conversion. 4693 // utf32->utf16 conversion.
4694 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, 4694 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
4695 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; 4695 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
4696 4696
4697 const String& str = 4697 const String& str =
4698 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); 4698 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
4699 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); 4699 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
4700 } 4700 }
4701 4701
4702 } // namespace dart 4702 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_store.cc ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698