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

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

Issue 137483010: Add more timing information in the VM to track time spent is dart code Vs native code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
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 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 EXPECT_VALID(surrogates_string_result); 1591 EXPECT_VALID(surrogates_string_result);
1592 EXPECT(Dart_IsString(surrogates_string_result)); 1592 EXPECT(Dart_IsString(surrogates_string_result));
1593 1593
1594 Dart_Handle crappy_string_result; 1594 Dart_Handle crappy_string_result;
1595 crappy_string_result = 1595 crappy_string_result =
1596 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL); 1596 Dart_Invoke(lib, NewString("getCrappyString"), 0, NULL);
1597 EXPECT_VALID(crappy_string_result); 1597 EXPECT_VALID(crappy_string_result);
1598 EXPECT(Dart_IsString(crappy_string_result)); 1598 EXPECT(Dart_IsString(crappy_string_result));
1599 1599
1600 { 1600 {
1601 DARTSCOPE(isolate); 1601 HANDLESCOPE(isolate);
1602 1602
1603 { 1603 {
1604 StackZone zone(Isolate::Current()); 1604 StackZone zone(Isolate::Current());
1605 uint8_t* buffer; 1605 uint8_t* buffer;
1606 MessageWriter writer(&buffer, &zone_allocator); 1606 MessageWriter writer(&buffer, &zone_allocator);
1607 Smi& smi = Smi::Handle(); 1607 Smi& smi = Smi::Handle();
1608 smi ^= Api::UnwrapHandle(smi_result); 1608 smi ^= Api::UnwrapHandle(smi_result);
1609 writer.WriteMessage(smi); 1609 writer.WriteMessage(smi);
1610 intptr_t buffer_len = writer.BytesWritten(); 1610 intptr_t buffer_len = writer.BytesWritten();
1611 1611
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 1682
1683 TestCase::CreateTestIsolate(); 1683 TestCase::CreateTestIsolate();
1684 Isolate* isolate = Isolate::Current(); 1684 Isolate* isolate = Isolate::Current();
1685 EXPECT(isolate != NULL); 1685 EXPECT(isolate != NULL);
1686 Dart_EnterScope(); 1686 Dart_EnterScope();
1687 1687
1688 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1688 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1689 EXPECT_VALID(lib); 1689 EXPECT_VALID(lib);
1690 1690
1691 { 1691 {
1692 DARTSCOPE(isolate); 1692 HANDLESCOPE(isolate);
1693 { 1693 {
1694 // Generate a list of nulls from Dart code. 1694 // Generate a list of nulls from Dart code.
1695 ApiNativeScope scope; 1695 ApiNativeScope scope;
1696 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); 1696 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList");
1697 EXPECT_NOTNULL(root); 1697 EXPECT_NOTNULL(root);
1698 EXPECT_EQ(Dart_CObject_kArray, root->type); 1698 EXPECT_EQ(Dart_CObject_kArray, root->type);
1699 EXPECT_EQ(kArrayLength, root->value.as_array.length); 1699 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1700 for (int i = 0; i < kArrayLength; i++) { 1700 for (int i = 0; i < kArrayLength; i++) {
1701 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); 1701 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
1702 } 1702 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 1800
1801 TestCase::CreateTestIsolate(); 1801 TestCase::CreateTestIsolate();
1802 Isolate* isolate = Isolate::Current(); 1802 Isolate* isolate = Isolate::Current();
1803 EXPECT(isolate != NULL); 1803 EXPECT(isolate != NULL);
1804 Dart_EnterScope(); 1804 Dart_EnterScope();
1805 1805
1806 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1806 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1807 EXPECT_VALID(lib); 1807 EXPECT_VALID(lib);
1808 1808
1809 { 1809 {
1810 DARTSCOPE(isolate); 1810 HANDLESCOPE(isolate);
1811 { 1811 {
1812 // Generate a list of nulls from Dart code. 1812 // Generate a list of nulls from Dart code.
1813 ApiNativeScope scope; 1813 ApiNativeScope scope;
1814 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList"); 1814 Dart_CObject* root = GetDeserializedDartMessage(lib, "getList");
1815 EXPECT_NOTNULL(root); 1815 EXPECT_NOTNULL(root);
1816 EXPECT_EQ(Dart_CObject_kArray, root->type); 1816 EXPECT_EQ(Dart_CObject_kArray, root->type);
1817 EXPECT_EQ(kArrayLength, root->value.as_array.length); 1817 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1818 for (int i = 0; i < kArrayLength; i++) { 1818 for (int i = 0; i < kArrayLength; i++) {
1819 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type); 1819 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
1820 } 1820 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 2032
2033 TestCase::CreateTestIsolate(); 2033 TestCase::CreateTestIsolate();
2034 Isolate* isolate = Isolate::Current(); 2034 Isolate* isolate = Isolate::Current();
2035 EXPECT(isolate != NULL); 2035 EXPECT(isolate != NULL);
2036 Dart_EnterScope(); 2036 Dart_EnterScope();
2037 2037
2038 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 2038 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2039 EXPECT_VALID(lib); 2039 EXPECT_VALID(lib);
2040 2040
2041 { 2041 {
2042 DARTSCOPE(isolate); 2042 HANDLESCOPE(isolate);
2043 2043
2044 { 2044 {
2045 // Generate a list of strings from Dart code. 2045 // Generate a list of strings from Dart code.
2046 ApiNativeScope scope; 2046 ApiNativeScope scope;
2047 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); 2047 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList");
2048 EXPECT_NOTNULL(root); 2048 EXPECT_NOTNULL(root);
2049 EXPECT_EQ(Dart_CObject_kArray, root->type); 2049 EXPECT_EQ(Dart_CObject_kArray, root->type);
2050 EXPECT_EQ(kArrayLength, root->value.as_array.length); 2050 EXPECT_EQ(kArrayLength, root->value.as_array.length);
2051 for (int i = 0; i < kArrayLength; i++) { 2051 for (int i = 0; i < kArrayLength; i++) {
2052 Dart_CObject* element = root->value.as_array.values[i]; 2052 Dart_CObject* element = root->value.as_array.values[i];
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 2237
2238 TestCase::CreateTestIsolate(); 2238 TestCase::CreateTestIsolate();
2239 Isolate* isolate = Isolate::Current(); 2239 Isolate* isolate = Isolate::Current();
2240 EXPECT(isolate != NULL); 2240 EXPECT(isolate != NULL);
2241 Dart_EnterScope(); 2241 Dart_EnterScope();
2242 2242
2243 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 2243 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2244 EXPECT_VALID(lib); 2244 EXPECT_VALID(lib);
2245 2245
2246 { 2246 {
2247 DARTSCOPE(isolate); 2247 HANDLESCOPE(isolate);
2248 { 2248 {
2249 // Generate a list of strings from Dart code. 2249 // Generate a list of strings from Dart code.
2250 ApiNativeScope scope; 2250 ApiNativeScope scope;
2251 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList"); 2251 Dart_CObject* root = GetDeserializedDartMessage(lib, "getStringList");
2252 EXPECT_NOTNULL(root); 2252 EXPECT_NOTNULL(root);
2253 EXPECT_EQ(Dart_CObject_kArray, root->type); 2253 EXPECT_EQ(Dart_CObject_kArray, root->type);
2254 EXPECT_EQ(kArrayLength, root->value.as_array.length); 2254 EXPECT_EQ(kArrayLength, root->value.as_array.length);
2255 for (int i = 0; i < kArrayLength; i++) { 2255 for (int i = 0; i < kArrayLength; i++) {
2256 Dart_CObject* element = root->value.as_array.values[i]; 2256 Dart_CObject* element = root->value.as_array.values[i];
2257 EXPECT_EQ(root->value.as_array.values[0], element); 2257 EXPECT_EQ(root->value.as_array.values[0], element);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 2456
2457 TestCase::CreateTestIsolate(); 2457 TestCase::CreateTestIsolate();
2458 Isolate* isolate = Isolate::Current(); 2458 Isolate* isolate = Isolate::Current();
2459 EXPECT(isolate != NULL); 2459 EXPECT(isolate != NULL);
2460 Dart_EnterScope(); 2460 Dart_EnterScope();
2461 2461
2462 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 2462 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2463 EXPECT_VALID(lib); 2463 EXPECT_VALID(lib);
2464 2464
2465 { 2465 {
2466 DARTSCOPE(isolate); 2466 HANDLESCOPE(isolate);
2467 { 2467 {
2468 // Generate a list of Uint8Lists from Dart code. 2468 // Generate a list of Uint8Lists from Dart code.
2469 ApiNativeScope scope; 2469 ApiNativeScope scope;
2470 Dart_CObject* root = GetDeserializedDartMessage(lib, "getTypedDataList"); 2470 Dart_CObject* root = GetDeserializedDartMessage(lib, "getTypedDataList");
2471 EXPECT_NOTNULL(root); 2471 EXPECT_NOTNULL(root);
2472 EXPECT_EQ(Dart_CObject_kArray, root->type); 2472 EXPECT_EQ(Dart_CObject_kArray, root->type);
2473 struct { 2473 struct {
2474 Dart_TypedData_Type type; 2474 Dart_TypedData_Type type;
2475 int size; 2475 int size;
2476 } expected[] = { 2476 } expected[] = {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 result = Dart_RunLoop(); 2687 result = Dart_RunLoop();
2688 EXPECT(Dart_IsError(result)); 2688 EXPECT(Dart_IsError(result));
2689 EXPECT(Dart_ErrorHasException(result)); 2689 EXPECT(Dart_ErrorHasException(result));
2690 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2690 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2691 Dart_GetError(result)); 2691 Dart_GetError(result));
2692 2692
2693 Dart_ExitScope(); 2693 Dart_ExitScope();
2694 } 2694 }
2695 2695
2696 } // namespace dart 2696 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698