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

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

Issue 11415048: Deserialize same symbol as same Dart_CObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 " var byte_array = new Uint8List(256);\n" 1904 " var byte_array = new Uint8List(256);\n"
1905 " var list = [];\n" 1905 " var list = [];\n"
1906 " for (var i = 0; i < kArrayLength; i++) {\n" 1906 " for (var i = 0; i < kArrayLength; i++) {\n"
1907 " list.add(byte_array);\n" 1907 " list.add(byte_array);\n"
1908 " }\n" 1908 " }\n"
1909 " return list;\n" 1909 " return list;\n"
1910 "}\n" 1910 "}\n"
1911 "getMixedList() {\n" 1911 "getMixedList() {\n"
1912 " var list = [];\n" 1912 " var list = [];\n"
1913 " for (var i = 0; i < kArrayLength; i++) {\n" 1913 " for (var i = 0; i < kArrayLength; i++) {\n"
1914 " list.add(((i % 2) == 0) ? 'A' : 2.72);\n" 1914 " list.add(((i % 2) == 0) ? '.' : 2.72);\n"
1915 " }\n" 1915 " }\n"
1916 " return list;\n" 1916 " return list;\n"
1917 "}\n" 1917 "}\n"
1918 "getSelfRefList() {\n" 1918 "getSelfRefList() {\n"
1919 " var list = [];\n" 1919 " var list = [];\n"
1920 " for (var i = 0; i < kArrayLength; i++) {\n" 1920 " for (var i = 0; i < kArrayLength; i++) {\n"
1921 " list.add(list);\n" 1921 " list.add(list);\n"
1922 " }\n" 1922 " }\n"
1923 " return list;\n" 1923 " return list;\n"
1924 "}\n"; 1924 "}\n";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 ApiNativeScope scope; 2010 ApiNativeScope scope;
2011 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList"); 2011 Dart_CObject* root = GetDeserializedDartMessage(lib, "getMixedList");
2012 EXPECT_NOTNULL(root); 2012 EXPECT_NOTNULL(root);
2013 EXPECT_EQ(Dart_CObject::kArray, root->type); 2013 EXPECT_EQ(Dart_CObject::kArray, root->type);
2014 EXPECT_EQ(kArrayLength, root->value.as_array.length); 2014 EXPECT_EQ(kArrayLength, root->value.as_array.length);
2015 for (int i = 0; i < kArrayLength; i++) { 2015 for (int i = 0; i < kArrayLength; i++) {
2016 Dart_CObject* element = root->value.as_array.values[i]; 2016 Dart_CObject* element = root->value.as_array.values[i];
2017 if ((i % 2) == 0) { 2017 if ((i % 2) == 0) {
2018 EXPECT_EQ(root->value.as_array.values[0], element); 2018 EXPECT_EQ(root->value.as_array.values[0], element);
2019 EXPECT_EQ(Dart_CObject::kString, element->type); 2019 EXPECT_EQ(Dart_CObject::kString, element->type);
2020 EXPECT_STREQ("A", element->value.as_string); 2020 EXPECT_STREQ(".", element->value.as_string);
2021 } else { 2021 } else {
2022 EXPECT_EQ(root->value.as_array.values[1], element); 2022 EXPECT_EQ(root->value.as_array.values[1], element);
2023 EXPECT_EQ(Dart_CObject::kDouble, element->type); 2023 EXPECT_EQ(Dart_CObject::kDouble, element->type);
2024 EXPECT_STREQ(2.72, element->value.as_double); 2024 EXPECT_STREQ(2.72, element->value.as_double);
2025 } 2025 }
2026 } 2026 }
2027 } 2027 }
2028 { 2028 {
2029 // Generate a list of objects of different types from Dart code. 2029 // Generate a list of objects of different types from Dart code.
2030 ApiNativeScope scope; 2030 ApiNativeScope scope;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 EXPECT(Dart_ErrorHasException(result)); 2144 EXPECT(Dart_ErrorHasException(result));
2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2145 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2146 Dart_GetError(result)); 2146 Dart_GetError(result));
2147 2147
2148 Dart_ExitScope(); 2148 Dart_ExitScope();
2149 } 2149 }
2150 2150
2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2152 2152
2153 } // namespace dart 2153 } // namespace dart
OLDNEW
« runtime/vm/dart_api_message.cc ('K') | « runtime/vm/dart_api_message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698