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/globals.h" | 6 #include "vm/globals.h" |
7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
8 | 8 |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 isolate->set_long_jump_base(&jump); | 55 isolate->set_long_jump_base(&jump); |
56 if (setjmp(*jump.Set()) == 0) { | 56 if (setjmp(*jump.Set()) == 0) { |
57 // Build a stackmap table and some stackmap table entries. | 57 // Build a stackmap table and some stackmap table entries. |
58 const intptr_t kStackSlotCount = 11; | 58 const intptr_t kStackSlotCount = 11; |
59 StackmapTableBuilder* stackmap_table_builder = | 59 StackmapTableBuilder* stackmap_table_builder = |
60 new StackmapTableBuilder(kStackSlotCount); | 60 new StackmapTableBuilder(kStackSlotCount); |
61 EXPECT(stackmap_table_builder != NULL); | 61 EXPECT(stackmap_table_builder != NULL); |
62 | 62 |
63 BitmapBuilder* stack_bitmap = new BitmapBuilder(); | 63 BitmapBuilder* stack_bitmap = new BitmapBuilder(); |
64 EXPECT(stack_bitmap != NULL); | 64 EXPECT(stack_bitmap != NULL); |
| 65 EXPECT_EQ(0, stack_bitmap->Length()); |
65 stack_bitmap->Set(0, true); | 66 stack_bitmap->Set(0, true); |
| 67 EXPECT_EQ(1, stack_bitmap->Length()); |
| 68 stack_bitmap->SetLength(kStackSlotCount); |
| 69 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); |
| 70 |
66 bool expectation0[kStackSlotCount] = { true }; | 71 bool expectation0[kStackSlotCount] = { true }; |
67 for (intptr_t i = 0; i < kStackSlotCount; ++i) { | 72 for (intptr_t i = 0; i < kStackSlotCount; ++i) { |
68 EXPECT_EQ(expectation0[i], stack_bitmap->Get(i)); | 73 EXPECT_EQ(expectation0[i], stack_bitmap->Get(i)); |
69 } | 74 } |
70 // Add a stack map entry at pc offset 0. | 75 // Add a stack map entry at pc offset 0. |
71 stackmap_table_builder->AddEntry(0, stack_bitmap); | 76 stackmap_table_builder->AddEntry(0, stack_bitmap); |
72 | 77 |
73 stack_bitmap = new BitmapBuilder(); | 78 stack_bitmap = new BitmapBuilder(); |
74 EXPECT(stack_bitmap != NULL); | 79 EXPECT(stack_bitmap != NULL); |
| 80 EXPECT_EQ(0, stack_bitmap->Length()); |
75 stack_bitmap->Set(0, true); | 81 stack_bitmap->Set(0, true); |
76 stack_bitmap->Set(1, false); | 82 stack_bitmap->Set(1, false); |
77 stack_bitmap->Set(2, true); | 83 stack_bitmap->Set(2, true); |
| 84 EXPECT_EQ(3, stack_bitmap->Length()); |
| 85 stack_bitmap->SetLength(kStackSlotCount); |
| 86 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); |
| 87 |
78 bool expectation1[kStackSlotCount] = { true, false, true }; | 88 bool expectation1[kStackSlotCount] = { true, false, true }; |
79 for (intptr_t i = 0; i < kStackSlotCount; ++i) { | 89 for (intptr_t i = 0; i < kStackSlotCount; ++i) { |
80 EXPECT_EQ(expectation1[i], stack_bitmap->Get(i)); | 90 EXPECT_EQ(expectation1[i], stack_bitmap->Get(i)); |
81 } | 91 } |
82 // Add a stack map entry at pc offset 1. | 92 // Add a stack map entry at pc offset 1. |
83 stackmap_table_builder->AddEntry(1, stack_bitmap); | 93 stackmap_table_builder->AddEntry(1, stack_bitmap); |
84 | 94 |
85 stack_bitmap = new BitmapBuilder(); | 95 stack_bitmap = new BitmapBuilder(); |
86 EXPECT(stack_bitmap != NULL); | 96 EXPECT(stack_bitmap != NULL); |
| 97 EXPECT_EQ(0, stack_bitmap->Length()); |
87 stack_bitmap->Set(0, true); | 98 stack_bitmap->Set(0, true); |
88 stack_bitmap->Set(1, false); | 99 stack_bitmap->Set(1, false); |
89 stack_bitmap->Set(2, true); | 100 stack_bitmap->Set(2, true); |
90 stack_bitmap->SetRange(3, 5, true); | 101 stack_bitmap->SetRange(3, 5, true); |
| 102 EXPECT_EQ(6, stack_bitmap->Length()); |
| 103 stack_bitmap->SetLength(kStackSlotCount); |
| 104 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); |
| 105 |
91 bool expectation2[kStackSlotCount] = | 106 bool expectation2[kStackSlotCount] = |
92 { true, false, true, true, true, true }; | 107 { true, false, true, true, true, true }; |
93 for (intptr_t i = 0; i < kStackSlotCount; ++i) { | 108 for (intptr_t i = 0; i < kStackSlotCount; ++i) { |
94 EXPECT_EQ(expectation2[i], stack_bitmap->Get(i)); | 109 EXPECT_EQ(expectation2[i], stack_bitmap->Get(i)); |
95 } | 110 } |
96 // Add a stack map entry at pc offset 2. | 111 // Add a stack map entry at pc offset 2. |
97 stackmap_table_builder->AddEntry(2, stack_bitmap); | 112 stackmap_table_builder->AddEntry(2, stack_bitmap); |
98 | 113 |
99 stack_bitmap = new BitmapBuilder(); | 114 stack_bitmap = new BitmapBuilder(); |
100 EXPECT(stack_bitmap != NULL); | 115 EXPECT(stack_bitmap != NULL); |
| 116 EXPECT_EQ(0, stack_bitmap->Length()); |
101 stack_bitmap->Set(0, true); | 117 stack_bitmap->Set(0, true); |
102 stack_bitmap->Set(1, false); | 118 stack_bitmap->Set(1, false); |
103 stack_bitmap->Set(2, true); | 119 stack_bitmap->Set(2, true); |
104 stack_bitmap->SetRange(3, 5, true); | 120 stack_bitmap->SetRange(3, 5, true); |
105 stack_bitmap->SetRange(6, 9, false); | 121 stack_bitmap->SetRange(6, 9, false); |
106 stack_bitmap->Set(10, true); | 122 stack_bitmap->Set(10, true); |
| 123 EXPECT_EQ(11, stack_bitmap->Length()); |
| 124 stack_bitmap->SetLength(kStackSlotCount); |
| 125 EXPECT_EQ(kStackSlotCount, stack_bitmap->Length()); |
| 126 |
107 bool expectation3[kStackSlotCount] = | 127 bool expectation3[kStackSlotCount] = |
108 { true, false, true, true, true, true, false, false, | 128 { true, false, true, true, true, true, false, false, |
109 false, false, true }; | 129 false, false, true }; |
110 for (intptr_t i = 0; i < kStackSlotCount; ++i) { | 130 for (intptr_t i = 0; i < kStackSlotCount; ++i) { |
111 EXPECT_EQ(expectation3[i], stack_bitmap->Get(i)); | 131 EXPECT_EQ(expectation3[i], stack_bitmap->Get(i)); |
112 } | 132 } |
113 // Add a stack map entry at pc offset 3. | 133 // Add a stack map entry at pc offset 3. |
114 stackmap_table_builder->AddEntry(3, stack_bitmap); | 134 stackmap_table_builder->AddEntry(3, stack_bitmap); |
115 | 135 |
116 const Error& error = | 136 const Error& error = |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 GrowableArray<const Object*> arguments; | 275 GrowableArray<const Object*> arguments; |
256 const Array& kNoArgumentNames = Array::Handle(); | 276 const Array& kNoArgumentNames = Array::Handle(); |
257 Object& result = Object::Handle(); | 277 Object& result = Object::Handle(); |
258 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); | 278 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); |
259 EXPECT(!result.IsError()); | 279 EXPECT(!result.IsError()); |
260 } | 280 } |
261 | 281 |
262 } // namespace dart | 282 } // namespace dart |
263 | 283 |
264 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 284 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
OLD | NEW |