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

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

Issue 396213005: Fix PcDescriptor iteratot to never return a pointer to a memory location since the data can move wi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 extern void GenerateIncrement(Assembler* assembler); 2739 extern void GenerateIncrement(Assembler* assembler);
2740 Assembler _assembler_; 2740 Assembler _assembler_;
2741 GenerateIncrement(&_assembler_); 2741 GenerateIncrement(&_assembler_);
2742 Code& code = Code::Handle(Code::FinalizeCode( 2742 Code& code = Code::Handle(Code::FinalizeCode(
2743 *CreateFunction("Test_Code"), &_assembler_)); 2743 *CreateFunction("Test_Code"), &_assembler_));
2744 code.set_pc_descriptors(descriptors); 2744 code.set_pc_descriptors(descriptors);
2745 2745
2746 // Verify the PcDescriptor entries by accessing them. 2746 // Verify the PcDescriptor entries by accessing them.
2747 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors()); 2747 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2748 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind); 2748 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind);
2749 const RawPcDescriptors::PcDescriptorRec& rec0 = iter.Next(); 2749 RawPcDescriptors::PcDescriptorRec rec0;
2750 const RawPcDescriptors::PcDescriptorRec& rec1 = iter.Next(); 2750 RawPcDescriptors::PcDescriptorRec rec1;
2751 const RawPcDescriptors::PcDescriptorRec& rec2 = iter.Next(); 2751 RawPcDescriptors::PcDescriptorRec rec2;
2752 const RawPcDescriptors::PcDescriptorRec& rec3 = iter.Next(); 2752 RawPcDescriptors::PcDescriptorRec rec3;
2753 const RawPcDescriptors::PcDescriptorRec& rec4 = iter.Next(); 2753 RawPcDescriptors::PcDescriptorRec rec4;
2754 const RawPcDescriptors::PcDescriptorRec& rec5 = iter.Next(); 2754 RawPcDescriptors::PcDescriptorRec rec5;
2755 iter.NextRec(&rec0);
2756 iter.NextRec(&rec1);
2757 iter.NextRec(&rec2);
2758 iter.NextRec(&rec3);
2759 iter.NextRec(&rec4);
2760 iter.NextRec(&rec5);
2755 ASSERT(!iter.HasNext()); 2761 ASSERT(!iter.HasNext());
2756 2762
2757 EXPECT_EQ(1, rec0.try_index()); 2763 EXPECT_EQ(1, rec0.try_index());
2758 EXPECT_EQ(static_cast<uword>(10), rec0.pc()); 2764 EXPECT_EQ(static_cast<uword>(10), rec0.pc());
2759 EXPECT_EQ(1, rec0.deopt_id()); 2765 EXPECT_EQ(1, rec0.deopt_id());
2760 EXPECT_EQ(20, rec0.token_pos()); 2766 EXPECT_EQ(20, rec0.token_pos());
2761 2767
2762 EXPECT_EQ(3, rec5.try_index()); 2768 EXPECT_EQ(3, rec5.try_index());
2763 EXPECT_EQ(static_cast<uword>(80), rec5.pc()); 2769 EXPECT_EQ(static_cast<uword>(80), rec5.pc());
2764 EXPECT_EQ(150, rec5.token_pos()); 2770 EXPECT_EQ(150, rec5.token_pos());
(...skipping 23 matching lines...) Expand all
2788 extern void GenerateIncrement(Assembler* assembler); 2794 extern void GenerateIncrement(Assembler* assembler);
2789 Assembler _assembler_; 2795 Assembler _assembler_;
2790 GenerateIncrement(&_assembler_); 2796 GenerateIncrement(&_assembler_);
2791 Code& code = Code::Handle(Code::FinalizeCode( 2797 Code& code = Code::Handle(Code::FinalizeCode(
2792 *CreateFunction("Test_Code"), &_assembler_)); 2798 *CreateFunction("Test_Code"), &_assembler_));
2793 code.set_pc_descriptors(descriptors); 2799 code.set_pc_descriptors(descriptors);
2794 2800
2795 // Verify the PcDescriptor entries by accessing them. 2801 // Verify the PcDescriptor entries by accessing them.
2796 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors()); 2802 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2797 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind); 2803 PcDescriptors::Iterator iter(pc_descs, RawPcDescriptors::kAnyKind);
2798 const RawPcDescriptors::PcDescriptorRec& rec0 = iter.Next(); 2804 RawPcDescriptors::PcDescriptorRec rec0;
2799 const RawPcDescriptors::PcDescriptorRec& rec1 = iter.Next(); 2805 RawPcDescriptors::PcDescriptorRec rec1;
2800 const RawPcDescriptors::PcDescriptorRec& rec2 = iter.Next(); 2806 RawPcDescriptors::PcDescriptorRec rec2;
2801 const RawPcDescriptors::PcDescriptorRec& rec3 = iter.Next(); 2807 RawPcDescriptors::PcDescriptorRec rec3;
2802 const RawPcDescriptors::PcDescriptorRec& rec4 = iter.Next(); 2808 RawPcDescriptors::PcDescriptorRec rec4;
2803 const RawPcDescriptors::PcDescriptorRec& rec5 = iter.Next(); 2809 RawPcDescriptors::PcDescriptorRec rec5;
2810 iter.NextRec(&rec0);
2811 iter.NextRec(&rec1);
2812 iter.NextRec(&rec2);
2813 iter.NextRec(&rec3);
2814 iter.NextRec(&rec4);
2815 iter.NextRec(&rec5);
2804 ASSERT(!iter.HasNext()); 2816 ASSERT(!iter.HasNext());
2805 2817
2806 EXPECT_EQ(-1, rec0.try_index()); 2818 EXPECT_EQ(-1, rec0.try_index());
2807 EXPECT_EQ(static_cast<uword>(10), rec0.pc()); 2819 EXPECT_EQ(static_cast<uword>(10), rec0.pc());
2808 EXPECT_EQ(1, rec0.deopt_id()); 2820 EXPECT_EQ(1, rec0.deopt_id());
2809 EXPECT_EQ(20, rec0.token_pos()); 2821 EXPECT_EQ(20, rec0.token_pos());
2810 2822
2811 EXPECT_EQ(-1, rec5.try_index()); 2823 EXPECT_EQ(-1, rec5.try_index());
2812 EXPECT_EQ(static_cast<uword>(80), rec5.pc()); 2824 EXPECT_EQ(static_cast<uword>(80), rec5.pc());
2813 EXPECT_EQ(150, rec5.token_pos()); 2825 EXPECT_EQ(150, rec5.token_pos());
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 EXPECT_VALID(h_result); 4210 EXPECT_VALID(h_result);
4199 Integer& result = Integer::Handle(); 4211 Integer& result = Integer::Handle();
4200 result ^= Api::UnwrapHandle(h_result); 4212 result ^= Api::UnwrapHandle(h_result);
4201 String& foo = String::Handle(String::New("foo")); 4213 String& foo = String::Handle(String::New("foo"));
4202 Integer& expected = Integer::Handle(); 4214 Integer& expected = Integer::Handle();
4203 expected ^= foo.HashCode(); 4215 expected ^= foo.HashCode();
4204 EXPECT(result.IsIdenticalTo(expected)); 4216 EXPECT(result.IsIdenticalTo(expected));
4205 } 4217 }
4206 4218
4207 } // namespace dart 4219 } // 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