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

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

Issue 875443002: Store pc offset instead of absolute pc in the pc descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed arm/mips/arm64 build Created 5 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.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 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 *CreateFunction("Test_Code"), &_assembler_)); 2783 *CreateFunction("Test_Code"), &_assembler_));
2784 code.set_pc_descriptors(descriptors); 2784 code.set_pc_descriptors(descriptors);
2785 2785
2786 // Verify the PcDescriptor entries by accessing them. 2786 // Verify the PcDescriptor entries by accessing them.
2787 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors()); 2787 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2788 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind); 2788 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind);
2789 2789
2790 EXPECT_EQ(true, iter.MoveNext()); 2790 EXPECT_EQ(true, iter.MoveNext());
2791 EXPECT_EQ(20, iter.TokenPos()); 2791 EXPECT_EQ(20, iter.TokenPos());
2792 EXPECT_EQ(1, iter.TryIndex()); 2792 EXPECT_EQ(1, iter.TryIndex());
2793 EXPECT_EQ(static_cast<uword>(10), iter.Pc()); 2793 EXPECT_EQ(static_cast<uword>(10), iter.PcOffset());
2794 EXPECT_EQ(1, iter.DeoptId()); 2794 EXPECT_EQ(1, iter.DeoptId());
2795 EXPECT_EQ(RawPcDescriptors::kOther, iter.Kind()); 2795 EXPECT_EQ(RawPcDescriptors::kOther, iter.Kind());
2796 2796
2797 EXPECT_EQ(true, iter.MoveNext()); 2797 EXPECT_EQ(true, iter.MoveNext());
2798 EXPECT_EQ(30, iter.TokenPos()); 2798 EXPECT_EQ(30, iter.TokenPos());
2799 EXPECT_EQ(RawPcDescriptors::kDeopt, iter.Kind()); 2799 EXPECT_EQ(RawPcDescriptors::kDeopt, iter.Kind());
2800 2800
2801 EXPECT_EQ(true, iter.MoveNext()); 2801 EXPECT_EQ(true, iter.MoveNext());
2802 EXPECT_EQ(40, iter.TokenPos()); 2802 EXPECT_EQ(40, iter.TokenPos());
2803 2803
2804 EXPECT_EQ(true, iter.MoveNext()); 2804 EXPECT_EQ(true, iter.MoveNext());
2805 EXPECT_EQ(40, iter.TokenPos()); 2805 EXPECT_EQ(40, iter.TokenPos());
2806 2806
2807 EXPECT_EQ(true, iter.MoveNext()); 2807 EXPECT_EQ(true, iter.MoveNext());
2808 EXPECT_EQ(80, iter.TokenPos()); 2808 EXPECT_EQ(80, iter.TokenPos());
2809 2809
2810 EXPECT_EQ(true, iter.MoveNext()); 2810 EXPECT_EQ(true, iter.MoveNext());
2811 EXPECT_EQ(150, iter.TokenPos()); 2811 EXPECT_EQ(150, iter.TokenPos());
2812 2812
2813 EXPECT_EQ(3, iter.TryIndex()); 2813 EXPECT_EQ(3, iter.TryIndex());
2814 EXPECT_EQ(static_cast<uword>(80), iter.Pc()); 2814 EXPECT_EQ(static_cast<uword>(80), iter.PcOffset());
2815 EXPECT_EQ(150, iter.TokenPos()); 2815 EXPECT_EQ(150, iter.TokenPos());
2816 EXPECT_EQ(RawPcDescriptors::kOther, iter.Kind()); 2816 EXPECT_EQ(RawPcDescriptors::kOther, iter.Kind());
2817 2817
2818 EXPECT_EQ(false, iter.MoveNext()); 2818 EXPECT_EQ(false, iter.MoveNext());
2819 } 2819 }
2820 2820
2821 2821
2822 TEST_CASE(PcDescriptorsCompressed) { 2822 TEST_CASE(PcDescriptorsCompressed) {
2823 const int kNumEntries = 6; 2823 const int kNumEntries = 6;
2824 // Add PcDescriptors to the code. 2824 // Add PcDescriptors to the code.
(...skipping 12 matching lines...) Expand all
2837 GenerateIncrement(&_assembler_); 2837 GenerateIncrement(&_assembler_);
2838 Code& code = Code::Handle(Code::FinalizeCode( 2838 Code& code = Code::Handle(Code::FinalizeCode(
2839 *CreateFunction("Test_Code"), &_assembler_)); 2839 *CreateFunction("Test_Code"), &_assembler_));
2840 code.set_pc_descriptors(descriptors); 2840 code.set_pc_descriptors(descriptors);
2841 2841
2842 // Verify the PcDescriptor entries by accessing them. 2842 // Verify the PcDescriptor entries by accessing them.
2843 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors()); 2843 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2844 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind); 2844 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind);
2845 2845
2846 EXPECT_EQ(true, iter.MoveNext()); 2846 EXPECT_EQ(true, iter.MoveNext());
2847 EXPECT_EQ(static_cast<uword>(10), iter.Pc()); 2847 EXPECT_EQ(static_cast<uword>(10), iter.PcOffset());
2848 EXPECT_EQ(-1, iter.TryIndex()); 2848 EXPECT_EQ(-1, iter.TryIndex());
2849 EXPECT_EQ(1, iter.DeoptId()); 2849 EXPECT_EQ(1, iter.DeoptId());
2850 EXPECT_EQ(20, iter.TokenPos()); 2850 EXPECT_EQ(20, iter.TokenPos());
2851 2851
2852 EXPECT_EQ(true, iter.MoveNext()); 2852 EXPECT_EQ(true, iter.MoveNext());
2853 EXPECT_EQ(true, iter.MoveNext()); 2853 EXPECT_EQ(true, iter.MoveNext());
2854 EXPECT_EQ(true, iter.MoveNext()); 2854 EXPECT_EQ(true, iter.MoveNext());
2855 EXPECT_EQ(true, iter.MoveNext()); 2855 EXPECT_EQ(true, iter.MoveNext());
2856 EXPECT_EQ(true, iter.MoveNext()); 2856 EXPECT_EQ(true, iter.MoveNext());
2857 2857
2858 EXPECT_EQ(-1, iter.TryIndex()); 2858 EXPECT_EQ(-1, iter.TryIndex());
2859 EXPECT_EQ(static_cast<uword>(80), iter.Pc()); 2859 EXPECT_EQ(static_cast<uword>(80), iter.PcOffset());
2860 EXPECT_EQ(150, iter.TokenPos()); 2860 EXPECT_EQ(150, iter.TokenPos());
2861 2861
2862 EXPECT_EQ(false, iter.MoveNext()); 2862 EXPECT_EQ(false, iter.MoveNext());
2863 } 2863 }
2864 2864
2865 2865
2866 2866
2867 static RawClass* CreateTestClass(const char* name) { 2867 static RawClass* CreateTestClass(const char* name) {
2868 const String& class_name = String::Handle(Symbols::New(name)); 2868 const String& class_name = String::Handle(Symbols::New(name));
2869 const Class& cls = Class::Handle( 2869 const Class& cls = Class::Handle(
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
4478 EXPECT_VALID(h_result); 4478 EXPECT_VALID(h_result);
4479 Integer& result = Integer::Handle(); 4479 Integer& result = Integer::Handle();
4480 result ^= Api::UnwrapHandle(h_result); 4480 result ^= Api::UnwrapHandle(h_result);
4481 String& foo = String::Handle(String::New("foo")); 4481 String& foo = String::Handle(String::New("foo"));
4482 Integer& expected = Integer::Handle(); 4482 Integer& expected = Integer::Handle();
4483 expected ^= foo.HashCode(); 4483 expected ^= foo.HashCode();
4484 EXPECT(result.IsIdenticalTo(expected)); 4484 EXPECT(result.IsIdenticalTo(expected));
4485 } 4485 }
4486 4486
4487 } // namespace dart 4487 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698