| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 "class StackFrameTest {" | 241 "class StackFrameTest {" |
| 242 " static testMain() {" | 242 " static testMain() {" |
| 243 " Second obj = new Second();" | 243 " Second obj = new Second();" |
| 244 " obj.method1(1);" | 244 " obj.method1(1);" |
| 245 " obj.method1(2);" | 245 " obj.method1(2);" |
| 246 " }" | 246 " }" |
| 247 "}"; | 247 "}"; |
| 248 Dart_Handle lib = TestCase::LoadTestScript( | 248 Dart_Handle lib = TestCase::LoadTestScript( |
| 249 kScriptChars, | 249 kScriptChars, |
| 250 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 250 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 251 Dart_InvokeStatic(lib, | 251 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrameTest")); |
| 252 Dart_NewString("StackFrameTest"), | 252 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL)); |
| 253 Dart_NewString("testMain"), | |
| 254 0, | |
| 255 NULL); | |
| 256 } | 253 } |
| 257 | 254 |
| 258 | 255 |
| 259 // Unit test case to verify stack frame iteration. | 256 // Unit test case to verify stack frame iteration. |
| 260 TEST_CASE(ValidateNoSuchMethodStackFrameIteration) { | 257 TEST_CASE(ValidateNoSuchMethodStackFrameIteration) { |
| 261 const char* kScriptChars = | 258 const char* kScriptChars = |
| 262 "class StackFrame {" | 259 "class StackFrame {" |
| 263 " static equals(var obj1, var obj2) native \"StackFrame_equals\";" | 260 " static equals(var obj1, var obj2) native \"StackFrame_equals\";" |
| 264 " static int frameCount() native \"StackFrame_frameCount\";" | 261 " static int frameCount() native \"StackFrame_frameCount\";" |
| 265 " static int dartFrameCount() native \"StackFrame_dartFrameCount\";" | 262 " static int dartFrameCount() native \"StackFrame_dartFrameCount\";" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 287 " return 5;" | 284 " return 5;" |
| 288 " }" | 285 " }" |
| 289 " static testMain() {" | 286 " static testMain() {" |
| 290 " var obj = new StackFrame2Test();" | 287 " var obj = new StackFrame2Test();" |
| 291 " StackFrame.equals(5, obj.foo(101, 202));" | 288 " StackFrame.equals(5, obj.foo(101, 202));" |
| 292 " }" | 289 " }" |
| 293 "}"; | 290 "}"; |
| 294 Dart_Handle lib = TestCase::LoadTestScript( | 291 Dart_Handle lib = TestCase::LoadTestScript( |
| 295 kScriptChars, | 292 kScriptChars, |
| 296 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 293 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 297 Dart_InvokeStatic(lib, | 294 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test")); |
| 298 Dart_NewString("StackFrame2Test"), | 295 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL)); |
| 299 Dart_NewString("testMain"), | |
| 300 0, | |
| 301 NULL); | |
| 302 } | 296 } |
| 303 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64. | 297 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64. |
| 304 | 298 |
| 305 } // namespace dart | 299 } // namespace dart |
| OLD | NEW |