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

Side by Side Diff: runtime/vm/unit_test.h

Issue 12260026: Add support for object pool (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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/stub_code.cc ('k') | runtime/vm/unit_test.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifndef VM_UNIT_TEST_H_ 5 #ifndef VM_UNIT_TEST_H_
6 #define VM_UNIT_TEST_H_ 6 #define VM_UNIT_TEST_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "vm/ast.h" 10 #include "vm/ast.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void AssemblerTestGenerate##name(Assembler* assembler) 44 void AssemblerTestGenerate##name(Assembler* assembler)
45 45
46 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test 46 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test
47 // for the assembler. 47 // for the assembler.
48 #define ASSEMBLER_TEST_EXTERN(name) \ 48 #define ASSEMBLER_TEST_EXTERN(name) \
49 extern void AssemblerTestGenerate##name(Assembler* assembler); 49 extern void AssemblerTestGenerate##name(Assembler* assembler);
50 50
51 // The ASSEMBLER_TEST_RUN macro is used to execute the assembler unit 51 // The ASSEMBLER_TEST_RUN macro is used to execute the assembler unit
52 // test generated using the ASSEMBLER_TEST_GENERATE macro. 52 // test generated using the ASSEMBLER_TEST_GENERATE macro.
53 // C++ callee-saved registers are not preserved. Arguments may be passed in. 53 // C++ callee-saved registers are not preserved. Arguments may be passed in.
54 #define ASSEMBLER_TEST_RUN(name, entry) \ 54 #define ASSEMBLER_TEST_RUN(name, test) \
55 static void AssemblerTestRun##name(uword entry); \ 55 static void AssemblerTestRun##name(AssemblerTest* test); \
56 TEST_CASE(name) { \ 56 TEST_CASE(name) { \
57 Assembler __assembler__; \ 57 Assembler __assembler__; \
58 AssemblerTest __test__(""#name, &__assembler__); \ 58 AssemblerTest test(""#name, &__assembler__); \
59 AssemblerTestGenerate##name(__test__.assembler()); \ 59 AssemblerTestGenerate##name(test.assembler()); \
60 AssemblerTestRun##name(__test__.Assemble()); \ 60 test.Assemble(); \
61 AssemblerTestRun##name(&test); \
61 } \ 62 } \
62 static void AssemblerTestRun##name(uword entry) 63 static void AssemblerTestRun##name(AssemblerTest* test)
63 64
64 // Populate node list with AST nodes. 65 // Populate node list with AST nodes.
65 #define CODEGEN_TEST_GENERATE(name, test) \ 66 #define CODEGEN_TEST_GENERATE(name, test) \
66 static void CodeGenTestGenerate##name(CodeGenTest* test) 67 static void CodeGenTestGenerate##name(CodeGenTest* test)
67 68
68 // Populate node list with AST nodes, possibly using the provided function 69 // Populate node list with AST nodes, possibly using the provided function
69 // object built by a previous CODEGEN_TEST_GENERATE. 70 // object built by a previous CODEGEN_TEST_GENERATE.
70 #define CODEGEN_TEST2_GENERATE(name, function, test) \ 71 #define CODEGEN_TEST2_GENERATE(name, function, test) \
71 static void CodeGenTestGenerate##name(const Function& function, \ 72 static void CodeGenTestGenerate##name(const Function& function, \
72 CodeGenTest* test) 73 CodeGenTest* test)
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Isolate* isolate_; 265 Isolate* isolate_;
265 266
266 DISALLOW_COPY_AND_ASSIGN(TestIsolateScope); 267 DISALLOW_COPY_AND_ASSIGN(TestIsolateScope);
267 }; 268 };
268 269
269 270
270 class AssemblerTest { 271 class AssemblerTest {
271 public: 272 public:
272 AssemblerTest(const char* name, Assembler* assembler) 273 AssemblerTest(const char* name, Assembler* assembler)
273 : name_(name), 274 : name_(name),
274 assembler_(assembler) { 275 assembler_(assembler),
276 code_(Code::ZoneHandle()) {
275 ASSERT(name != NULL); 277 ASSERT(name != NULL);
276 ASSERT(assembler != NULL); 278 ASSERT(assembler != NULL);
277 } 279 }
278 ~AssemblerTest() { } 280 ~AssemblerTest() { }
279 281
280 Assembler* assembler() const { return assembler_; } 282 Assembler* assembler() const { return assembler_; }
281 283
282 // Assemble test and return entry. 284 const Code& code() const { return code_; }
283 uword Assemble(); 285
286 uword entry() const { return entry_; }
287
288 // Assemble test and set code_ and entry_.
289 void Assemble();
284 290
285 private: 291 private:
286 const char* name_; 292 const char* name_;
287 Assembler* assembler_; 293 Assembler* assembler_;
294 Code& code_;
295 uword entry_;
288 296
289 DISALLOW_COPY_AND_ASSIGN(AssemblerTest); 297 DISALLOW_COPY_AND_ASSIGN(AssemblerTest);
290 }; 298 };
291 299
292 300
293 class CodeGenTest { 301 class CodeGenTest {
294 public: 302 public:
295 explicit CodeGenTest(const char* name); 303 explicit CodeGenTest(const char* name);
296 ~CodeGenTest() { } 304 ~CodeGenTest() { }
297 305
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } else { \ 357 } else { \
350 dart::Expect(__FILE__, __LINE__).Fail( \ 358 dart::Expect(__FILE__, __LINE__).Fail( \
351 "expected '%s' to be an error handle but found a valid handle.\n", \ 359 "expected '%s' to be an error handle but found a valid handle.\n", \
352 #handle); \ 360 #handle); \
353 } \ 361 } \
354 } while (0) 362 } while (0)
355 363
356 } // namespace dart 364 } // namespace dart
357 365
358 #endif // VM_UNIT_TEST_H_ 366 #endif // VM_UNIT_TEST_H_
OLDNEW
« no previous file with comments | « runtime/vm/stub_code.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698