Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: runtime/vm/stack_frame_test.cc

Issue 10836061: Change the zone allocation api. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const Code& code = Code::Handle(frame->LookupDartCode()); 99 const Code& code = Code::Handle(frame->LookupDartCode());
100 EXPECT(code.raw() == function.unoptimized_code()); 100 EXPECT(code.raw() == function.unoptimized_code());
101 const char* name = function.ToFullyQualifiedCString(); 101 const char* name = function.ToFullyQualifiedCString();
102 // Currently all unit tests are loaded as being part of dart:core-lib. 102 // Currently all unit tests are loaded as being part of dart:core-lib.
103 Isolate* isolate = Isolate::Current(); 103 Isolate* isolate = Isolate::Current();
104 String& url = String::Handle(String::New(TestCase::url())); 104 String& url = String::Handle(String::New(TestCase::url()));
105 const Library& lib = Library::Handle(Library::LookupLibrary(url)); 105 const Library& lib = Library::Handle(Library::LookupLibrary(url));
106 ASSERT(!lib.IsNull()); 106 ASSERT(!lib.IsNull());
107 const char* lib_name = String::Handle(lib.url()).ToCString(); 107 const char* lib_name = String::Handle(lib.url()).ToCString();
108 intptr_t length = OS::SNPrint(NULL, 0, "%s_%s", lib_name, expected_name); 108 intptr_t length = OS::SNPrint(NULL, 0, "%s_%s", lib_name, expected_name);
109 char* full_name = reinterpret_cast<char*>( 109 char* full_name = isolate->current_zone()->Alloc<char>(length + 1);
110 isolate->current_zone()->Allocate(length + 1));
111 ASSERT(full_name != NULL); 110 ASSERT(full_name != NULL);
112 OS::SNPrint(full_name, (length + 1), "%s_%s", lib_name, expected_name); 111 OS::SNPrint(full_name, (length + 1), "%s_%s", lib_name, expected_name);
113 if (strcmp(full_name, name) != 0) { 112 if (strcmp(full_name, name) != 0) {
114 FATAL("StackFrame_validateFrame fails, incorrect frame.\n"); 113 FATAL("StackFrame_validateFrame fails, incorrect frame.\n");
115 } 114 }
116 Dart_ExitScope(); 115 Dart_ExitScope();
117 return; 116 return;
118 } 117 }
119 count += 1; // Count the dart frames. 118 count += 1; // Count the dart frames.
120 frame = frames.NextFrame(); 119 frame = frames.NextFrame();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 "}"; 284 "}";
286 Dart_Handle lib = TestCase::LoadTestScript( 285 Dart_Handle lib = TestCase::LoadTestScript(
287 kScriptChars, 286 kScriptChars,
288 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 287 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
289 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test")); 288 Dart_Handle cls = Dart_GetClass(lib, Dart_NewString("StackFrame2Test"));
290 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL)); 289 EXPECT_VALID(Dart_Invoke(cls, Dart_NewString("testMain"), 0, NULL));
291 } 290 }
292 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64. 291 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64.
293 292
294 } // namespace dart 293 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698