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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } else { | 175 } else { |
176 retval = false; | 176 retval = false; |
177 } | 177 } |
178 EXPECT(retval); | 178 EXPECT(retval); |
179 isolate->set_long_jump_base(base); | 179 isolate->set_long_jump_base(base); |
180 } | 180 } |
181 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) | 181 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) |
182 | 182 |
183 | 183 |
184 static void NativeFunc(Dart_NativeArguments args) { | 184 static void NativeFunc(Dart_NativeArguments args) { |
185 Dart_EnterScope(); | |
186 Dart_Handle i = Dart_GetNativeArgument(args, 0); | 185 Dart_Handle i = Dart_GetNativeArgument(args, 0); |
187 Dart_Handle k = Dart_GetNativeArgument(args, 1); | 186 Dart_Handle k = Dart_GetNativeArgument(args, 1); |
188 int64_t value = -1; | 187 int64_t value = -1; |
189 EXPECT_VALID(Dart_IntegerToInt64(i, &value)); | 188 EXPECT_VALID(Dart_IntegerToInt64(i, &value)); |
190 EXPECT_EQ(10, value); | 189 EXPECT_EQ(10, value); |
191 EXPECT_VALID(Dart_IntegerToInt64(k, &value)); | 190 EXPECT_VALID(Dart_IntegerToInt64(k, &value)); |
192 EXPECT_EQ(20, value); | 191 EXPECT_EQ(20, value); |
193 Isolate::Current()->heap()->CollectAllGarbage(); | 192 Isolate::Current()->heap()->CollectAllGarbage(); |
194 Dart_ExitScope(); | |
195 } | 193 } |
196 | 194 |
197 | 195 |
198 static Dart_NativeFunction native_resolver(Dart_Handle name, | 196 static Dart_NativeFunction native_resolver(Dart_Handle name, |
199 int argument_count) { | 197 int argument_count) { |
200 return reinterpret_cast<Dart_NativeFunction>(&NativeFunc); | 198 return reinterpret_cast<Dart_NativeFunction>(&NativeFunc); |
201 } | 199 } |
202 | 200 |
203 | 201 |
204 TEST_CASE(StackmapGC) { | 202 TEST_CASE(StackmapGC) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 274 |
277 // Now invoke 'A.moo' and it will trigger a GC when the native function | 275 // 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' | 276 // is called, this should then cause the stack map of function 'A.foo' |
279 // to be traversed and the appropriate objects visited. | 277 // to be traversed and the appropriate objects visited. |
280 const Object& result = Object::Handle( | 278 const Object& result = Object::Handle( |
281 DartEntry::InvokeFunction(function_foo, Object::empty_array())); | 279 DartEntry::InvokeFunction(function_foo, Object::empty_array())); |
282 EXPECT(!result.IsError()); | 280 EXPECT(!result.IsError()); |
283 } | 281 } |
284 | 282 |
285 } // namespace dart | 283 } // namespace dart |
286 | |
OLD | NEW |