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 | 7 |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 test->node_sequence()->Add(new ReturnNode(kPos, l)); | 42 test->node_sequence()->Add(new ReturnNode(kPos, l)); |
43 l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(3))); | 43 l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(3))); |
44 test->node_sequence()->Add(new ReturnNode(kPos, l)); | 44 test->node_sequence()->Add(new ReturnNode(kPos, l)); |
45 parsed_function->SetNodeSequence(test->node_sequence()); | 45 parsed_function->SetNodeSequence(test->node_sequence()); |
46 parsed_function->set_instantiator(NULL); | 46 parsed_function->set_instantiator(NULL); |
47 parsed_function->set_default_parameter_values(Object::null_array()); | 47 parsed_function->set_default_parameter_values(Object::null_array()); |
48 parsed_function->AllocateVariables(); | 48 parsed_function->AllocateVariables(); |
49 bool retval; | 49 bool retval; |
50 Isolate* isolate = Isolate::Current(); | 50 Isolate* isolate = Isolate::Current(); |
51 EXPECT(isolate != NULL); | 51 EXPECT(isolate != NULL); |
52 LongJump* base = isolate->long_jump_base(); | 52 LongJumpScope jump; |
53 LongJump jump; | |
54 isolate->set_long_jump_base(&jump); | |
55 if (setjmp(*jump.Set()) == 0) { | 53 if (setjmp(*jump.Set()) == 0) { |
56 // Build a stackmap table and some stackmap table entries. | 54 // Build a stackmap table and some stackmap table entries. |
57 const intptr_t kStackSlotCount = 11; | 55 const intptr_t kStackSlotCount = 11; |
58 StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder(); | 56 StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder(); |
59 EXPECT(stackmap_table_builder != NULL); | 57 EXPECT(stackmap_table_builder != NULL); |
60 | 58 |
61 BitmapBuilder* stack_bitmap = new BitmapBuilder(); | 59 BitmapBuilder* stack_bitmap = new BitmapBuilder(); |
62 EXPECT(stack_bitmap != NULL); | 60 EXPECT(stack_bitmap != NULL); |
63 EXPECT_EQ(0, stack_bitmap->Length()); | 61 EXPECT_EQ(0, stack_bitmap->Length()); |
64 stack_bitmap->Set(0, true); | 62 stack_bitmap->Set(0, true); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 stack_map ^= stack_map_list.At(3); | 167 stack_map ^= stack_map_list.At(3); |
170 EXPECT_EQ(kStackSlotCount, stack_map.Length()); | 168 EXPECT_EQ(kStackSlotCount, stack_map.Length()); |
171 for (intptr_t i = 0; i < kStackSlotCount; ++i) { | 169 for (intptr_t i = 0; i < kStackSlotCount; ++i) { |
172 EXPECT_EQ(expectation3[i], stack_map.IsObject(i)); | 170 EXPECT_EQ(expectation3[i], stack_map.IsObject(i)); |
173 } | 171 } |
174 retval = true; | 172 retval = true; |
175 } else { | 173 } else { |
176 retval = false; | 174 retval = false; |
177 } | 175 } |
178 EXPECT(retval); | 176 EXPECT(retval); |
179 isolate->set_long_jump_base(base); | |
180 } | 177 } |
181 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) | 178 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) |
182 | 179 |
183 | 180 |
184 static void NativeFunc(Dart_NativeArguments args) { | 181 static void NativeFunc(Dart_NativeArguments args) { |
185 Dart_Handle i = Dart_GetNativeArgument(args, 0); | 182 Dart_Handle i = Dart_GetNativeArgument(args, 0); |
186 Dart_Handle k = Dart_GetNativeArgument(args, 1); | 183 Dart_Handle k = Dart_GetNativeArgument(args, 1); |
187 int64_t value = -1; | 184 int64_t value = -1; |
188 EXPECT_VALID(Dart_IntegerToInt64(i, &value)); | 185 EXPECT_VALID(Dart_IntegerToInt64(i, &value)); |
189 EXPECT_EQ(10, value); | 186 EXPECT_EQ(10, value); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 273 |
277 // Now invoke 'A.moo' and it will trigger a GC when the native function | 274 // Now invoke 'A.moo' and it will trigger a GC when the native function |
278 // is called, this should then cause the stack map of function 'A.foo' | 275 // is called, this should then cause the stack map of function 'A.foo' |
279 // to be traversed and the appropriate objects visited. | 276 // to be traversed and the appropriate objects visited. |
280 const Object& result = Object::Handle( | 277 const Object& result = Object::Handle( |
281 DartEntry::InvokeFunction(function_foo, Object::empty_array())); | 278 DartEntry::InvokeFunction(function_foo, Object::empty_array())); |
282 EXPECT(!result.IsError()); | 279 EXPECT(!result.IsError()); |
283 } | 280 } |
284 | 281 |
285 } // namespace dart | 282 } // namespace dart |
OLD | NEW |