| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) { | 79 void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) { |
| 80 Dart_EnterScope(); | 80 Dart_EnterScope(); |
| 81 Dart_Handle index = Dart_GetNativeArgument(args, 0); | 81 Dart_Handle index = Dart_GetNativeArgument(args, 0); |
| 82 Dart_Handle name = Dart_GetNativeArgument(args, 1); | 82 Dart_Handle name = Dart_GetNativeArgument(args, 1); |
| 83 const Smi& frame_index_smi = Smi::CheckedHandle(Api::UnwrapHandle(index)); | 83 const Smi& frame_index_smi = Smi::CheckedHandle(Api::UnwrapHandle(index)); |
| 84 const char* expected_name = | 84 const char* expected_name = |
| 85 String::CheckedHandle(Api::UnwrapHandle(name)).ToCString(); | 85 String::CheckedHandle(Api::UnwrapHandle(name)).ToCString(); |
| 86 int frame_index = frame_index_smi.Value(); | 86 int frame_index = frame_index_smi.Value(); |
| 87 int count = 0; | 87 int count = 0; |
| 88 DartFrameIterator frames; | 88 DartFrameIterator frames; |
| 89 DartFrame* frame = frames.NextFrame(); | 89 StackFrame* frame = frames.NextFrame(); |
| 90 while (frame != NULL) { | 90 while (frame != NULL) { |
| 91 if (count == frame_index) { | 91 if (count == frame_index) { |
| 92 // Find the function corresponding to this frame and check if it | 92 // Find the function corresponding to this frame and check if it |
| 93 // matches the function name passed in. | 93 // matches the function name passed in. |
| 94 const Function& function = | 94 const Function& function = |
| 95 Function::Handle(frame->LookupDartFunction()); | 95 Function::Handle(frame->LookupDartFunction()); |
| 96 if (function.IsNull()) { | 96 if (function.IsNull()) { |
| 97 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n"); | 97 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n"); |
| 98 } | 98 } |
| 99 const Code& code = Code::Handle(frame->LookupDartCode()); | 99 const Code& code = Code::Handle(frame->LookupDartCode()); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 "}"; | 290 "}"; |
| 291 Dart_Handle lib = TestCase::LoadTestScript( | 291 Dart_Handle lib = TestCase::LoadTestScript( |
| 292 kScriptChars, | 292 kScriptChars, |
| 293 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 293 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 294 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test")); | 294 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test")); |
| 295 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL)); | 295 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL)); |
| 296 } | 296 } |
| 297 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64. | 297 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64. |
| 298 | 298 |
| 299 } // namespace dart | 299 } // namespace dart |
| OLD | NEW |