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

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

Issue 1309613002: Avoid numerous type allocations by caching the canonical type of a class, which (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')
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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_mirrors_api.h" 7 #include "include/dart_mirrors_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "include/dart_tools_api.h" 9 #include "include/dart_tools_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 3962 matching lines...) Expand 10 before | Expand all | Expand 10 after
3973 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type3, &instanceof)); 3973 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type3, &instanceof));
3974 EXPECT(instanceof); 3974 EXPECT(instanceof);
3975 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type4, &instanceof)); 3975 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type4, &instanceof));
3976 EXPECT(instanceof); 3976 EXPECT(instanceof);
3977 type2_obj = Dart_Invoke(lib, NewString("getMyClass2Type"), 0, NULL); 3977 type2_obj = Dart_Invoke(lib, NewString("getMyClass2Type"), 0, NULL);
3978 EXPECT_VALID(type2_obj); 3978 EXPECT_VALID(type2_obj);
3979 EXPECT(Dart_IdentityEquals(type2, type2_obj)); 3979 EXPECT(Dart_IdentityEquals(type2, type2_obj));
3980 } 3980 }
3981 3981
3982 3982
3983 TEST_CASE(TypeGetParamterizedTypes) { 3983 TEST_CASE(TypeGetParameterizedTypes) {
3984 const char* kScriptChars = 3984 const char* kScriptChars =
3985 "class MyClass0<A, B> {\n" 3985 "class MyClass0<A, B> {\n"
3986 "}\n" 3986 "}\n"
3987 "\n" 3987 "\n"
3988 "class MyClass1<A, C> {\n" 3988 "class MyClass1<A, C> {\n"
3989 "}\n" 3989 "}\n"
3990 "MyClass0 getMyClass0() {\n" 3990 "MyClass0 getMyClass0() {\n"
3991 " return new MyClass0<int, double>();\n" 3991 " return new MyClass0<int, double>();\n"
3992 "}\n" 3992 "}\n"
3993 "Type getMyClass0Type() {\n" 3993 "Type getMyClass0Type() {\n"
(...skipping 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after
9415 // Heartbeat test. 9415 // Heartbeat test.
9416 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer); 9416 EXPECT_SUBSTRING("\"cat\":\"Compiler\"", buffer);
9417 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer); 9417 EXPECT_SUBSTRING("\"name\":\"CompileFunction\"", buffer);
9418 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer); 9418 EXPECT_SUBSTRING("\"function\":\"::_main\"", buffer);
9419 9419
9420 // Free buffer allocated by AppendStreamConsumer 9420 // Free buffer allocated by AppendStreamConsumer
9421 free(data.buffer); 9421 free(data.buffer);
9422 } 9422 }
9423 9423
9424 } // namespace dart 9424 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698