| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (count == frame_index) { | 90 if (count == frame_index) { |
| 91 // Find the function corresponding to this frame and check if it | 91 // Find the function corresponding to this frame and check if it |
| 92 // matches the function name passed in. | 92 // matches the function name passed in. |
| 93 const Function& function = | 93 const Function& function = |
| 94 Function::Handle(frame->LookupDartFunction()); | 94 Function::Handle(frame->LookupDartFunction()); |
| 95 if (function.IsNull()) { | 95 if (function.IsNull()) { |
| 96 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n"); | 96 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n"); |
| 97 } | 97 } |
| 98 const char* name = function.ToFullyQualifiedCString(); | 98 const char* name = function.ToFullyQualifiedCString(); |
| 99 // Currently all unit tests are loaded as being part of dart:core-lib. | 99 // Currently all unit tests are loaded as being part of dart:core-lib. |
| 100 Isolate* isolate = Isolate::Current(); | |
| 101 String& url = String::Handle(String::New(TestCase::url())); | 100 String& url = String::Handle(String::New(TestCase::url())); |
| 102 const Library& lib = Library::Handle(Library::LookupLibrary(url)); | 101 const Library& lib = Library::Handle(Library::LookupLibrary(url)); |
| 103 ASSERT(!lib.IsNull()); | 102 ASSERT(!lib.IsNull()); |
| 104 const char* lib_name = String::Handle(lib.url()).ToCString(); | 103 const char* lib_name = String::Handle(lib.url()).ToCString(); |
| 105 intptr_t length = OS::SNPrint(NULL, 0, "%s_%s", lib_name, expected_name); | 104 intptr_t length = OS::SNPrint(NULL, 0, "%s_%s", lib_name, expected_name); |
| 106 char* full_name = isolate->current_zone()->Alloc<char>(length + 1); | 105 char* full_name = Thread::Current()->zone()->Alloc<char>(length + 1); |
| 107 ASSERT(full_name != NULL); | 106 ASSERT(full_name != NULL); |
| 108 OS::SNPrint(full_name, (length + 1), "%s_%s", lib_name, expected_name); | 107 OS::SNPrint(full_name, (length + 1), "%s_%s", lib_name, expected_name); |
| 109 if (strcmp(full_name, name) != 0) { | 108 if (strcmp(full_name, name) != 0) { |
| 110 FATAL("StackFrame_validateFrame fails, incorrect frame.\n"); | 109 FATAL("StackFrame_validateFrame fails, incorrect frame.\n"); |
| 111 } | 110 } |
| 112 return; | 111 return; |
| 113 } | 112 } |
| 114 count += 1; // Count the dart frames. | 113 count += 1; // Count the dart frames. |
| 115 frame = frames.NextFrame(); | 114 frame = frames.NextFrame(); |
| 116 } | 115 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 "}"; | 320 "}"; |
| 322 } | 321 } |
| 323 Dart_Handle lib = TestCase::LoadTestScript( | 322 Dart_Handle lib = TestCase::LoadTestScript( |
| 324 kScriptChars, | 323 kScriptChars, |
| 325 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 324 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 326 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test")); | 325 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test")); |
| 327 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL)); | 326 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, NULL)); |
| 328 } | 327 } |
| 329 | 328 |
| 330 } // namespace dart | 329 } // namespace dart |
| OLD | NEW |