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

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

Issue 22425006: Fix equality of implicit closures in the Dart VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: added missing file Created 7 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 | 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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 cls = Class::New<Bigint>(); 972 cls = Class::New<Bigint>();
973 object_store->set_bigint_class(cls); 973 object_store->set_bigint_class(cls);
974 RegisterPrivateClass(cls, Symbols::_Bigint(), core_lib); 974 RegisterPrivateClass(cls, Symbols::_Bigint(), core_lib);
975 pending_classes.Add(cls, Heap::kOld); 975 pending_classes.Add(cls, Heap::kOld);
976 976
977 cls = Class::New<Double>(); 977 cls = Class::New<Double>();
978 object_store->set_double_class(cls); 978 object_store->set_double_class(cls);
979 RegisterPrivateClass(cls, Symbols::_Double(), core_lib); 979 RegisterPrivateClass(cls, Symbols::_Double(), core_lib);
980 pending_classes.Add(cls, Heap::kOld); 980 pending_classes.Add(cls, Heap::kOld);
981 981
982 // Abstract super class for all signature classes.
983 cls = Class::New<Instance>(kIllegalCid);
984 cls.set_is_prefinalized();
985 RegisterPrivateClass(cls, Symbols::DartFunctionImpl(), core_lib);
986 pending_classes.Add(cls, Heap::kOld);
987 type = Type::NewNonParameterizedType(cls);
988 object_store->set_dart_function_impl_type(type);
989
982 cls = Class::New<WeakProperty>(); 990 cls = Class::New<WeakProperty>();
983 object_store->set_weak_property_class(cls); 991 object_store->set_weak_property_class(cls);
984 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); 992 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
985 993
986 // Pre-register the mirrors library so we can place the vm class 994 // Pre-register the mirrors library so we can place the vm class
987 // MirrorReference there rather than the core library. 995 // MirrorReference there rather than the core library.
988 lib = Library::LookupLibrary(Symbols::DartMirrors()); 996 lib = Library::LookupLibrary(Symbols::DartMirrors());
989 if (lib.IsNull()) { 997 if (lib.IsNull()) {
990 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true); 998 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true);
991 lib.Register(); 999 lib.Register();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1111
1104 cls = Class::New<Instance>(kIllegalCid); 1112 cls = Class::New<Instance>(kIllegalCid);
1105 RegisterClass(cls, Symbols::Double(), core_lib); 1113 RegisterClass(cls, Symbols::Double(), core_lib);
1106 cls.set_is_prefinalized(); 1114 cls.set_is_prefinalized();
1107 pending_classes.Add(cls, Heap::kOld); 1115 pending_classes.Add(cls, Heap::kOld);
1108 type = Type::NewNonParameterizedType(cls); 1116 type = Type::NewNonParameterizedType(cls);
1109 object_store->set_double_type(type); 1117 object_store->set_double_type(type);
1110 1118
1111 name = Symbols::New("String"); 1119 name = Symbols::New("String");
1112 cls = Class::New<Instance>(kIllegalCid); 1120 cls = Class::New<Instance>(kIllegalCid);
1113 cls.set_is_prefinalized();
1114 RegisterClass(cls, name, core_lib); 1121 RegisterClass(cls, name, core_lib);
1115 cls.set_is_prefinalized(); 1122 cls.set_is_prefinalized();
1116 pending_classes.Add(cls, Heap::kOld); 1123 pending_classes.Add(cls, Heap::kOld);
1117 type = Type::NewNonParameterizedType(cls); 1124 type = Type::NewNonParameterizedType(cls);
1118 object_store->set_string_type(type); 1125 object_store->set_string_type(type);
1119 1126
1120 cls = object_store->bool_class(); 1127 cls = object_store->bool_class();
1121 type = Type::NewNonParameterizedType(cls); 1128 type = Type::NewNonParameterizedType(cls);
1122 object_store->set_bool_type(type); 1129 object_store->set_bool_type(type);
1123 1130
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 false, // Not const. 1881 false, // Not const.
1875 false, // Not abstract. 1882 false, // Not abstract.
1876 false, // Not external. 1883 false, // Not external.
1877 *this, 1884 *this,
1878 0)); // No token position. 1885 0)); // No token position.
1879 ArgumentsDescriptor desc(args_desc); 1886 ArgumentsDescriptor desc(args_desc);
1880 invocation.set_num_fixed_parameters(desc.PositionalCount()); 1887 invocation.set_num_fixed_parameters(desc.PositionalCount());
1881 invocation.SetNumOptionalParameters(desc.NamedCount(), 1888 invocation.SetNumOptionalParameters(desc.NamedCount(),
1882 false); // Not positional. 1889 false); // Not positional.
1883 invocation.set_parameter_types(Array::Handle(Array::New(desc.Count(), 1890 invocation.set_parameter_types(Array::Handle(Array::New(desc.Count(),
1884 Heap::kOld))); 1891 Heap::kOld)));
1885 invocation.set_parameter_names(Array::Handle(Array::New(desc.Count(), 1892 invocation.set_parameter_names(Array::Handle(Array::New(desc.Count(),
1886 Heap::kOld))); 1893 Heap::kOld)));
1887 // Receiver. 1894 // Receiver.
1888 invocation.SetParameterTypeAt(0, Type::Handle(Type::DynamicType())); 1895 invocation.SetParameterTypeAt(0, Type::Handle(Type::DynamicType()));
1889 invocation.SetParameterNameAt(0, Symbols::This()); 1896 invocation.SetParameterNameAt(0, Symbols::This());
1890 // Remaining positional parameters. 1897 // Remaining positional parameters.
1891 intptr_t i = 1; 1898 intptr_t i = 1;
1892 for (; i < desc.PositionalCount(); i++) { 1899 for (; i < desc.PositionalCount(); i++) {
1893 invocation.SetParameterTypeAt(i, Type::Handle(Type::DynamicType())); 1900 invocation.SetParameterTypeAt(i, Type::Handle(Type::DynamicType()));
1894 char name[64]; 1901 char name[64];
1895 OS::SNPrint(name, 64, ":p%"Pd, i); 1902 OS::SNPrint(name, 64, ":p%"Pd, i);
1896 invocation.SetParameterNameAt(i, String::Handle(Symbols::New(name))); 1903 invocation.SetParameterNameAt(i, String::Handle(Symbols::New(name)));
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 result.set_token_pos(token_pos); 2129 result.set_token_pos(token_pos);
2123 return result.raw(); 2130 return result.raw();
2124 } 2131 }
2125 2132
2126 2133
2127 RawClass* Class::NewSignatureClass(const String& name, 2134 RawClass* Class::NewSignatureClass(const String& name,
2128 const Function& signature_function, 2135 const Function& signature_function,
2129 const Script& script, 2136 const Script& script,
2130 intptr_t token_pos) { 2137 intptr_t token_pos) {
2131 const Class& result = Class::Handle(New(name, script, token_pos)); 2138 const Class& result = Class::Handle(New(name, script, token_pos));
2132 const Type& super_type = Type::Handle(Type::ObjectType());
2133 ASSERT(!super_type.IsNull());
2134 // Instances of a signature class can only be closures. 2139 // Instances of a signature class can only be closures.
2135 result.set_instance_size(Closure::InstanceSize()); 2140 result.set_instance_size(Closure::InstanceSize());
2136 result.set_next_field_offset(Closure::InstanceSize()); 2141 result.set_next_field_offset(Closure::InstanceSize());
2137 result.set_super_type(super_type); 2142 // Signature classes extend the _FunctionImpl class.
2143 result.set_super_type(Type::Handle(
2144 Isolate::Current()->object_store()->dart_function_impl_type()));
2138 result.set_is_synthesized_class(); 2145 result.set_is_synthesized_class();
2139 result.set_type_arguments_field_offset(Closure::type_arguments_offset()); 2146 result.set_type_arguments_field_offset(Closure::type_arguments_offset());
2140 // Implements interface "Function". 2147 // Implements interface "Function".
2141 const Type& function_type = Type::Handle(Type::Function()); 2148 const Type& function_type = Type::Handle(Type::Function());
2142 const Array& interfaces = Array::Handle(Array::New(1, Heap::kOld)); 2149 const Array& interfaces = Array::Handle(Array::New(1, Heap::kOld));
2143 interfaces.SetAt(0, function_type); 2150 interfaces.SetAt(0, function_type);
2144 result.set_interfaces(interfaces); 2151 result.set_interfaces(interfaces);
2145 if (!signature_function.IsNull()) { 2152 if (!signature_function.IsNull()) {
2146 result.PatchSignatureFunction(signature_function); 2153 result.PatchSignatureFunction(signature_function);
2147 } 2154 }
(...skipping 12464 matching lines...) Expand 10 before | Expand all | Expand 10 after
14612 } 14619 }
14613 14620
14614 14621
14615 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14622 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14616 stream->OpenObject(); 14623 stream->OpenObject();
14617 stream->CloseObject(); 14624 stream->CloseObject();
14618 } 14625 }
14619 14626
14620 14627
14621 } // namespace dart 14628 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698