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

Side by Side Diff: vm/snapshot_test.cc

Issue 12036098: First set of changes towards cleaning up the bytearray access APIs (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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 | « vm/object.cc ('k') | no next file » | 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_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 EXPECT_VALID(surrogates_string_result); 1377 EXPECT_VALID(surrogates_string_result);
1378 EXPECT(Dart_IsString(surrogates_string_result)); 1378 EXPECT(Dart_IsString(surrogates_string_result));
1379 1379
1380 Dart_Handle crappy_string_result; 1380 Dart_Handle crappy_string_result;
1381 crappy_string_result = 1381 crappy_string_result =
1382 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL); 1382 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL);
1383 EXPECT_VALID(crappy_string_result); 1383 EXPECT_VALID(crappy_string_result);
1384 EXPECT(Dart_IsString(crappy_string_result)); 1384 EXPECT(Dart_IsString(crappy_string_result));
1385 1385
1386 { 1386 {
1387 DARTSCOPE_NOCHECKS(isolate); 1387 DARTSCOPE(isolate);
1388 1388
1389 { 1389 {
1390 StackZone zone(Isolate::Current()); 1390 StackZone zone(Isolate::Current());
1391 uint8_t* buffer; 1391 uint8_t* buffer;
1392 MessageWriter writer(&buffer, &zone_allocator); 1392 MessageWriter writer(&buffer, &zone_allocator);
1393 Smi& smi = Smi::Handle(); 1393 Smi& smi = Smi::Handle();
1394 smi ^= Api::UnwrapHandle(smi_result); 1394 smi ^= Api::UnwrapHandle(smi_result);
1395 writer.WriteMessage(smi); 1395 writer.WriteMessage(smi);
1396 intptr_t buffer_len = writer.BytesWritten(); 1396 intptr_t buffer_len = writer.BytesWritten();
1397 1397
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1468
1469 TestCase::CreateTestIsolate(); 1469 TestCase::CreateTestIsolate();
1470 Isolate* isolate = Isolate::Current(); 1470 Isolate* isolate = Isolate::Current();
1471 EXPECT(isolate != NULL); 1471 EXPECT(isolate != NULL);
1472 Dart_EnterScope(); 1472 Dart_EnterScope();
1473 1473
1474 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1474 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1475 EXPECT_VALID(lib); 1475 EXPECT_VALID(lib);
1476 1476
1477 { 1477 {
1478 DARTSCOPE_NOCHECKS(isolate); 1478 DARTSCOPE(isolate);
1479 { 1479 {
1480 // Generate a list of nulls from Dart code. 1480 // Generate a list of nulls from Dart code.
1481 ApiNativeScope scope; 1481 ApiNativeScope scope;
1482 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); 1482 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList");
1483 EXPECT_NOTNULL(root); 1483 EXPECT_NOTNULL(root);
1484 EXPECT_EQ(Dart_CObject::kArray, root->type); 1484 EXPECT_EQ(Dart_CObject::kArray, root->type);
1485 EXPECT_EQ(kArrayLength, root->value.as_array.length); 1485 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1486 for (int i = 0; i < kArrayLength; i++) { 1486 for (int i = 0; i < kArrayLength; i++) {
1487 EXPECT_EQ(Dart_CObject::kNull, root->value.as_array.values[i]->type); 1487 EXPECT_EQ(Dart_CObject::kNull, root->value.as_array.values[i]->type);
1488 } 1488 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 1586
1587 TestCase::CreateTestIsolate(); 1587 TestCase::CreateTestIsolate();
1588 Isolate* isolate = Isolate::Current(); 1588 Isolate* isolate = Isolate::Current();
1589 EXPECT(isolate != NULL); 1589 EXPECT(isolate != NULL);
1590 Dart_EnterScope(); 1590 Dart_EnterScope();
1591 1591
1592 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1592 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1593 EXPECT_VALID(lib); 1593 EXPECT_VALID(lib);
1594 1594
1595 { 1595 {
1596 DARTSCOPE_NOCHECKS(isolate); 1596 DARTSCOPE(isolate);
1597 { 1597 {
1598 // Generate a list of nulls from Dart code. 1598 // Generate a list of nulls from Dart code.
1599 ApiNativeScope scope; 1599 ApiNativeScope scope;
1600 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); 1600 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList");
1601 EXPECT_NOTNULL(root); 1601 EXPECT_NOTNULL(root);
1602 EXPECT_EQ(Dart_CObject::kArray, root->type); 1602 EXPECT_EQ(Dart_CObject::kArray, root->type);
1603 EXPECT_EQ(kArrayLength, root->value.as_array.length); 1603 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1604 for (int i = 0; i < kArrayLength; i++) { 1604 for (int i = 0; i < kArrayLength; i++) {
1605 EXPECT_EQ(Dart_CObject::kNull, root->value.as_array.values[i]->type); 1605 EXPECT_EQ(Dart_CObject::kNull, root->value.as_array.values[i]->type);
1606 } 1606 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 1809
1810 TestCase::CreateTestIsolate(); 1810 TestCase::CreateTestIsolate();
1811 Isolate* isolate = Isolate::Current(); 1811 Isolate* isolate = Isolate::Current();
1812 EXPECT(isolate != NULL); 1812 EXPECT(isolate != NULL);
1813 Dart_EnterScope(); 1813 Dart_EnterScope();
1814 1814
1815 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1815 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1816 EXPECT_VALID(lib); 1816 EXPECT_VALID(lib);
1817 1817
1818 { 1818 {
1819 DARTSCOPE_NOCHECKS(isolate); 1819 DARTSCOPE(isolate);
1820 1820
1821 { 1821 {
1822 // Generate a list of strings from Dart code. 1822 // Generate a list of strings from Dart code.
1823 ApiNativeScope scope; 1823 ApiNativeScope scope;
1824 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); 1824 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList");
1825 EXPECT_NOTNULL(root); 1825 EXPECT_NOTNULL(root);
1826 EXPECT_EQ(Dart_CObject::kArray, root->type); 1826 EXPECT_EQ(Dart_CObject::kArray, root->type);
1827 EXPECT_EQ(kArrayLength, root->value.as_array.length); 1827 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1828 for (int i = 0; i < kArrayLength; i++) { 1828 for (int i = 0; i < kArrayLength; i++) {
1829 Dart_CObject* element = root->value.as_array.values[i]; 1829 Dart_CObject* element = root->value.as_array.values[i];
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 1984
1985 TestCase::CreateTestIsolate(); 1985 TestCase::CreateTestIsolate();
1986 Isolate* isolate = Isolate::Current(); 1986 Isolate* isolate = Isolate::Current();
1987 EXPECT(isolate != NULL); 1987 EXPECT(isolate != NULL);
1988 Dart_EnterScope(); 1988 Dart_EnterScope();
1989 1989
1990 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1990 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1991 EXPECT_VALID(lib); 1991 EXPECT_VALID(lib);
1992 1992
1993 { 1993 {
1994 DARTSCOPE_NOCHECKS(isolate); 1994 DARTSCOPE(isolate);
1995 1995
1996 { 1996 {
1997 // Generate a list of strings from Dart code. 1997 // Generate a list of strings from Dart code.
1998 ApiNativeScope scope; 1998 ApiNativeScope scope;
1999 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); 1999 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList");
2000 EXPECT_NOTNULL(root); 2000 EXPECT_NOTNULL(root);
2001 EXPECT_EQ(Dart_CObject::kArray, root->type); 2001 EXPECT_EQ(Dart_CObject::kArray, root->type);
2002 EXPECT_EQ(kArrayLength, root->value.as_array.length); 2002 EXPECT_EQ(kArrayLength, root->value.as_array.length);
2003 for (int i = 0; i < kArrayLength; i++) { 2003 for (int i = 0; i < kArrayLength; i++) {
2004 Dart_CObject* element = root->value.as_array.values[i]; 2004 Dart_CObject* element = root->value.as_array.values[i];
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 EXPECT(Dart_ErrorHasException(result)); 2196 EXPECT(Dart_ErrorHasException(result));
2197 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2197 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2198 Dart_GetError(result)); 2198 Dart_GetError(result));
2199 2199
2200 Dart_ExitScope(); 2200 Dart_ExitScope();
2201 } 2201 }
2202 2202
2203 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2203 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2204 2204
2205 } // namespace dart 2205 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698