| OLD | NEW |
| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 object_store->set_uint32x4_type(type); | 1073 object_store->set_uint32x4_type(type); |
| 1074 | 1074 |
| 1075 object_store->set_typed_data_classes(typed_data_classes); | 1075 object_store->set_typed_data_classes(typed_data_classes); |
| 1076 | 1076 |
| 1077 // Set the super type of class Stacktrace to Object type so that the | 1077 // Set the super type of class Stacktrace to Object type so that the |
| 1078 // 'toString' method is implemented. | 1078 // 'toString' method is implemented. |
| 1079 cls = object_store->stacktrace_class(); | 1079 cls = object_store->stacktrace_class(); |
| 1080 type = object_store->object_type(); | 1080 type = object_store->object_type(); |
| 1081 cls.set_super_type(type); | 1081 cls.set_super_type(type); |
| 1082 | 1082 |
| 1083 // Note: The abstract class Function is represented by VM class | 1083 // Abstract class that represents the Dart class Function. |
| 1084 // DartFunction, not VM class Function. | 1084 cls = Class::New<Instance>(kIllegalCid); |
| 1085 cls = Class::New<DartFunction>(); | 1085 cls.set_is_prefinalized(); |
| 1086 RegisterClass(cls, Symbols::Function(), core_lib); | 1086 RegisterClass(cls, Symbols::Function(), core_lib); |
| 1087 pending_classes.Add(cls, Heap::kOld); | 1087 pending_classes.Add(cls, Heap::kOld); |
| 1088 type = Type::NewNonParameterizedType(cls); | 1088 type = Type::NewNonParameterizedType(cls); |
| 1089 object_store->set_function_type(type); | 1089 object_store->set_function_type(type); |
| 1090 | 1090 |
| 1091 cls = Class::New<Number>(); | 1091 cls = Class::New<Number>(); |
| 1092 RegisterClass(cls, Symbols::Number(), core_lib); | 1092 RegisterClass(cls, Symbols::Number(), core_lib); |
| 1093 pending_classes.Add(cls, Heap::kOld); | 1093 pending_classes.Add(cls, Heap::kOld); |
| 1094 type = Type::NewNonParameterizedType(cls); | 1094 type = Type::NewNonParameterizedType(cls); |
| 1095 object_store->set_number_type(type); | 1095 object_store->set_number_type(type); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1248 |
| 1249 cls = Class::New<Stacktrace>(); | 1249 cls = Class::New<Stacktrace>(); |
| 1250 object_store->set_stacktrace_class(cls); | 1250 object_store->set_stacktrace_class(cls); |
| 1251 | 1251 |
| 1252 cls = Class::New<JSRegExp>(); | 1252 cls = Class::New<JSRegExp>(); |
| 1253 object_store->set_jsregexp_class(cls); | 1253 object_store->set_jsregexp_class(cls); |
| 1254 | 1254 |
| 1255 // Some classes are not stored in the object store. Yet we still need to | 1255 // Some classes are not stored in the object store. Yet we still need to |
| 1256 // create their Class object so that they get put into the class_table | 1256 // create their Class object so that they get put into the class_table |
| 1257 // (as a side effect of Class::New()). | 1257 // (as a side effect of Class::New()). |
| 1258 cls = Class::New<DartFunction>(); | |
| 1259 cls = Class::New<Number>(); | 1258 cls = Class::New<Number>(); |
| 1260 | 1259 |
| 1261 cls = Class::New<WeakProperty>(); | 1260 cls = Class::New<WeakProperty>(); |
| 1262 object_store->set_weak_property_class(cls); | 1261 object_store->set_weak_property_class(cls); |
| 1263 | 1262 |
| 1264 cls = Class::New<MirrorReference>(); | 1263 cls = Class::New<MirrorReference>(); |
| 1265 object_store->set_mirror_reference_class(cls); | 1264 object_store->set_mirror_reference_class(cls); |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 | 1267 |
| (...skipping 12915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14184 RawObject* raw = Object::Allocate(cls.id(), Closure::InstanceSize(), space); | 14183 RawObject* raw = Object::Allocate(cls.id(), Closure::InstanceSize(), space); |
| 14185 NoGCScope no_gc; | 14184 NoGCScope no_gc; |
| 14186 result ^= raw; | 14185 result ^= raw; |
| 14187 } | 14186 } |
| 14188 Closure::set_function(result, function); | 14187 Closure::set_function(result, function); |
| 14189 Closure::set_context(result, context); | 14188 Closure::set_context(result, context); |
| 14190 return result.raw(); | 14189 return result.raw(); |
| 14191 } | 14190 } |
| 14192 | 14191 |
| 14193 | 14192 |
| 14194 const char* DartFunction::ToCString() const { | |
| 14195 return "Function type class"; | |
| 14196 } | |
| 14197 | |
| 14198 | |
| 14199 void DartFunction::PrintToJSONStream(JSONStream* stream, bool ref) const { | |
| 14200 stream->OpenObject(); | |
| 14201 stream->CloseObject(); | |
| 14202 } | |
| 14203 | |
| 14204 | |
| 14205 intptr_t Stacktrace::Length() const { | 14193 intptr_t Stacktrace::Length() const { |
| 14206 const Array& code_array = Array::Handle(raw_ptr()->code_array_); | 14194 const Array& code_array = Array::Handle(raw_ptr()->code_array_); |
| 14207 return code_array.Length(); | 14195 return code_array.Length(); |
| 14208 } | 14196 } |
| 14209 | 14197 |
| 14210 | 14198 |
| 14211 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { | 14199 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { |
| 14212 const Array& function_array = Array::Handle(raw_ptr()->function_array_); | 14200 const Array& function_array = Array::Handle(raw_ptr()->function_array_); |
| 14213 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); | 14201 return reinterpret_cast<RawFunction*>(function_array.At(frame_index)); |
| 14214 } | 14202 } |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14624 } | 14612 } |
| 14625 | 14613 |
| 14626 | 14614 |
| 14627 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14615 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14628 stream->OpenObject(); | 14616 stream->OpenObject(); |
| 14629 stream->CloseObject(); | 14617 stream->CloseObject(); |
| 14630 } | 14618 } |
| 14631 | 14619 |
| 14632 | 14620 |
| 14633 } // namespace dart | 14621 } // namespace dart |
| OLD | NEW |