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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "include/dart_tools_api.h" | 7 #include "include/dart_tools_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 fprintf(stderr, "%s\n", Dart_GetError(result)); | 1279 fprintf(stderr, "%s\n", Dart_GetError(result)); |
1280 } | 1280 } |
1281 EXPECT_VALID(result); | 1281 EXPECT_VALID(result); |
1282 Dart_ExitScope(); | 1282 Dart_ExitScope(); |
1283 } | 1283 } |
1284 Dart_ShutdownIsolate(); | 1284 Dart_ShutdownIsolate(); |
1285 free(isolate_snapshot_buffer); | 1285 free(isolate_snapshot_buffer); |
1286 } | 1286 } |
1287 | 1287 |
1288 | 1288 |
| 1289 #ifndef PRODUCT |
| 1290 |
| 1291 |
1289 UNIT_TEST_CASE(ScriptSnapshot) { | 1292 UNIT_TEST_CASE(ScriptSnapshot) { |
1290 const char* kLibScriptChars = | 1293 const char* kLibScriptChars = |
1291 "library dart_import_lib;" | 1294 "library dart_import_lib;" |
1292 "class LibFields {" | 1295 "class LibFields {" |
1293 " LibFields(int i, int j) : fld1 = i, fld2 = j {}" | 1296 " LibFields(int i, int j) : fld1 = i, fld2 = j {}" |
1294 " int fld1;" | 1297 " int fld1;" |
1295 " final int fld2;" | 1298 " final int fld2;" |
1296 "}"; | 1299 "}"; |
1297 const char* kScriptChars = | 1300 const char* kScriptChars = |
1298 "class TestTrace implements StackTrace {" | 1301 "class TestTrace implements StackTrace {" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); | 1462 result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); |
1460 EXPECT_VALID(result); | 1463 EXPECT_VALID(result); |
1461 Dart_ExitScope(); | 1464 Dart_ExitScope(); |
1462 Dart_ShutdownIsolate(); | 1465 Dart_ShutdownIsolate(); |
1463 } | 1466 } |
1464 free(full_snapshot); | 1467 free(full_snapshot); |
1465 free(script_snapshot); | 1468 free(script_snapshot); |
1466 } | 1469 } |
1467 | 1470 |
1468 | 1471 |
| 1472 #endif // !PRODUCT |
| 1473 |
| 1474 |
1469 UNIT_TEST_CASE(ScriptSnapshot1) { | 1475 UNIT_TEST_CASE(ScriptSnapshot1) { |
1470 const char* kScriptChars = | 1476 const char* kScriptChars = |
1471 "class _SimpleNumEnumerable<T extends num> {" | 1477 "class _SimpleNumEnumerable<T extends num> {" |
1472 "final Iterable<T> _source;" | 1478 "final Iterable<T> _source;" |
1473 "const _SimpleNumEnumerable(this._source) : super();" | 1479 "const _SimpleNumEnumerable(this._source) : super();" |
1474 "}"; | 1480 "}"; |
1475 | 1481 |
1476 Dart_Handle result; | 1482 Dart_Handle result; |
1477 uint8_t* buffer; | 1483 uint8_t* buffer; |
1478 intptr_t size; | 1484 intptr_t size; |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3001 StackZone zone(Thread::Current()); | 3007 StackZone zone(Thread::Current()); |
3002 uint8_t* buffer; | 3008 uint8_t* buffer; |
3003 MessageWriter writer(&buffer, &zone_allocator, true); | 3009 MessageWriter writer(&buffer, &zone_allocator, true); |
3004 writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3010 writer.WriteInlinedObjectHeader(kOmittedObjectId); |
3005 // For performance, we'd like single-byte headers when ids are omitted. | 3011 // For performance, we'd like single-byte headers when ids are omitted. |
3006 // If this starts failing, consider renumbering the snapshot ids. | 3012 // If this starts failing, consider renumbering the snapshot ids. |
3007 EXPECT_EQ(1, writer.BytesWritten()); | 3013 EXPECT_EQ(1, writer.BytesWritten()); |
3008 } | 3014 } |
3009 | 3015 |
3010 } // namespace dart | 3016 } // namespace dart |
OLD | NEW |