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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 retval = true; | 175 retval = true; |
176 } else { | 176 } else { |
177 retval = false; | 177 retval = false; |
178 } | 178 } |
179 EXPECT(retval); | 179 EXPECT(retval); |
180 isolate->set_long_jump_base(base); | 180 isolate->set_long_jump_base(base); |
181 } | 181 } |
182 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) | 182 CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1)) |
183 | 183 |
184 | 184 |
185 DEFINE_NATIVE_ENTRY(NativeFunc, 2) { | 185 static void NativeFunc(Dart_NativeArguments args) { |
186 GET_NATIVE_ARGUMENT(Smi, i, arguments->At(0)); | 186 Dart_EnterScope(); |
187 GET_NATIVE_ARGUMENT(Smi, k, arguments->At(1)); | 187 Dart_Handle i = Dart_GetNativeArgument(args, 0); |
188 EXPECT_EQ(10, i.Value()); | 188 Dart_Handle k = Dart_GetNativeArgument(args, 1); |
189 EXPECT_EQ(20, k.Value()); | 189 int64_t value = -1; |
| 190 EXPECT_VALID(Dart_IntegerToInt64(i, &value)); |
| 191 EXPECT_EQ(10, value); |
| 192 EXPECT_VALID(Dart_IntegerToInt64(k, &value)); |
| 193 EXPECT_EQ(20, value); |
190 Isolate::Current()->heap()->CollectAllGarbage(); | 194 Isolate::Current()->heap()->CollectAllGarbage(); |
191 } | 195 } |
192 | 196 |
193 | 197 |
194 static Dart_NativeFunction native_resolver(Dart_Handle name, | 198 static Dart_NativeFunction native_resolver(Dart_Handle name, |
195 int argument_count) { | 199 int argument_count) { |
196 return reinterpret_cast<Dart_NativeFunction>(&DN_NativeFunc); | 200 return reinterpret_cast<Dart_NativeFunction>(&NativeFunc); |
197 } | 201 } |
198 | 202 |
199 | 203 |
200 TEST_CASE(StackmapGC) { | 204 TEST_CASE(StackmapGC) { |
201 const char* kScriptChars = | 205 const char* kScriptChars = |
202 "class A {" | 206 "class A {" |
203 " static void func(var i, var k) native 'NativeFunc';" | 207 " static void func(var i, var k) native 'NativeFunc';" |
204 " static foo() {" | 208 " static foo() {" |
205 " var i;" | 209 " var i;" |
206 " var s1;" | 210 " var s1;" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 GrowableArray<const Object*> arguments; | 278 GrowableArray<const Object*> arguments; |
275 const Array& kNoArgumentNames = Array::Handle(); | 279 const Array& kNoArgumentNames = Array::Handle(); |
276 Object& result = Object::Handle(); | 280 Object& result = Object::Handle(); |
277 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); | 281 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); |
278 EXPECT(!result.IsError()); | 282 EXPECT(!result.IsError()); |
279 } | 283 } |
280 | 284 |
281 } // namespace dart | 285 } // namespace dart |
282 | 286 |
283 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 287 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
OLD | NEW |