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 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 { | 1530 { |
1531 // Now Create an Isolate using the full snapshot and load the | 1531 // Now Create an Isolate using the full snapshot and load the |
1532 // script snapshot created above and execute it. | 1532 // script snapshot created above and execute it. |
1533 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); | 1533 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); |
1534 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. | 1534 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. |
1535 | 1535 |
1536 // Load the test library from the snapshot. | 1536 // Load the test library from the snapshot. |
1537 EXPECT(script_snapshot != NULL); | 1537 EXPECT(script_snapshot != NULL); |
1538 result = Dart_LoadScriptFromSnapshot(script_snapshot, size); | 1538 result = Dart_LoadScriptFromSnapshot(script_snapshot, size); |
1539 EXPECT_VALID(result); | 1539 EXPECT_VALID(result); |
| 1540 Dart_ExitScope(); |
1540 } | 1541 } |
1541 | 1542 |
1542 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode; | 1543 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode; |
1543 Dart_ShutdownIsolate(); | 1544 Dart_ShutdownIsolate(); |
1544 free(full_snapshot); | 1545 free(full_snapshot); |
1545 free(script_snapshot); | 1546 free(script_snapshot); |
1546 } | 1547 } |
1547 | 1548 |
1548 | 1549 |
1549 UNIT_TEST_CASE(ScriptSnapshot2) { | 1550 UNIT_TEST_CASE(ScriptSnapshot2) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 result = Dart_Invoke(lib, NewString("test_s"), 0, NULL); | 1651 result = Dart_Invoke(lib, NewString("test_s"), 0, NULL); |
1651 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); | 1652 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); |
1652 | 1653 |
1653 // Invoke the test_i function. | 1654 // Invoke the test_i function. |
1654 result = Dart_Invoke(lib, NewString("test_i"), 0, NULL); | 1655 result = Dart_Invoke(lib, NewString("test_i"), 0, NULL); |
1655 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); | 1656 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); |
1656 | 1657 |
1657 // Invoke the test_b function. | 1658 // Invoke the test_b function. |
1658 result = Dart_Invoke(lib, NewString("test_b"), 0, NULL); | 1659 result = Dart_Invoke(lib, NewString("test_b"), 0, NULL); |
1659 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); | 1660 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); |
| 1661 Dart_ExitScope(); |
1660 } | 1662 } |
1661 Dart_ShutdownIsolate(); | 1663 Dart_ShutdownIsolate(); |
1662 free(full_snapshot); | 1664 free(full_snapshot); |
1663 free(script_snapshot); | 1665 free(script_snapshot); |
1664 } | 1666 } |
1665 | 1667 |
1666 | 1668 |
1667 TEST_CASE(IntArrayMessage) { | 1669 TEST_CASE(IntArrayMessage) { |
1668 StackZone zone(Thread::Current()); | 1670 StackZone zone(Thread::Current()); |
1669 uint8_t* buffer = NULL; | 1671 uint8_t* buffer = NULL; |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3007 StackZone zone(Thread::Current()); | 3009 StackZone zone(Thread::Current()); |
3008 uint8_t* buffer; | 3010 uint8_t* buffer; |
3009 MessageWriter writer(&buffer, &zone_allocator, true); | 3011 MessageWriter writer(&buffer, &zone_allocator, true); |
3010 writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3012 writer.WriteInlinedObjectHeader(kOmittedObjectId); |
3011 // For performance, we'd like single-byte headers when ids are omitted. | 3013 // For performance, we'd like single-byte headers when ids are omitted. |
3012 // If this starts failing, consider renumbering the snapshot ids. | 3014 // If this starts failing, consider renumbering the snapshot ids. |
3013 EXPECT_EQ(1, writer.BytesWritten()); | 3015 EXPECT_EQ(1, writer.BytesWritten()); |
3014 } | 3016 } |
3015 | 3017 |
3016 } // namespace dart | 3018 } // namespace dart |
OLD | NEW |