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

Side by Side Diff: vm/object.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « vm/object.h ('k') | vm/parser.cc » ('j') | vm/symbols.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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
11 #include "vm/datastream.h" 11 #include "vm/datastream.h"
12 #include "vm/code_generator.h" 12 #include "vm/code_generator.h"
13 #include "vm/code_patcher.h" 13 #include "vm/code_patcher.h"
14 #include "vm/compiler.h" 14 #include "vm/compiler.h"
15 #include "vm/compiler_stats.h" 15 #include "vm/compiler_stats.h"
16 #include "vm/class_finalizer.h" 16 #include "vm/class_finalizer.h"
17 #include "vm/dart.h" 17 #include "vm/dart.h"
18 #include "vm/dart_api_state.h" 18 #include "vm/dart_api_state.h"
19 #include "vm/dart_entry.h" 19 #include "vm/dart_entry.h"
20 #include "vm/debuginfo.h" 20 #include "vm/debuginfo.h"
21 #include "vm/double_conversion.h" 21 #include "vm/double_conversion.h"
22 #include "vm/exceptions.h" 22 #include "vm/exceptions.h"
23 #include "vm/growable_array.h" 23 #include "vm/growable_array.h"
24 #include "vm/heap.h" 24 #include "vm/heap.h"
25 #include "vm/object_store.h" 25 #include "vm/object_store.h"
26 #include "vm/parser.h" 26 #include "vm/parser.h"
27 #include "vm/runtime_entry.h" 27 #include "vm/runtime_entry.h"
28 #include "vm/scopes.h" 28 #include "vm/scopes.h"
29 #include "vm/stack_frame.h" 29 #include "vm/stack_frame.h"
30 #include "vm/symbols.h"
30 #include "vm/timer.h" 31 #include "vm/timer.h"
31 #include "vm/unicode.h" 32 #include "vm/unicode.h"
32 33
33 namespace dart { 34 namespace dart {
34 35
35 DEFINE_FLAG(bool, generate_gdb_symbols, false, 36 DEFINE_FLAG(bool, generate_gdb_symbols, false,
36 "Generate symbols of generated dart functions for debugging with GDB"); 37 "Generate symbols of generated dart functions for debugging with GDB");
37 DECLARE_FLAG(bool, trace_compiler); 38 DECLARE_FLAG(bool, trace_compiler);
38 DECLARE_FLAG(bool, enable_type_checks); 39 DECLARE_FLAG(bool, enable_type_checks);
39 40
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 null_class_ = cls.raw(); 302 null_class_ = cls.raw();
302 303
303 // Allocate and initialize the free list element class. 304 // Allocate and initialize the free list element class.
304 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement); 305 cls = Class::New<FreeListElement::FakeInstance>(kFreeListElement);
305 cls.set_is_finalized(); 306 cls.set_is_finalized();
306 307
307 // Allocate and initialize the sentinel values of Null class. 308 // Allocate and initialize the sentinel values of Null class.
308 { 309 {
309 cls = null_class_; 310 cls = null_class_;
310 Instance& sentinel = Instance::Handle(); 311 Instance& sentinel = Instance::Handle();
311 sentinel ^= Object::Allocate(cls, Instance::InstanceSize(), Heap::kOld); 312 sentinel ^=
313 Object::Allocate(cls.id(), Instance::InstanceSize(), Heap::kOld);
312 sentinel_ = sentinel.raw(); 314 sentinel_ = sentinel.raw();
313 315
314 Instance& transition_sentinel = Instance::Handle(); 316 Instance& transition_sentinel = Instance::Handle();
315 transition_sentinel ^= 317 transition_sentinel ^=
316 Object::Allocate(cls, Instance::InstanceSize(), Heap::kOld); 318 Object::Allocate(cls.id(), Instance::InstanceSize(), Heap::kOld);
317 transition_sentinel_ = transition_sentinel.raw(); 319 transition_sentinel_ = transition_sentinel.raw();
318 } 320 }
319 321
320 // The interface "Dynamic" is not a VM internal class. It is the type class of 322 // The interface "Dynamic" is not a VM internal class. It is the type class of
321 // the "unknown type". For efficiency, we allocate it in the VM isolate. 323 // the "unknown type". For efficiency, we allocate it in the VM isolate.
322 // Therefore, it cannot have a heap allocated name (the name is hard coded, 324 // Therefore, it cannot have a heap allocated name (the name is hard coded,
323 // see GetSingletonClassIndex) and its array fields cannot be set to the empty 325 // see GetSingletonClassIndex) and its array fields cannot be set to the empty
324 // array, but remain null. 326 // array, but remain null.
325 // 327 //
326 // TODO(turnidge): Once the empty array is allocated in the vm 328 // TODO(turnidge): Once the empty array is allocated in the vm
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 cur += kWordSize; 974 cur += kWordSize;
973 } 975 }
974 uword tags = 0; 976 uword tags = 0;
975 ASSERT(index != kIllegalObjectKind); 977 ASSERT(index != kIllegalObjectKind);
976 tags = RawObject::ClassIdTag::update(index, tags); 978 tags = RawObject::ClassIdTag::update(index, tags);
977 tags = RawObject::SizeTag::update(size, tags); 979 tags = RawObject::SizeTag::update(size, tags);
978 reinterpret_cast<RawObject*>(address)->tags_ = tags; 980 reinterpret_cast<RawObject*>(address)->tags_ = tags;
979 } 981 }
980 982
981 983
982 RawObject* Object::Allocate(const Class& cls, 984 RawObject* Object::Allocate(intptr_t cls_id,
983 intptr_t size, 985 intptr_t size,
984 Heap::Space space) { 986 Heap::Space space) {
985 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 987 ASSERT(Utils::IsAligned(size, kObjectAlignment));
986 Isolate* isolate = Isolate::Current(); 988 Isolate* isolate = Isolate::Current();
987 Heap* heap = isolate->heap(); 989 Heap* heap = isolate->heap();
988 990
989 uword address = heap->Allocate(size, space); 991 uword address = heap->Allocate(size, space);
990 if (address == 0) { 992 if (address == 0) {
991 // Use the preallocated out of memory exception to avoid calling 993 // Use the preallocated out of memory exception to avoid calling
992 // into dart code or allocating any code. 994 // into dart code or allocating any code.
993 const Instance& exception = 995 const Instance& exception =
994 Instance::Handle(isolate->object_store()->out_of_memory()); 996 Instance::Handle(isolate->object_store()->out_of_memory());
995 Exceptions::Throw(exception); 997 Exceptions::Throw(exception);
996 UNREACHABLE(); 998 UNREACHABLE();
997 } 999 }
998 NoGCScope no_gc; 1000 NoGCScope no_gc;
999 InitializeObject(address, cls.id(), size); 1001 InitializeObject(address, cls_id, size);
1000 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag); 1002 RawObject* raw_obj = reinterpret_cast<RawObject*>(address + kHeapObjectTag);
1001 ASSERT(cls.id() == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_)); 1003 ASSERT(cls_id == RawObject::ClassIdTag::decode(raw_obj->ptr()->tags_));
1002 return raw_obj; 1004 return raw_obj;
1003 } 1005 }
1004 1006
1005 1007
1006 class StoreBufferObjectPointerVisitor : public ObjectPointerVisitor { 1008 class StoreBufferObjectPointerVisitor : public ObjectPointerVisitor {
1007 public: 1009 public:
1008 explicit StoreBufferObjectPointerVisitor(Isolate* isolate) : 1010 explicit StoreBufferObjectPointerVisitor(Isolate* isolate) :
1009 ObjectPointerVisitor(isolate) { 1011 ObjectPointerVisitor(isolate) {
1010 } 1012 }
1011 void VisitPointers(RawObject** first, RawObject** last) { 1013 void VisitPointers(RawObject** first, RawObject** last) {
1012 for (RawObject** curr = first; curr <= last; ++curr) { 1014 for (RawObject** curr = first; curr <= last; ++curr) {
1013 if ((*curr)->IsNewObject()) { 1015 if ((*curr)->IsNewObject()) {
1014 uword ptr = reinterpret_cast<uword>(curr); 1016 uword ptr = reinterpret_cast<uword>(curr);
1015 isolate()->store_buffer()->AddPointer(ptr); 1017 isolate()->store_buffer()->AddPointer(ptr);
1016 } 1018 }
1017 } 1019 }
1018 } 1020 }
1019 1021
1020 private: 1022 private:
1021 DISALLOW_COPY_AND_ASSIGN(StoreBufferObjectPointerVisitor); 1023 DISALLOW_COPY_AND_ASSIGN(StoreBufferObjectPointerVisitor);
1022 }; 1024 };
1023 1025
1024 1026
1025 RawObject* Object::Clone(const Object& src, Heap::Space space) { 1027 RawObject* Object::Clone(const Object& src, Heap::Space space) {
1026 const Class& cls = Class::Handle(src.clazz()); 1028 const Class& cls = Class::Handle(src.clazz());
1027 intptr_t size = src.raw()->Size(); 1029 intptr_t size = src.raw()->Size();
1028 RawObject* raw_obj = Object::Allocate(cls, size, space); 1030 RawObject* raw_obj = Object::Allocate(cls.id(), size, space);
1029 NoGCScope no_gc; 1031 NoGCScope no_gc;
1030 memmove(raw_obj->ptr(), src.raw()->ptr(), size); 1032 memmove(raw_obj->ptr(), src.raw()->ptr(), size);
1031 if (space == Heap::kOld) { 1033 if (space == Heap::kOld) {
1032 StoreBufferObjectPointerVisitor visitor(Isolate::Current()); 1034 StoreBufferObjectPointerVisitor visitor(Isolate::Current());
1033 raw_obj->VisitPointers(&visitor); 1035 raw_obj->VisitPointers(&visitor);
1034 } 1036 }
1035 return raw_obj; 1037 return raw_obj;
1036 } 1038 }
1037 1039
1038 1040
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 Type::New(*this, signature_type_arguments, token_pos())); 1080 Type::New(*this, signature_type_arguments, token_pos()));
1079 1081
1080 // Return the still unfinalized signature type. 1082 // Return the still unfinalized signature type.
1081 ASSERT(!signature_type.IsFinalized()); 1083 ASSERT(!signature_type.IsFinalized());
1082 return signature_type.raw(); 1084 return signature_type.raw();
1083 } 1085 }
1084 1086
1085 1087
1086 template <class FakeObject> 1088 template <class FakeObject>
1087 RawClass* Class::New() { 1089 RawClass* Class::New() {
1088 Class& class_class = Class::Handle(Object::class_class()); 1090 ASSERT(Object::class_class() != Class::null());
1089 Class& result = Class::Handle(); 1091 Class& result = Class::Handle();
1090 { 1092 {
1091 RawObject* raw = Object::Allocate(class_class, 1093 RawObject* raw = Object::Allocate(Class::kInstanceKind,
1092 Class::InstanceSize(), 1094 Class::InstanceSize(),
1093 Heap::kOld); 1095 Heap::kOld);
1094 NoGCScope no_gc; 1096 NoGCScope no_gc;
1095 result ^= raw; 1097 result ^= raw;
1096 } 1098 }
1097 FakeObject fake; 1099 FakeObject fake;
1098 result.set_handle_vtable(fake.vtable()); 1100 result.set_handle_vtable(fake.vtable());
1099 result.set_instance_size(FakeObject::InstanceSize()); 1101 result.set_instance_size(FakeObject::InstanceSize());
1100 result.set_next_field_offset(FakeObject::InstanceSize()); 1102 result.set_next_field_offset(FakeObject::InstanceSize());
1101 result.set_instance_kind(FakeObject::kInstanceKind); 1103 result.set_instance_kind(FakeObject::kInstanceKind);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 ASSERT(!(field.is_static() && field.is_final()) || 1415 ASSERT(!(field.is_static() && field.is_final()) ||
1414 (field.value() == Object::sentinel())); 1416 (field.value() == Object::sentinel()));
1415 } 1417 }
1416 // The value of static fields is already initialized to null. 1418 // The value of static fields is already initialized to null.
1417 StorePointer(&raw_ptr()->fields_, value.raw()); 1419 StorePointer(&raw_ptr()->fields_, value.raw());
1418 } 1420 }
1419 1421
1420 1422
1421 template <class FakeInstance> 1423 template <class FakeInstance>
1422 RawClass* Class::New(intptr_t index) { 1424 RawClass* Class::New(intptr_t index) {
1423 Class& class_class = Class::Handle(Object::class_class()); 1425 ASSERT(Object::class_class() != Class::null());
1424 Class& result = Class::Handle(); 1426 Class& result = Class::Handle();
1425 { 1427 {
1426 RawObject* raw = Object::Allocate(class_class, 1428 RawObject* raw = Object::Allocate(Class::kInstanceKind,
1427 Class::InstanceSize(), 1429 Class::InstanceSize(),
1428 Heap::kOld); 1430 Heap::kOld);
1429 NoGCScope no_gc; 1431 NoGCScope no_gc;
1430 result ^= raw; 1432 result ^= raw;
1431 } 1433 }
1432 FakeInstance fake; 1434 FakeInstance fake;
1433 ASSERT(fake.IsInstance()); 1435 ASSERT(fake.IsInstance());
1434 result.set_handle_vtable(fake.vtable()); 1436 result.set_handle_vtable(fake.vtable());
1435 result.set_instance_size(FakeInstance::InstanceSize()); 1437 result.set_instance_size(FakeInstance::InstanceSize());
1436 result.set_next_field_offset(FakeInstance::InstanceSize()); 1438 result.set_next_field_offset(FakeInstance::InstanceSize());
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 intptr_t token_pos) { 2139 intptr_t token_pos) {
2138 const UnresolvedClass& type = UnresolvedClass::Handle(UnresolvedClass::New()); 2140 const UnresolvedClass& type = UnresolvedClass::Handle(UnresolvedClass::New());
2139 type.set_library_prefix(library_prefix); 2141 type.set_library_prefix(library_prefix);
2140 type.set_ident(ident); 2142 type.set_ident(ident);
2141 type.set_token_pos(token_pos); 2143 type.set_token_pos(token_pos);
2142 return type.raw(); 2144 return type.raw();
2143 } 2145 }
2144 2146
2145 2147
2146 RawUnresolvedClass* UnresolvedClass::New() { 2148 RawUnresolvedClass* UnresolvedClass::New() {
2147 const Class& unresolved_class_class = 2149 ASSERT(Object::unresolved_class_class() != Class::null());
2148 Class::Handle(Object::unresolved_class_class()); 2150 RawObject* raw = Object::Allocate(UnresolvedClass::kInstanceKind,
2149 RawObject* raw = Object::Allocate(unresolved_class_class,
2150 UnresolvedClass::InstanceSize(), 2151 UnresolvedClass::InstanceSize(),
2151 Heap::kOld); 2152 Heap::kOld);
2152 return reinterpret_cast<RawUnresolvedClass*>(raw); 2153 return reinterpret_cast<RawUnresolvedClass*>(raw);
2153 } 2154 }
2154 2155
2155 2156
2156 void UnresolvedClass::set_token_pos(intptr_t token_pos) const { 2157 void UnresolvedClass::set_token_pos(intptr_t token_pos) const {
2157 ASSERT(token_pos >= 0); 2158 ASSERT(token_pos >= 0);
2158 raw_ptr()->token_pos_ = token_pos; 2159 raw_ptr()->token_pos_ = token_pos;
2159 } 2160 }
(...skipping 14 matching lines...) Expand all
2174 StorePointer(&raw_ptr()->factory_signature_class_, value.raw()); 2175 StorePointer(&raw_ptr()->factory_signature_class_, value.raw());
2175 } 2176 }
2176 2177
2177 2178
2178 RawString* UnresolvedClass::Name() const { 2179 RawString* UnresolvedClass::Name() const {
2179 if (library_prefix() != LibraryPrefix::null()) { 2180 if (library_prefix() != LibraryPrefix::null()) {
2180 const LibraryPrefix& lib_prefix = LibraryPrefix::Handle(library_prefix()); 2181 const LibraryPrefix& lib_prefix = LibraryPrefix::Handle(library_prefix());
2181 String& name = String::Handle(); 2182 String& name = String::Handle();
2182 String& str = String::Handle(); 2183 String& str = String::Handle();
2183 name = lib_prefix.name(); // Qualifier. 2184 name = lib_prefix.name(); // Qualifier.
2184 str = String::New("."); 2185 str = Symbols::Dot();
2185 name = String::Concat(name, str); 2186 name = String::Concat(name, str);
2186 str = ident(); 2187 str = ident();
2187 name = String::Concat(name, str); 2188 name = String::Concat(name, str);
2188 return name.raw(); 2189 return name.raw();
2189 } else { 2190 } else {
2190 return ident(); 2191 return ident();
2191 } 2192 }
2192 } 2193 }
2193 2194
2194 2195
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 StorePointer(&raw_ptr()->type_class_, value.raw()); 2778 StorePointer(&raw_ptr()->type_class_, value.raw());
2778 } 2779 }
2779 2780
2780 2781
2781 void Type::set_arguments(const AbstractTypeArguments& value) const { 2782 void Type::set_arguments(const AbstractTypeArguments& value) const {
2782 StorePointer(&raw_ptr()->arguments_, value.raw()); 2783 StorePointer(&raw_ptr()->arguments_, value.raw());
2783 } 2784 }
2784 2785
2785 2786
2786 RawType* Type::New(Heap::Space space) { 2787 RawType* Type::New(Heap::Space space) {
2787 const Class& type_class = Class::Handle(Object::type_class()); 2788 ASSERT(Object::type_class() != Class::null());
2788 RawObject* raw = Object::Allocate(type_class, 2789 RawObject* raw = Object::Allocate(Type::kInstanceKind,
2789 Type::InstanceSize(), 2790 Type::InstanceSize(),
2790 space); 2791 space);
2791 return reinterpret_cast<RawType*>(raw); 2792 return reinterpret_cast<RawType*>(raw);
2792 } 2793 }
2793 2794
2794 2795
2795 RawType* Type::New(const Object& clazz, 2796 RawType* Type::New(const Object& clazz,
2796 const AbstractTypeArguments& arguments, 2797 const AbstractTypeArguments& arguments,
2797 intptr_t token_pos, 2798 intptr_t token_pos,
2798 Heap::Space space) { 2799 Heap::Space space) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 const AbstractTypeArguments& instantiator_type_arguments) const { 2939 const AbstractTypeArguments& instantiator_type_arguments) const {
2939 ASSERT(IsFinalized()); 2940 ASSERT(IsFinalized());
2940 if (instantiator_type_arguments.IsNull()) { 2941 if (instantiator_type_arguments.IsNull()) {
2941 return Type::DynamicType(); 2942 return Type::DynamicType();
2942 } 2943 }
2943 return instantiator_type_arguments.TypeAt(index()); 2944 return instantiator_type_arguments.TypeAt(index());
2944 } 2945 }
2945 2946
2946 2947
2947 RawTypeParameter* TypeParameter::New() { 2948 RawTypeParameter* TypeParameter::New() {
2948 const Class& type_parameter_class = 2949 ASSERT(Object::type_parameter_class() != Class::null());
2949 Class::Handle(Object::type_parameter_class()); 2950 RawObject* raw = Object::Allocate(TypeParameter::kInstanceKind,
2950 RawObject* raw = Object::Allocate(type_parameter_class,
2951 TypeParameter::InstanceSize(), 2951 TypeParameter::InstanceSize(),
2952 Heap::kOld); 2952 Heap::kOld);
2953 return reinterpret_cast<RawTypeParameter*>(raw); 2953 return reinterpret_cast<RawTypeParameter*>(raw);
2954 } 2954 }
2955 2955
2956 2956
2957 RawTypeParameter* TypeParameter::New(const Class& parameterized_class, 2957 RawTypeParameter* TypeParameter::New(const Class& parameterized_class,
2958 intptr_t index, 2958 intptr_t index,
2959 const String& name, 2959 const String& name,
2960 const AbstractType& bound, 2960 const AbstractType& bound,
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 } 3361 }
3362 3362
3363 3363
3364 RawTypeArguments* TypeArguments::New(intptr_t len, Heap::Space space) { 3364 RawTypeArguments* TypeArguments::New(intptr_t len, Heap::Space space) {
3365 if ((len < 0) || (len > kMaxTypes)) { 3365 if ((len < 0) || (len > kMaxTypes)) {
3366 // TODO(iposva): Should we throw an illegal parameter exception? 3366 // TODO(iposva): Should we throw an illegal parameter exception?
3367 UNIMPLEMENTED(); 3367 UNIMPLEMENTED();
3368 return null(); 3368 return null();
3369 } 3369 }
3370 3370
3371 const Class& type_arguments_class =
3372 Class::Handle(Object::type_arguments_class());
3373 TypeArguments& result = TypeArguments::Handle(); 3371 TypeArguments& result = TypeArguments::Handle();
3374 { 3372 {
3375 RawObject* raw = Object::Allocate(type_arguments_class, 3373 RawObject* raw = Object::Allocate(TypeArguments::kInstanceKind,
3376 TypeArguments::InstanceSize(len), 3374 TypeArguments::InstanceSize(len),
3377 space); 3375 space);
3378 NoGCScope no_gc; 3376 NoGCScope no_gc;
3379 result ^= raw; 3377 result ^= raw;
3380 // Length must be set before we start storing into the array. 3378 // Length must be set before we start storing into the array.
3381 result.SetLength(len); 3379 result.SetLength(len);
3382 } 3380 }
3383 return result.raw(); 3381 return result.raw();
3384 } 3382 }
3385 3383
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 } 3483 }
3486 3484
3487 3485
3488 void InstantiatedTypeArguments::set_instantiator_type_arguments( 3486 void InstantiatedTypeArguments::set_instantiator_type_arguments(
3489 const AbstractTypeArguments& value) const { 3487 const AbstractTypeArguments& value) const {
3490 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw()); 3488 StorePointer(&raw_ptr()->instantiator_type_arguments_, value.raw());
3491 } 3489 }
3492 3490
3493 3491
3494 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() { 3492 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New() {
3495 const Class& instantiated_type_arguments_class = 3493 ASSERT(Object::instantiated_type_arguments_class() != Class::null());
3496 Class::Handle(Object::instantiated_type_arguments_class()); 3494 RawObject* raw = Object::Allocate(InstantiatedTypeArguments::kInstanceKind,
3497 RawObject* raw = Object::Allocate(instantiated_type_arguments_class,
3498 InstantiatedTypeArguments::InstanceSize(), 3495 InstantiatedTypeArguments::InstanceSize(),
3499 Heap::kNew); 3496 Heap::kNew);
3500 return reinterpret_cast<RawInstantiatedTypeArguments*>(raw); 3497 return reinterpret_cast<RawInstantiatedTypeArguments*>(raw);
3501 } 3498 }
3502 3499
3503 3500
3504 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New( 3501 RawInstantiatedTypeArguments* InstantiatedTypeArguments::New(
3505 const AbstractTypeArguments& uninstantiated_type_arguments, 3502 const AbstractTypeArguments& uninstantiated_type_arguments,
3506 const AbstractTypeArguments& instantiator_type_arguments) { 3503 const AbstractTypeArguments& instantiator_type_arguments) {
3507 const InstantiatedTypeArguments& result = 3504 const InstantiatedTypeArguments& result =
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3989 bool Function::IsImplicitClosureFunction() const { 3986 bool Function::IsImplicitClosureFunction() const {
3990 if (!IsClosureFunction()) { 3987 if (!IsClosureFunction()) {
3991 return false; 3988 return false;
3992 } 3989 }
3993 const Function& parent = Function::Handle(parent_function()); 3990 const Function& parent = Function::Handle(parent_function());
3994 return parent.raw_ptr()->implicit_closure_function_ == raw(); 3991 return parent.raw_ptr()->implicit_closure_function_ == raw();
3995 } 3992 }
3996 3993
3997 3994
3998 RawFunction* Function::New() { 3995 RawFunction* Function::New() {
3999 const Class& function_class = Class::Handle(Object::function_class()); 3996 ASSERT(Object::function_class() != Class::null());
4000 RawObject* raw = Object::Allocate(function_class, 3997 RawObject* raw = Object::Allocate(Function::kInstanceKind,
4001 Function::InstanceSize(), 3998 Function::InstanceSize(),
4002 Heap::kOld); 3999 Heap::kOld);
4003 return reinterpret_cast<RawFunction*>(raw); 4000 return reinterpret_cast<RawFunction*>(raw);
4004 } 4001 }
4005 4002
4006 4003
4007 RawFunction* Function::New(const String& name, 4004 RawFunction* Function::New(const String& name,
4008 RawFunction::Kind kind, 4005 RawFunction::Kind kind,
4009 bool is_static, 4006 bool is_static,
4010 bool is_const, 4007 bool is_const,
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
4349 } 4346 }
4350 4347
4351 4348
4352 void Field::set_type(const AbstractType& value) const { 4349 void Field::set_type(const AbstractType& value) const {
4353 ASSERT(!value.IsNull()); 4350 ASSERT(!value.IsNull());
4354 StorePointer(&raw_ptr()->type_, value.raw()); 4351 StorePointer(&raw_ptr()->type_, value.raw());
4355 } 4352 }
4356 4353
4357 4354
4358 RawField* Field::New() { 4355 RawField* Field::New() {
4359 const Class& field_class = Class::Handle(Object::field_class()); 4356 ASSERT(Object::field_class() != Class::null());
4360 RawObject* raw = Object::Allocate(field_class, 4357 RawObject* raw = Object::Allocate(Field::kInstanceKind,
4361 Field::InstanceSize(), 4358 Field::InstanceSize(),
4362 Heap::kOld); 4359 Heap::kOld);
4363 return reinterpret_cast<RawField*>(raw); 4360 return reinterpret_cast<RawField*>(raw);
4364 } 4361 }
4365 4362
4366 4363
4367 RawField* Field::New(const String& name, 4364 RawField* Field::New(const String& name,
4368 bool is_static, 4365 bool is_static,
4369 bool is_final, 4366 bool is_final,
4370 intptr_t token_pos) { 4367 intptr_t token_pos) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 StorePointer(&raw_ptr()->literal_, literal.raw()); 4401 StorePointer(&raw_ptr()->literal_, literal.raw());
4405 } 4402 }
4406 4403
4407 4404
4408 void LiteralToken::set_value(const Object& value) const { 4405 void LiteralToken::set_value(const Object& value) const {
4409 StorePointer(&raw_ptr()->value_, value.raw()); 4406 StorePointer(&raw_ptr()->value_, value.raw());
4410 } 4407 }
4411 4408
4412 4409
4413 RawLiteralToken* LiteralToken::New() { 4410 RawLiteralToken* LiteralToken::New() {
4414 const Class& cls = Class::Handle(Object::literal_token_class()); 4411 ASSERT(Object::literal_token_class() != Class::null());
4415 RawObject* raw = Object::Allocate(cls, 4412 RawObject* raw = Object::Allocate(LiteralToken::kInstanceKind,
4416 LiteralToken::InstanceSize(), 4413 LiteralToken::InstanceSize(),
4417 Heap::kOld); 4414 Heap::kOld);
4418 return reinterpret_cast<RawLiteralToken*>(raw); 4415 return reinterpret_cast<RawLiteralToken*>(raw);
4419 } 4416 }
4420 4417
4421 4418
4422 RawLiteralToken* LiteralToken::New(Token::Kind kind, const String& literal) { 4419 RawLiteralToken* LiteralToken::New(Token::Kind kind, const String& literal) {
4423 const LiteralToken& result = LiteralToken::Handle(LiteralToken::New()); 4420 const LiteralToken& result = LiteralToken::Handle(LiteralToken::New());
4424 result.set_kind(kind); 4421 result.set_kind(kind);
4425 result.set_literal(literal); 4422 result.set_literal(literal);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4524 while (index < src_pos && kind != Token::kEOS) { 4521 while (index < src_pos && kind != Token::kEOS) {
4525 iterator.Advance(); 4522 iterator.Advance();
4526 kind = iterator.CurrentTokenKind(); 4523 kind = iterator.CurrentTokenKind();
4527 index += 1; 4524 index += 1;
4528 } 4525 }
4529 return iterator.CurrentPosition(); 4526 return iterator.CurrentPosition();
4530 } 4527 }
4531 4528
4532 4529
4533 RawTokenStream* TokenStream::New(intptr_t len) { 4530 RawTokenStream* TokenStream::New(intptr_t len) {
4534 const Class& token_stream_class = Class::Handle(Object::token_stream_class()); 4531 ASSERT(Object::token_stream_class() != Class::null());
4535 TokenStream& result = TokenStream::Handle(); 4532 TokenStream& result = TokenStream::Handle();
4536 { 4533 {
4537 RawObject* raw = Object::Allocate(token_stream_class, 4534 RawObject* raw = Object::Allocate(TokenStream::kInstanceKind,
4538 TokenStream::InstanceSize(len), 4535 TokenStream::InstanceSize(len),
4539 Heap::kOld); 4536 Heap::kOld);
4540 NoGCScope no_gc; 4537 NoGCScope no_gc;
4541 result ^= raw; 4538 result ^= raw;
4542 result.SetLength(len); 4539 result.SetLength(len);
4543 } 4540 }
4544 return result.raw(); 4541 return result.raw();
4545 } 4542 }
4546 4543
4547 4544
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
5021 String& snippet = String::Handle(); 5018 String& snippet = String::Handle();
5022 if ((snippet_start != -1) && (snippet_end != -1)) { 5019 if ((snippet_start != -1) && (snippet_end != -1)) {
5023 snippet = 5020 snippet =
5024 String::SubString(src, snippet_start, snippet_end - snippet_start); 5021 String::SubString(src, snippet_start, snippet_end - snippet_start);
5025 } 5022 }
5026 return snippet.raw(); 5023 return snippet.raw();
5027 } 5024 }
5028 5025
5029 5026
5030 RawScript* Script::New() { 5027 RawScript* Script::New() {
5031 const Class& script_class = Class::Handle(Object::script_class()); 5028 ASSERT(Object::script_class() != Class::null());
5032 RawObject* raw = Object::Allocate(script_class, 5029 RawObject* raw = Object::Allocate(Script::kInstanceKind,
5033 Script::InstanceSize(), 5030 Script::InstanceSize(),
5034 Heap::kOld); 5031 Heap::kOld);
5035 return reinterpret_cast<RawScript*>(raw); 5032 return reinterpret_cast<RawScript*>(raw);
5036 } 5033 }
5037 5034
5038 5035
5039 RawScript* Script::New(const String& url, 5036 RawScript* Script::New(const String& url,
5040 const String& source, 5037 const String& source,
5041 RawScript::Kind kind) { 5038 RawScript::Kind kind) {
5042 const Script& result = Script::Handle(Script::New()); 5039 const Script& result = Script::Handle(Script::New());
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
5829 5826
5830 void Library::InitImportedIntoList() const { 5827 void Library::InitImportedIntoList() const {
5831 const Array& imported_into = 5828 const Array& imported_into =
5832 Array::Handle(Array::New(kInitialImportedIntoCapacity, Heap::kOld)); 5829 Array::Handle(Array::New(kInitialImportedIntoCapacity, Heap::kOld));
5833 StorePointer(&raw_ptr()->imported_into_, imported_into.raw()); 5830 StorePointer(&raw_ptr()->imported_into_, imported_into.raw());
5834 raw_ptr()->num_imported_into_ = 0; 5831 raw_ptr()->num_imported_into_ = 0;
5835 } 5832 }
5836 5833
5837 5834
5838 RawLibrary* Library::New() { 5835 RawLibrary* Library::New() {
5839 const Class& library_class = Class::Handle(Object::library_class()); 5836 ASSERT(Object::library_class() != Class::null());
5840 RawObject* raw = Object::Allocate(library_class, 5837 RawObject* raw = Object::Allocate(Library::kInstanceKind,
5841 Library::InstanceSize(), 5838 Library::InstanceSize(),
5842 Heap::kOld); 5839 Heap::kOld);
5843 return reinterpret_cast<RawLibrary*>(raw); 5840 return reinterpret_cast<RawLibrary*>(raw);
5844 } 5841 }
5845 5842
5846 5843
5847 RawLibrary* Library::NewLibraryHelper(const String& url, 5844 RawLibrary* Library::NewLibraryHelper(const String& url,
5848 bool import_core_lib) { 5845 bool import_core_lib) {
5849 const Library& result = Library::Handle(Library::New()); 5846 const Library& result = Library::Handle(Library::New());
5850 result.raw_ptr()->name_ = url.raw(); 5847 result.raw_ptr()->name_ = url.raw();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
6144 resolved_class = lib.LookupLocalClass(class_name); 6141 resolved_class = lib.LookupLocalClass(class_name);
6145 if (!resolved_class.IsNull()) { 6142 if (!resolved_class.IsNull()) {
6146 return resolved_class.raw(); 6143 return resolved_class.raw();
6147 } 6144 }
6148 } 6145 }
6149 return Class::null(); 6146 return Class::null();
6150 } 6147 }
6151 6148
6152 6149
6153 RawLibraryPrefix* LibraryPrefix::New() { 6150 RawLibraryPrefix* LibraryPrefix::New() {
6154 const Class& library_prefix_class = 6151 ASSERT(Object::library_prefix_class() != Class::null());
6155 Class::Handle(Object::library_prefix_class()); 6152 RawObject* raw = Object::Allocate(LibraryPrefix::kInstanceKind,
6156 RawObject* raw = Object::Allocate(library_prefix_class,
6157 LibraryPrefix::InstanceSize(), 6153 LibraryPrefix::InstanceSize(),
6158 Heap::kOld); 6154 Heap::kOld);
6159 return reinterpret_cast<RawLibraryPrefix*>(raw); 6155 return reinterpret_cast<RawLibraryPrefix*>(raw);
6160 } 6156 }
6161 6157
6162 6158
6163 RawLibraryPrefix* LibraryPrefix::New(const String& name, const Library& lib) { 6159 RawLibraryPrefix* LibraryPrefix::New(const String& name, const Library& lib) {
6164 const LibraryPrefix& result = LibraryPrefix::Handle(LibraryPrefix::New()); 6160 const LibraryPrefix& result = LibraryPrefix::Handle(LibraryPrefix::New());
6165 result.set_name(name); 6161 result.set_name(name);
6166 result.set_num_libs(0); 6162 result.set_num_libs(0);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
6271 if (!error.IsNull()) { 6267 if (!error.IsNull()) {
6272 return error.raw(); 6268 return error.raw();
6273 } 6269 }
6274 } 6270 }
6275 } 6271 }
6276 return error.raw(); 6272 return error.raw();
6277 } 6273 }
6278 6274
6279 6275
6280 RawInstructions* Instructions::New(intptr_t size) { 6276 RawInstructions* Instructions::New(intptr_t size) {
6281 const Class& instructions_class = Class::Handle(Object::instructions_class()); 6277 ASSERT(Object::instructions_class() != Class::null());
6282 Instructions& result = Instructions::Handle(); 6278 Instructions& result = Instructions::Handle();
6283 { 6279 {
6284 uword aligned_size = Instructions::InstanceSize(size); 6280 uword aligned_size = Instructions::InstanceSize(size);
6285 RawObject* raw = Object::Allocate(instructions_class, 6281 RawObject* raw = Object::Allocate(Instructions::kInstanceKind,
6286 aligned_size, 6282 aligned_size,
6287 Heap::kCode); 6283 Heap::kCode);
6288 NoGCScope no_gc; 6284 NoGCScope no_gc;
6289 // TODO(iposva): Remove premarking once old and code spaces are merged. 6285 // TODO(iposva): Remove premarking once old and code spaces are merged.
6290 raw->SetMarkBit(); 6286 raw->SetMarkBit();
6291 result ^= raw; 6287 result ^= raw;
6292 result.set_size(size); 6288 result.set_size(size);
6293 } 6289 }
6294 return result.raw(); 6290 return result.raw();
6295 } 6291 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6356 return *(EntryAddr(index, kTryIndexEntry)); 6352 return *(EntryAddr(index, kTryIndexEntry));
6357 } 6353 }
6358 6354
6359 6355
6360 void PcDescriptors::SetTryIndex(intptr_t index, intptr_t value) const { 6356 void PcDescriptors::SetTryIndex(intptr_t index, intptr_t value) const {
6361 *(EntryAddr(index, kTryIndexEntry)) = value; 6357 *(EntryAddr(index, kTryIndexEntry)) = value;
6362 } 6358 }
6363 6359
6364 6360
6365 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors) { 6361 RawPcDescriptors* PcDescriptors::New(intptr_t num_descriptors) {
6366 const Class& cls = Class::Handle(Object::pc_descriptors_class()); 6362 ASSERT(Object::pc_descriptors_class() != Class::null());
6367 PcDescriptors& result = PcDescriptors::Handle(); 6363 PcDescriptors& result = PcDescriptors::Handle();
6368 { 6364 {
6369 uword size = PcDescriptors::InstanceSize(num_descriptors); 6365 uword size = PcDescriptors::InstanceSize(num_descriptors);
6370 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); 6366 RawObject* raw = Object::Allocate(PcDescriptors::kInstanceKind,
6367 size,
6368 Heap::kOld);
6371 NoGCScope no_gc; 6369 NoGCScope no_gc;
6372 result ^= raw; 6370 result ^= raw;
6373 result.SetLength(num_descriptors); 6371 result.SetLength(num_descriptors);
6374 } 6372 }
6375 return result.raw(); 6373 return result.raw();
6376 } 6374 }
6377 6375
6378 6376
6379 const char* PcDescriptors::KindAsStr(intptr_t index) const { 6377 const char* PcDescriptors::KindAsStr(intptr_t index) const {
6380 switch (DescriptorKind(index)) { 6378 switch (DescriptorKind(index)) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
6477 uint8_t* byte_addr = &(raw_ptr()->data_[byte_offset]); 6475 uint8_t* byte_addr = &(raw_ptr()->data_[byte_offset]);
6478 if (value) { 6476 if (value) {
6479 *byte_addr |= byte_mask; 6477 *byte_addr |= byte_mask;
6480 } else { 6478 } else {
6481 *byte_addr &= ~byte_mask; 6479 *byte_addr &= ~byte_mask;
6482 } 6480 }
6483 } 6481 }
6484 6482
6485 6483
6486 RawStackmap* Stackmap::New(uword pc_offset, BitmapBuilder* bmap) { 6484 RawStackmap* Stackmap::New(uword pc_offset, BitmapBuilder* bmap) {
6487 const Class& cls = Class::Handle(Object::stackmap_class()); 6485 ASSERT(Object::stackmap_class() != Class::null());
6488 ASSERT(!cls.IsNull());
6489 ASSERT(bmap != NULL); 6486 ASSERT(bmap != NULL);
6490 Stackmap& result = Stackmap::Handle(); 6487 Stackmap& result = Stackmap::Handle();
6491 intptr_t size = bmap->SizeInBytes(); 6488 intptr_t size = bmap->SizeInBytes();
6492 { 6489 {
6493 // Stackmap data objects are associated with a code object, allocate them 6490 // Stackmap data objects are associated with a code object, allocate them
6494 // in old generation. 6491 // in old generation.
6495 RawObject* raw = 6492 RawObject* raw = Object::Allocate(Stackmap::kInstanceKind,
6496 Object::Allocate(cls, Stackmap::InstanceSize(size), Heap::kOld); 6493 Stackmap::InstanceSize(size),
6494 Heap::kOld);
6497 NoGCScope no_gc; 6495 NoGCScope no_gc;
6498 result ^= raw; 6496 result ^= raw;
6499 result.set_bitmap_size_in_bytes(size); 6497 result.set_bitmap_size_in_bytes(size);
6500 } 6498 }
6501 result.SetPC(pc_offset); 6499 result.SetPC(pc_offset);
6502 intptr_t bound = bmap->SizeInBits(); 6500 intptr_t bound = bmap->SizeInBits();
6503 for (intptr_t i = 0; i < bound; i++) { 6501 for (intptr_t i = 0; i < bound; i++) {
6504 result.SetBit(i, bmap->Get(i)); 6502 result.SetBit(i, bmap->Get(i));
6505 } 6503 }
6506 result.SetMinBitOffset(bmap->Minimum()); 6504 result.SetMinBitOffset(bmap->Minimum());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6566 } 6564 }
6567 6565
6568 6566
6569 const char* LocalVarDescriptors::ToCString() const { 6567 const char* LocalVarDescriptors::ToCString() const {
6570 UNIMPLEMENTED(); 6568 UNIMPLEMENTED();
6571 return "LocalVarDescriptors"; 6569 return "LocalVarDescriptors";
6572 } 6570 }
6573 6571
6574 6572
6575 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { 6573 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) {
6576 const Class& cls = Class::Handle(Object::var_descriptors_class()); 6574 ASSERT(Object::var_descriptors_class() != Class::null());
6577 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); 6575 LocalVarDescriptors& result = LocalVarDescriptors::Handle();
6578 { 6576 {
6579 uword size = LocalVarDescriptors::InstanceSize(num_variables); 6577 uword size = LocalVarDescriptors::InstanceSize(num_variables);
6580 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); 6578 RawObject* raw = Object::Allocate(LocalVarDescriptors::kInstanceKind,
6579 size,
6580 Heap::kOld);
6581 NoGCScope no_gc; 6581 NoGCScope no_gc;
6582 result ^= raw; 6582 result ^= raw;
6583 result.raw_ptr()->length_ = num_variables; 6583 result.raw_ptr()->length_ = num_variables;
6584 } 6584 }
6585 const Array& names = Array::Handle(Array::New(num_variables, Heap::kOld)); 6585 const Array& names = Array::Handle(Array::New(num_variables, Heap::kOld));
6586 result.raw_ptr()->names_ = names.raw(); 6586 result.raw_ptr()->names_ = names.raw();
6587 return result.raw(); 6587 return result.raw();
6588 } 6588 }
6589 6589
6590 6590
(...skipping 29 matching lines...) Expand all
6620 } 6620 }
6621 6621
6622 6622
6623 void ExceptionHandlers::SetHandlerPC(intptr_t index, 6623 void ExceptionHandlers::SetHandlerPC(intptr_t index,
6624 intptr_t value) const { 6624 intptr_t value) const {
6625 *(EntryAddr(index, kHandlerPcEntry)) = value; 6625 *(EntryAddr(index, kHandlerPcEntry)) = value;
6626 } 6626 }
6627 6627
6628 6628
6629 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { 6629 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) {
6630 const Class& cls = Class::Handle(Object::exception_handlers_class()); 6630 ASSERT(Object::exception_handlers_class() != Class::null());
6631 ExceptionHandlers& result = ExceptionHandlers::Handle(); 6631 ExceptionHandlers& result = ExceptionHandlers::Handle();
6632 { 6632 {
6633 uword size = ExceptionHandlers::InstanceSize(num_handlers); 6633 uword size = ExceptionHandlers::InstanceSize(num_handlers);
6634 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); 6634 RawObject* raw = Object::Allocate(ExceptionHandlers::kInstanceKind,
6635 size,
6636 Heap::kOld);
6635 NoGCScope no_gc; 6637 NoGCScope no_gc;
6636 result ^= raw; 6638 result ^= raw;
6637 result.SetLength(num_handlers); 6639 result.SetLength(num_handlers);
6638 } 6640 }
6639 return result.raw(); 6641 return result.raw();
6640 } 6642 }
6641 6643
6642 6644
6643 const char* ExceptionHandlers::ToCString() const { 6645 const char* ExceptionHandlers::ToCString() const {
6644 if (Length() == 0) { 6646 if (Length() == 0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6723 return *comments; 6725 return *comments;
6724 } 6726 }
6725 6727
6726 6728
6727 void Code::set_comments(const Code::Comments& comments) const { 6729 void Code::set_comments(const Code::Comments& comments) const {
6728 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); 6730 StorePointer(&raw_ptr()->comments_, comments.comments_.raw());
6729 } 6731 }
6730 6732
6731 6733
6732 RawCode* Code::New(int pointer_offsets_length) { 6734 RawCode* Code::New(int pointer_offsets_length) {
6733 const Class& cls = Class::Handle(Object::code_class()); 6735 ASSERT(Object::code_class() != Class::null());
6734 Code& result = Code::Handle(); 6736 Code& result = Code::Handle();
6735 { 6737 {
6736 uword size = Code::InstanceSize(pointer_offsets_length); 6738 uword size = Code::InstanceSize(pointer_offsets_length);
6737 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); 6739 RawObject* raw = Object::Allocate(Code::kInstanceKind, size, Heap::kOld);
6738 NoGCScope no_gc; 6740 NoGCScope no_gc;
6739 result ^= raw; 6741 result ^= raw;
6740 result.set_pointer_offsets_length(pointer_offsets_length); 6742 result.set_pointer_offsets_length(pointer_offsets_length);
6741 result.set_is_optimized(false); 6743 result.set_is_optimized(false);
6742 result.set_comments(Comments::New(0)); 6744 result.set_comments(Comments::New(0));
6743 } 6745 }
6744 return result.raw(); 6746 return result.raw();
6745 } 6747 }
6746 6748
6747 6749
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
6952 } 6954 }
6953 previous_map = map->raw(); 6955 previous_map = map->raw();
6954 } 6956 }
6955 return map->raw(); 6957 return map->raw();
6956 } 6958 }
6957 6959
6958 6960
6959 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { 6961 RawContext* Context::New(intptr_t num_variables, Heap::Space space) {
6960 ASSERT(num_variables >= 0); 6962 ASSERT(num_variables >= 0);
6961 6963
6962 const Class& context_class = Class::Handle(Object::context_class());
6963 Context& result = Context::Handle(); 6964 Context& result = Context::Handle();
6964 { 6965 {
6965 RawObject* raw = Object::Allocate(context_class, 6966 RawObject* raw = Object::Allocate(Context::kInstanceKind,
6966 Context::InstanceSize(num_variables), 6967 Context::InstanceSize(num_variables),
6967 space); 6968 space);
6968 NoGCScope no_gc; 6969 NoGCScope no_gc;
6969 result ^= raw; 6970 result ^= raw;
6970 result.set_num_variables(num_variables); 6971 result.set_num_variables(num_variables);
6971 } 6972 }
6972 result.set_isolate(Isolate::Current()); 6973 result.set_isolate(Isolate::Current());
6973 return result.raw(); 6974 return result.raw();
6974 } 6975 }
6975 6976
6976 6977
6977 const char* Context::ToCString() const { 6978 const char* Context::ToCString() const {
6978 return "Context"; 6979 return "Context";
6979 } 6980 }
6980 6981
6981 6982
6982 RawContextScope* ContextScope::New(intptr_t num_variables) { 6983 RawContextScope* ContextScope::New(intptr_t num_variables) {
6983 const Class& context_scope_class = 6984 ASSERT(Object::context_scope_class() != Class::null());
6984 Class::Handle(Object::context_scope_class());
6985 intptr_t size = ContextScope::InstanceSize(num_variables); 6985 intptr_t size = ContextScope::InstanceSize(num_variables);
6986 ContextScope& result = ContextScope::Handle(); 6986 ContextScope& result = ContextScope::Handle();
6987 { 6987 {
6988 RawObject* raw = Object::Allocate(context_scope_class, size, Heap::kOld); 6988 RawObject* raw = Object::Allocate(ContextScope::kInstanceKind,
6989 size,
6990 Heap::kOld);
6989 NoGCScope no_gc; 6991 NoGCScope no_gc;
6990 result ^= raw; 6992 result ^= raw;
6991 result.set_num_variables(num_variables); 6993 result.set_num_variables(num_variables);
6992 } 6994 }
6993 return result.raw(); 6995 return result.raw();
6994 } 6996 }
6995 6997
6996 6998
6997 intptr_t ContextScope::TokenIndexAt(intptr_t scope_index) const { 6999 intptr_t ContextScope::TokenIndexAt(intptr_t scope_index) const {
6998 return Smi::Value(VariableDescAddr(scope_index)->token_pos); 7000 return Smi::Value(VariableDescAddr(scope_index)->token_pos);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
7249 } 7251 }
7250 } 7252 }
7251 return result.raw(); 7253 return result.raw();
7252 } 7254 }
7253 7255
7254 7256
7255 RawICData* ICData::New(const Function& function, 7257 RawICData* ICData::New(const Function& function,
7256 const String& target_name, 7258 const String& target_name,
7257 intptr_t id, 7259 intptr_t id,
7258 intptr_t num_args_tested) { 7260 intptr_t num_args_tested) {
7261 ASSERT(Object::icdata_class() != Class::null());
7259 ASSERT(num_args_tested > 0); 7262 ASSERT(num_args_tested > 0);
7260 const Class& cls = Class::Handle(Object::icdata_class());
7261 ASSERT(!cls.IsNull());
7262 ICData& result = ICData::Handle(); 7263 ICData& result = ICData::Handle();
7263 { 7264 {
7264 // IC data objects are long living objects, allocate them in old generation. 7265 // IC data objects are long living objects, allocate them in old generation.
7265 RawObject* raw = Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld); 7266 RawObject* raw = Object::Allocate(ICData::kInstanceKind,
7267 ICData::InstanceSize(),
7268 Heap::kOld);
7266 NoGCScope no_gc; 7269 NoGCScope no_gc;
7267 result ^= raw; 7270 result ^= raw;
7268 } 7271 }
7269 result.set_function(function); 7272 result.set_function(function);
7270 result.set_target_name(target_name); 7273 result.set_target_name(target_name);
7271 result.set_id(id); 7274 result.set_id(id);
7272 result.set_num_args_tested(num_args_tested); 7275 result.set_num_args_tested(num_args_tested);
7273 // Number of array elements in one test entry (num_args_tested + 1) 7276 // Number of array elements in one test entry (num_args_tested + 1)
7274 intptr_t len = result.TestEntryLength(); 7277 intptr_t len = result.TestEntryLength();
7275 // IC data array must be null terminated (sentinel entry). 7278 // IC data array must be null terminated (sentinel entry).
7276 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); 7279 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld));
7277 result.set_ic_data(ic_data); 7280 result.set_ic_data(ic_data);
7278 return result.raw(); 7281 return result.raw();
7279 } 7282 }
7280 7283
7281 7284
7282 RawSubtypeTestCache* SubtypeTestCache::New() { 7285 RawSubtypeTestCache* SubtypeTestCache::New() {
7283 const Class& cls = Class::Handle(Object::subtypetestcache_class()); 7286 ASSERT(Object::subtypetestcache_class() != Class::null());
7284 ASSERT(!cls.IsNull());
7285 SubtypeTestCache& result = SubtypeTestCache::Handle(); 7287 SubtypeTestCache& result = SubtypeTestCache::Handle();
7286 { 7288 {
7287 // SubtypeTestCache objects are long living objects, allocate them in the 7289 // SubtypeTestCache objects are long living objects, allocate them in the
7288 // old generation. 7290 // old generation.
7289 RawObject* raw = 7291 RawObject* raw = Object::Allocate(SubtypeTestCache::kInstanceKind,
7290 Object::Allocate(cls, SubtypeTestCache::InstanceSize(), Heap::kOld); 7292 SubtypeTestCache::InstanceSize(),
7293 Heap::kOld);
7291 NoGCScope no_gc; 7294 NoGCScope no_gc;
7292 result ^= raw; 7295 result ^= raw;
7293 } 7296 }
7294 const Array& cache = Array::Handle(Array::New(kTestEntryLength)); 7297 const Array& cache = Array::Handle(Array::New(kTestEntryLength));
7295 result.set_cache(cache); 7298 result.set_cache(cache);
7296 return result.raw(); 7299 return result.raw();
7297 } 7300 }
7298 7301
7299 7302
7300 void SubtypeTestCache::set_cache(const Array& value) const { 7303 void SubtypeTestCache::set_cache(const Array& value) const {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
7358 7361
7359 7362
7360 const char* Error::ToCString() const { 7363 const char* Error::ToCString() const {
7361 // Error is an abstract class. We should never reach here. 7364 // Error is an abstract class. We should never reach here.
7362 UNREACHABLE(); 7365 UNREACHABLE();
7363 return "Error"; 7366 return "Error";
7364 } 7367 }
7365 7368
7366 7369
7367 RawApiError* ApiError::New(const String& message, Heap::Space space) { 7370 RawApiError* ApiError::New(const String& message, Heap::Space space) {
7368 const Class& cls = Class::Handle(Object::api_error_class()); 7371 ASSERT(Object::api_error_class() != Class::null());
7369 ApiError& result = ApiError::Handle(); 7372 ApiError& result = ApiError::Handle();
7370 { 7373 {
7371 RawObject* raw = Object::Allocate(cls, 7374 RawObject* raw = Object::Allocate(ApiError::kInstanceKind,
7372 ApiError::InstanceSize(), 7375 ApiError::InstanceSize(),
7373 space); 7376 space);
7374 NoGCScope no_gc; 7377 NoGCScope no_gc;
7375 result ^= raw; 7378 result ^= raw;
7376 } 7379 }
7377 result.set_message(message); 7380 result.set_message(message);
7378 return result.raw(); 7381 return result.raw();
7379 } 7382 }
7380 7383
7381 7384
7382 void ApiError::set_message(const String& message) const { 7385 void ApiError::set_message(const String& message) const {
7383 StorePointer(&raw_ptr()->message_, message.raw()); 7386 StorePointer(&raw_ptr()->message_, message.raw());
7384 } 7387 }
7385 7388
7386 7389
7387 const char* ApiError::ToErrorCString() const { 7390 const char* ApiError::ToErrorCString() const {
7388 const String& msg_str = String::Handle(message()); 7391 const String& msg_str = String::Handle(message());
7389 return msg_str.ToCString(); 7392 return msg_str.ToCString();
7390 } 7393 }
7391 7394
7392 7395
7393 const char* ApiError::ToCString() const { 7396 const char* ApiError::ToCString() const {
7394 return "ApiError"; 7397 return "ApiError";
7395 } 7398 }
7396 7399
7397 7400
7398 RawLanguageError* LanguageError::New(const String& message, Heap::Space space) { 7401 RawLanguageError* LanguageError::New(const String& message, Heap::Space space) {
7399 const Class& cls = Class::Handle(Object::language_error_class()); 7402 ASSERT(Object::language_error_class() != Class::null());
7400 LanguageError& result = LanguageError::Handle(); 7403 LanguageError& result = LanguageError::Handle();
7401 { 7404 {
7402 RawObject* raw = Object::Allocate(cls, 7405 RawObject* raw = Object::Allocate(LanguageError::kInstanceKind,
7403 LanguageError::InstanceSize(), 7406 LanguageError::InstanceSize(),
7404 space); 7407 space);
7405 NoGCScope no_gc; 7408 NoGCScope no_gc;
7406 result ^= raw; 7409 result ^= raw;
7407 } 7410 }
7408 result.set_message(message); 7411 result.set_message(message);
7409 return result.raw(); 7412 return result.raw();
7410 } 7413 }
7411 7414
7412 7415
7413 void LanguageError::set_message(const String& message) const { 7416 void LanguageError::set_message(const String& message) const {
7414 StorePointer(&raw_ptr()->message_, message.raw()); 7417 StorePointer(&raw_ptr()->message_, message.raw());
7415 } 7418 }
7416 7419
7417 7420
7418 const char* LanguageError::ToErrorCString() const { 7421 const char* LanguageError::ToErrorCString() const {
7419 const String& msg_str = String::Handle(message()); 7422 const String& msg_str = String::Handle(message());
7420 return msg_str.ToCString(); 7423 return msg_str.ToCString();
7421 } 7424 }
7422 7425
7423 7426
7424 const char* LanguageError::ToCString() const { 7427 const char* LanguageError::ToCString() const {
7425 return "LanguageError"; 7428 return "LanguageError";
7426 } 7429 }
7427 7430
7428 7431
7429 RawUnhandledException* UnhandledException::New(const Instance& exception, 7432 RawUnhandledException* UnhandledException::New(const Instance& exception,
7430 const Instance& stacktrace, 7433 const Instance& stacktrace,
7431 Heap::Space space) { 7434 Heap::Space space) {
7432 const Class& cls = Class::Handle(Object::unhandled_exception_class()); 7435 ASSERT(Object::unhandled_exception_class() != Class::null());
7433 UnhandledException& result = UnhandledException::Handle(); 7436 UnhandledException& result = UnhandledException::Handle();
7434 { 7437 {
7435 RawObject* raw = Object::Allocate(cls, 7438 RawObject* raw = Object::Allocate(UnhandledException::kInstanceKind,
7436 UnhandledException::InstanceSize(), 7439 UnhandledException::InstanceSize(),
7437 space); 7440 space);
7438 NoGCScope no_gc; 7441 NoGCScope no_gc;
7439 result ^= raw; 7442 result ^= raw;
7440 } 7443 }
7441 result.set_exception(exception); 7444 result.set_exception(exception);
7442 result.set_stacktrace(stacktrace); 7445 result.set_stacktrace(stacktrace);
7443 return result.raw(); 7446 return result.raw();
7444 } 7447 }
7445 7448
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
7483 return chars; 7486 return chars;
7484 } 7487 }
7485 7488
7486 7489
7487 const char* UnhandledException::ToCString() const { 7490 const char* UnhandledException::ToCString() const {
7488 return "UnhandledException"; 7491 return "UnhandledException";
7489 } 7492 }
7490 7493
7491 7494
7492 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { 7495 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) {
7493 const Class& cls = Class::Handle(Object::unwind_error_class()); 7496 ASSERT(Object::unwind_error_class() != Class::null());
7494 UnwindError& result = UnwindError::Handle(); 7497 UnwindError& result = UnwindError::Handle();
7495 { 7498 {
7496 RawObject* raw = Object::Allocate(cls, 7499 RawObject* raw = Object::Allocate(UnwindError::kInstanceKind,
7497 UnwindError::InstanceSize(), 7500 UnwindError::InstanceSize(),
7498 space); 7501 space);
7499 NoGCScope no_gc; 7502 NoGCScope no_gc;
7500 result ^= raw; 7503 result ^= raw;
7501 } 7504 }
7502 result.set_message(message); 7505 result.set_message(message);
7503 return result.raw(); 7506 return result.raw();
7504 } 7507 }
7505 7508
7506 7509
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
7710 const Class& cls = Class::Handle(clazz()); 7713 const Class& cls = Class::Handle(clazz());
7711 return (index >= 0 && index < cls.num_native_fields()); 7714 return (index >= 0 && index < cls.num_native_fields());
7712 } 7715 }
7713 7716
7714 7717
7715 RawInstance* Instance::New(const Class& cls, Heap::Space space) { 7718 RawInstance* Instance::New(const Class& cls, Heap::Space space) {
7716 Instance& result = Instance::Handle(); 7719 Instance& result = Instance::Handle();
7717 { 7720 {
7718 intptr_t instance_size = cls.instance_size(); 7721 intptr_t instance_size = cls.instance_size();
7719 ASSERT(instance_size > 0); 7722 ASSERT(instance_size > 0);
7720 RawObject* raw = Object::Allocate(cls, instance_size, space); 7723 RawObject* raw = Object::Allocate(cls.id(), instance_size, space);
7721 NoGCScope no_gc; 7724 NoGCScope no_gc;
7722 result ^= raw; 7725 result ^= raw;
7723 uword addr = reinterpret_cast<uword>(result.raw_ptr()); 7726 uword addr = reinterpret_cast<uword>(result.raw_ptr());
7724 // Initialize fields. 7727 // Initialize fields.
7725 intptr_t offset = sizeof(RawObject); 7728 intptr_t offset = sizeof(RawObject);
7726 // Initialize all native fields to NULL. 7729 // Initialize all native fields to NULL.
7727 for (intptr_t i = 0; i < cls.num_native_fields(); i++) { 7730 for (intptr_t i = 0; i < cls.num_native_fields(); i++) {
7728 *reinterpret_cast<uword*>(addr + offset) = 0; 7731 *reinterpret_cast<uword*>(addr + offset) = 0;
7729 offset += kWordSize; 7732 offset += kWordSize;
7730 } 7733 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
7900 7903
7901 7904
7902 void Mint::set_value(int64_t value) const { 7905 void Mint::set_value(int64_t value) const {
7903 raw_ptr()->value_ = value; 7906 raw_ptr()->value_ = value;
7904 } 7907 }
7905 7908
7906 7909
7907 RawMint* Mint::New(int64_t val, Heap::Space space) { 7910 RawMint* Mint::New(int64_t val, Heap::Space space) {
7908 // Do not allocate a Mint if Smi would do. 7911 // Do not allocate a Mint if Smi would do.
7909 ASSERT(!Smi::IsValid64(val)); 7912 ASSERT(!Smi::IsValid64(val));
7910 Isolate* isolate = Isolate::Current(); 7913 ASSERT(Isolate::Current()->object_store()->mint_class() != Class::null());
7911 const Class& cls =
7912 Class::Handle(isolate->object_store()->mint_class());
7913 Mint& result = Mint::Handle(); 7914 Mint& result = Mint::Handle();
7914 { 7915 {
7915 RawObject* raw = Object::Allocate(cls, Mint::InstanceSize(), space); 7916 RawObject* raw = Object::Allocate(Mint::kInstanceKind,
7917 Mint::InstanceSize(),
7918 space);
7916 NoGCScope no_gc; 7919 NoGCScope no_gc;
7917 result ^= raw; 7920 result ^= raw;
7918 } 7921 }
7919 result.set_value(val); 7922 result.set_value(val);
7920 return result.raw(); 7923 return result.raw();
7921 } 7924 }
7922 7925
7923 7926
7924 RawMint* Mint::NewCanonical(int64_t value) { 7927 RawMint* Mint::NewCanonical(int64_t value) {
7925 // Do not allocate a Mint if Smi would do. 7928 // Do not allocate a Mint if Smi would do.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
8028 return true; // "===". 8031 return true; // "===".
8029 } 8032 }
8030 if (other.IsNull() || !other.IsDouble()) { 8033 if (other.IsNull() || !other.IsDouble()) {
8031 return false; 8034 return false;
8032 } 8035 }
8033 return EqualsToDouble(Double::Cast(other).value()); 8036 return EqualsToDouble(Double::Cast(other).value());
8034 } 8037 }
8035 8038
8036 8039
8037 RawDouble* Double::New(double d, Heap::Space space) { 8040 RawDouble* Double::New(double d, Heap::Space space) {
8038 Isolate* isolate = Isolate::Current(); 8041 ASSERT(Isolate::Current()->object_store()->double_class() != Class::null());
8039 const Class& cls =
8040 Class::Handle(isolate->object_store()->double_class());
8041 Double& result = Double::Handle(); 8042 Double& result = Double::Handle();
8042 { 8043 {
8043 RawObject* raw = Object::Allocate(cls, Double::InstanceSize(), space); 8044 RawObject* raw = Object::Allocate(Double::kInstanceKind,
8045 Double::InstanceSize(),
8046 space);
8044 NoGCScope no_gc; 8047 NoGCScope no_gc;
8045 result ^= raw; 8048 result ^= raw;
8046 } 8049 }
8047 result.set_value(d); 8050 result.set_value(d);
8048 return result.raw(); 8051 return result.raw();
8049 } 8052 }
8050 8053
8051 8054
8052 static bool IsWhiteSpace(char ch) { 8055 static bool IsWhiteSpace(char ch) {
8053 return ch == '\0' || ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t'; 8056 return ch == '\0' || ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t';
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
8189 } 8192 }
8190 if (this->IsNegative() == other.IsNegative()) { 8193 if (this->IsNegative() == other.IsNegative()) {
8191 return this->IsNegative() ? -1 : 1; 8194 return this->IsNegative() ? -1 : 1;
8192 } 8195 }
8193 return this->IsNegative() ? -1 : 1; 8196 return this->IsNegative() ? -1 : 1;
8194 } 8197 }
8195 8198
8196 8199
8197 RawBigint* Bigint::Allocate(intptr_t length, Heap::Space space) { 8200 RawBigint* Bigint::Allocate(intptr_t length, Heap::Space space) {
8198 ASSERT(length >= 0); 8201 ASSERT(length >= 0);
8199 Isolate* isolate = Isolate::Current(); 8202 ASSERT(Isolate::Current()->object_store()->bigint_class() != Class::null());
8200 const Class& cls = Class::Handle(isolate->object_store()->bigint_class());
8201 Bigint& result = Bigint::Handle(); 8203 Bigint& result = Bigint::Handle();
8202 { 8204 {
8203 RawObject* raw = Object::Allocate(cls, Bigint::InstanceSize(length), space); 8205 RawObject* raw = Object::Allocate(Bigint::kInstanceKind,
8206 Bigint::InstanceSize(length),
8207 space);
8204 NoGCScope no_gc; 8208 NoGCScope no_gc;
8205 result ^= raw; 8209 result ^= raw;
8206 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated. 8210 result.raw_ptr()->allocated_length_ = length; // Chunk length allocated.
8207 result.raw_ptr()->signed_length_ = length; // Chunk length in use. 8211 result.raw_ptr()->signed_length_ = length; // Chunk length in use.
8208 } 8212 }
8209 return result.raw(); 8213 return result.raw();
8210 } 8214 }
8211 8215
8212 8216
8213 static uword ZoneAllocator(intptr_t size) { 8217 static uword ZoneAllocator(intptr_t size) {
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
8772 return NewSymbol(characters, len); 8776 return NewSymbol(characters, len);
8773 } 8777 }
8774 ASSERT(width == 4); 8778 ASSERT(width == 4);
8775 uint32_t* characters = reinterpret_cast<uint32_t*>(zone->Allocate(size)); 8779 uint32_t* characters = reinterpret_cast<uint32_t*>(zone->Allocate(size));
8776 Utf8::Decode(str, characters, len); 8780 Utf8::Decode(str, characters, len);
8777 return NewSymbol(characters, len); 8781 return NewSymbol(characters, len);
8778 } 8782 }
8779 8783
8780 8784
8781 template<typename T> 8785 template<typename T>
8782 RawString* String::NewSymbol(const T* characters, intptr_t len) { 8786 RawString* String::NewSymbol(const T* characters, intptr_t len) {
Ivan Posva 2012/07/18 04:09:22 This needs to take the symbols in the VM isolate i
siva 2012/07/19 01:12:34 Reworked the code to account for symbols in the vm
8783 Isolate* isolate = Isolate::Current(); 8787 Isolate* isolate = Isolate::Current();
8784 8788
8785 // Calculate the String hash for this sequence of characters. 8789 // Calculate the String hash for this sequence of characters.
8786 intptr_t hash = Hash(characters, len); 8790 intptr_t hash = Hash(characters, len);
8787 8791
8788 const Array& symbol_table = 8792 const Array& symbol_table =
8789 Array::Handle(isolate, isolate->object_store()->symbol_table()); 8793 Array::Handle(isolate, isolate->object_store()->symbol_table());
8790 // Last element of the array is the number of used elements. 8794 // Last element of the array is the number of used elements.
8791 intptr_t table_size = symbol_table.Length() - 1; 8795 intptr_t table_size = symbol_table.Length() - 1;
8792 intptr_t index = hash % table_size; 8796 intptr_t index = hash % table_size;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
9101 } 9105 }
9102 9106
9103 // We have reached the end of mangled_name string. 9107 // We have reached the end of mangled_name string.
9104 ASSERT(pos == len); 9108 ASSERT(pos == len);
9105 return (name_pos == name_len); 9109 return (name_pos == name_len);
9106 } 9110 }
9107 9111
9108 9112
9109 RawOneByteString* OneByteString::New(intptr_t len, 9113 RawOneByteString* OneByteString::New(intptr_t len,
9110 Heap::Space space) { 9114 Heap::Space space) {
9111 Isolate* isolate = Isolate::Current(); 9115 ASSERT(Isolate::Current() == Dart::vm_isolate() ||
9112 9116 Isolate::Current()->object_store()->one_byte_string_class() !=
9113 const Class& cls = 9117 Class::null());
9114 Class::Handle(isolate->object_store()->one_byte_string_class());
9115 OneByteString& result = OneByteString::Handle(); 9118 OneByteString& result = OneByteString::Handle();
9116 { 9119 {
9117 RawObject* raw = Object::Allocate(cls, 9120 RawObject* raw = Object::Allocate(OneByteString::kInstanceKind,
9118 OneByteString::InstanceSize(len), 9121 OneByteString::InstanceSize(len),
9119 space); 9122 space);
9120 NoGCScope no_gc; 9123 NoGCScope no_gc;
9121 result ^= raw; 9124 result ^= raw;
9122 result.SetLength(len); 9125 result.SetLength(len);
9123 result.SetHash(0); 9126 result.SetHash(0);
9124 } 9127 }
9125 return result.raw(); 9128 return result.raw();
9126 } 9129 }
9127 9130
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
9242 } 9245 }
9243 } 9246 }
9244 return dststr.raw(); 9247 return dststr.raw();
9245 } 9248 }
9246 return TwoByteString::null(); 9249 return TwoByteString::null();
9247 } 9250 }
9248 9251
9249 9252
9250 RawTwoByteString* TwoByteString::New(intptr_t len, 9253 RawTwoByteString* TwoByteString::New(intptr_t len,
9251 Heap::Space space) { 9254 Heap::Space space) {
9252 Isolate* isolate = Isolate::Current(); 9255 ASSERT(Isolate::Current()->object_store()->two_byte_string_class());
9253
9254 const Class& cls =
9255 Class::Handle(isolate->object_store()->two_byte_string_class());
9256 TwoByteString& result = TwoByteString::Handle(); 9256 TwoByteString& result = TwoByteString::Handle();
9257 { 9257 {
9258 RawObject* raw = Object::Allocate(cls, 9258 RawObject* raw = Object::Allocate(TwoByteString::kInstanceKind,
9259 TwoByteString::InstanceSize(len), 9259 TwoByteString::InstanceSize(len),
9260 space); 9260 space);
9261 NoGCScope no_gc; 9261 NoGCScope no_gc;
9262 result ^= raw; 9262 result ^= raw;
9263 result.SetLength(len); 9263 result.SetLength(len);
9264 result.SetHash(0); 9264 result.SetHash(0);
9265 } 9265 }
9266 return result.raw(); 9266 return result.raw();
9267 } 9267 }
9268 9268
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
9373 } 9373 }
9374 } 9374 }
9375 return dststr.raw(); 9375 return dststr.raw();
9376 } 9376 }
9377 return FourByteString::null(); 9377 return FourByteString::null();
9378 } 9378 }
9379 9379
9380 9380
9381 RawFourByteString* FourByteString::New(intptr_t len, 9381 RawFourByteString* FourByteString::New(intptr_t len,
9382 Heap::Space space) { 9382 Heap::Space space) {
9383 Isolate* isolate = Isolate::Current(); 9383 ASSERT(Isolate::Current()->object_store()->four_byte_string_class() !=
9384 9384 Class::null());
9385 const Class& cls =
9386 Class::Handle(isolate->object_store()->four_byte_string_class());
9387 FourByteString& result = FourByteString::Handle(); 9385 FourByteString& result = FourByteString::Handle();
9388 { 9386 {
9389 RawObject* raw = Object::Allocate(cls, 9387 RawObject* raw = Object::Allocate(FourByteString::kInstanceKind,
9390 FourByteString::InstanceSize(len), 9388 FourByteString::InstanceSize(len),
9391 space); 9389 space);
9392 NoGCScope no_gc; 9390 NoGCScope no_gc;
9393 result ^= raw; 9391 result ^= raw;
9394 result.SetLength(len); 9392 result.SetLength(len);
9395 result.SetHash(0); 9393 result.SetHash(0);
9396 } 9394 }
9397 return result.raw(); 9395 return result.raw();
9398 } 9396 }
9399 9397
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
9482 weak_ref->set_callback(callback); 9480 weak_ref->set_callback(callback);
9483 } 9481 }
9484 9482
9485 9483
9486 RawExternalOneByteString* ExternalOneByteString::New( 9484 RawExternalOneByteString* ExternalOneByteString::New(
9487 const uint8_t* data, 9485 const uint8_t* data,
9488 intptr_t len, 9486 intptr_t len,
9489 void* peer, 9487 void* peer,
9490 Dart_PeerFinalizer callback, 9488 Dart_PeerFinalizer callback,
9491 Heap::Space space) { 9489 Heap::Space space) {
9492 Isolate* isolate = Isolate::Current(); 9490 ASSERT(Isolate::Current()->object_store()->external_one_byte_string_class() !=
9493 9491 Class::null());
9494 const Class& cls =
9495 Class::Handle(isolate->object_store()->external_one_byte_string_class());
9496 ExternalOneByteString& result = ExternalOneByteString::Handle(); 9492 ExternalOneByteString& result = ExternalOneByteString::Handle();
9497 ExternalStringData<uint8_t>* external_data = 9493 ExternalStringData<uint8_t>* external_data =
9498 new ExternalStringData<uint8_t>(data, peer, callback); 9494 new ExternalStringData<uint8_t>(data, peer, callback);
9499 { 9495 {
9500 RawObject* raw = Object::Allocate(cls, 9496 RawObject* raw = Object::Allocate(ExternalOneByteString::kInstanceKind,
9501 ExternalOneByteString::InstanceSize(), 9497 ExternalOneByteString::InstanceSize(),
9502 space); 9498 space);
9503 NoGCScope no_gc; 9499 NoGCScope no_gc;
9504 result ^= raw; 9500 result ^= raw;
9505 result.SetLength(len); 9501 result.SetLength(len);
9506 result.SetHash(0); 9502 result.SetHash(0);
9507 result.SetExternalData(external_data); 9503 result.SetExternalData(external_data);
9508 } 9504 }
9509 AddFinalizer(result, external_data, ExternalOneByteString::Finalize); 9505 AddFinalizer(result, external_data, ExternalOneByteString::Finalize);
9510 return result.raw(); 9506 return result.raw();
(...skipping 20 matching lines...) Expand all
9531 return String::ToCString(); 9527 return String::ToCString();
9532 } 9528 }
9533 9529
9534 9530
9535 RawExternalTwoByteString* ExternalTwoByteString::New( 9531 RawExternalTwoByteString* ExternalTwoByteString::New(
9536 const uint16_t* data, 9532 const uint16_t* data,
9537 intptr_t len, 9533 intptr_t len,
9538 void* peer, 9534 void* peer,
9539 Dart_PeerFinalizer callback, 9535 Dart_PeerFinalizer callback,
9540 Heap::Space space) { 9536 Heap::Space space) {
9541 Isolate* isolate = Isolate::Current(); 9537 ASSERT(Isolate::Current()->object_store()->external_two_byte_string_class() !=
9542 9538 Class::null());
9543 const Class& cls =
9544 Class::Handle(isolate->object_store()->external_two_byte_string_class());
9545 ExternalTwoByteString& result = ExternalTwoByteString::Handle(); 9539 ExternalTwoByteString& result = ExternalTwoByteString::Handle();
9546 ExternalStringData<uint16_t>* external_data = 9540 ExternalStringData<uint16_t>* external_data =
9547 new ExternalStringData<uint16_t>(data, peer, callback); 9541 new ExternalStringData<uint16_t>(data, peer, callback);
9548 { 9542 {
9549 RawObject* raw = Object::Allocate(cls, 9543 RawObject* raw = Object::Allocate(ExternalTwoByteString::kInstanceKind,
9550 ExternalTwoByteString::InstanceSize(), 9544 ExternalTwoByteString::InstanceSize(),
9551 space); 9545 space);
9552 NoGCScope no_gc; 9546 NoGCScope no_gc;
9553 result ^= raw; 9547 result ^= raw;
9554 result.SetLength(len); 9548 result.SetLength(len);
9555 result.SetHash(0); 9549 result.SetHash(0);
9556 result.SetExternalData(external_data); 9550 result.SetExternalData(external_data);
9557 } 9551 }
9558 AddFinalizer(result, external_data, ExternalTwoByteString::Finalize); 9552 AddFinalizer(result, external_data, ExternalTwoByteString::Finalize);
9559 return result.raw(); 9553 return result.raw();
(...skipping 10 matching lines...) Expand all
9570 return String::ToCString(); 9564 return String::ToCString();
9571 } 9565 }
9572 9566
9573 9567
9574 RawExternalFourByteString* ExternalFourByteString::New( 9568 RawExternalFourByteString* ExternalFourByteString::New(
9575 const uint32_t* data, 9569 const uint32_t* data,
9576 intptr_t len, 9570 intptr_t len,
9577 void* peer, 9571 void* peer,
9578 Dart_PeerFinalizer callback, 9572 Dart_PeerFinalizer callback,
9579 Heap::Space space) { 9573 Heap::Space space) {
9580 Isolate* isolate = Isolate::Current(); 9574 ASSERT(Isolate::Current()->object_store()->
9581 9575 external_four_byte_string_class() != Class::null());
9582 const Class& cls =
9583 Class::Handle(isolate->object_store()->external_four_byte_string_class());
9584 ExternalFourByteString& result = ExternalFourByteString::Handle(); 9576 ExternalFourByteString& result = ExternalFourByteString::Handle();
9585 ExternalStringData<uint32_t>* external_data = 9577 ExternalStringData<uint32_t>* external_data =
9586 new ExternalStringData<uint32_t>(data, peer, callback); 9578 new ExternalStringData<uint32_t>(data, peer, callback);
9587 { 9579 {
9588 RawObject* raw = Object::Allocate(cls, 9580 RawObject* raw = Object::Allocate(ExternalFourByteString::kInstanceKind,
9589 ExternalFourByteString::InstanceSize(), 9581 ExternalFourByteString::InstanceSize(),
9590 space); 9582 space);
9591 NoGCScope no_gc; 9583 NoGCScope no_gc;
9592 result ^= raw; 9584 result ^= raw;
9593 result.SetLength(len); 9585 result.SetLength(len);
9594 result.SetHash(0); 9586 result.SetHash(0);
9595 result.SetExternalData(external_data); 9587 result.SetExternalData(external_data);
9596 } 9588 }
9597 AddFinalizer(result, external_data, ExternalFourByteString::Finalize); 9589 AddFinalizer(result, external_data, ExternalFourByteString::Finalize);
9598 return result.raw(); 9590 return result.raw();
(...skipping 15 matching lines...) Expand all
9614 return Isolate::Current()->object_store()->true_value(); 9606 return Isolate::Current()->object_store()->true_value();
9615 } 9607 }
9616 9608
9617 9609
9618 RawBool* Bool::False() { 9610 RawBool* Bool::False() {
9619 return Isolate::Current()->object_store()->false_value(); 9611 return Isolate::Current()->object_store()->false_value();
9620 } 9612 }
9621 9613
9622 9614
9623 RawBool* Bool::New(bool value) { 9615 RawBool* Bool::New(bool value) {
9624 Isolate* isolate = Isolate::Current(); 9616 ASSERT(Isolate::Current()->object_store()->bool_class() != Class::null());
9625
9626 const Class& cls = Class::Handle(isolate->object_store()->bool_class());
9627 Bool& result = Bool::Handle(); 9617 Bool& result = Bool::Handle();
9628 { 9618 {
9629 // Since the two boolean instances are singletons we allocate them straight 9619 // Since the two boolean instances are singletons we allocate them straight
9630 // in the old generation. 9620 // in the old generation.
9631 RawObject* raw = Object::Allocate(cls, Bool::InstanceSize(), Heap::kOld); 9621 RawObject* raw = Object::Allocate(Bool::kInstanceKind,
9622 Bool::InstanceSize(),
9623 Heap::kOld);
9632 NoGCScope no_gc; 9624 NoGCScope no_gc;
9633 result ^= raw; 9625 result ^= raw;
9634 } 9626 }
9635 result.set_value(value); 9627 result.set_value(value);
9636 return result.raw(); 9628 return result.raw();
9637 } 9629 }
9638 9630
9639 9631
9640 const char* Bool::ToCString() const { 9632 const char* Bool::ToCString() const {
9641 return value() ? "true" : "false"; 9633 return value() ? "true" : "false";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
9684 9676
9685 RawArray* Array::New(const Class& cls, intptr_t len, Heap::Space space) { 9677 RawArray* Array::New(const Class& cls, intptr_t len, Heap::Space space) {
9686 if ((len < 0) || (len > kMaxArrayElements)) { 9678 if ((len < 0) || (len > kMaxArrayElements)) {
9687 // TODO(srdjan): Verify that illegal argument is the right thing to throw. 9679 // TODO(srdjan): Verify that illegal argument is the right thing to throw.
9688 GrowableArray<const Object*> args; 9680 GrowableArray<const Object*> args;
9689 args.Add(&Smi::Handle(Smi::New(len))); 9681 args.Add(&Smi::Handle(Smi::New(len)));
9690 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); 9682 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args);
9691 } 9683 }
9692 Array& result = Array::Handle(); 9684 Array& result = Array::Handle();
9693 { 9685 {
9694 RawObject* raw = Object::Allocate(cls, 9686 RawObject* raw = Object::Allocate(cls.id(),
9695 Array::InstanceSize(len), 9687 Array::InstanceSize(len),
9696 space); 9688 space);
9697 NoGCScope no_gc; 9689 NoGCScope no_gc;
9698 result ^= raw; 9690 result ^= raw;
9699 result.SetLength(len); 9691 result.SetLength(len);
9700 } 9692 }
9701 return result.raw(); 9693 return result.raw();
9702 } 9694 }
9703 9695
9704 9696
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
9901 9893
9902 RawGrowableObjectArray* GrowableObjectArray::New(intptr_t capacity, 9894 RawGrowableObjectArray* GrowableObjectArray::New(intptr_t capacity,
9903 Heap::Space space) { 9895 Heap::Space space) {
9904 const Array& data = Array::Handle(Array::New(capacity, space)); 9896 const Array& data = Array::Handle(Array::New(capacity, space));
9905 return New(data, space); 9897 return New(data, space);
9906 } 9898 }
9907 9899
9908 9900
9909 RawGrowableObjectArray* GrowableObjectArray::New(const Array& array, 9901 RawGrowableObjectArray* GrowableObjectArray::New(const Array& array,
9910 Heap::Space space) { 9902 Heap::Space space) {
9911 ObjectStore* object_store = Isolate::Current()->object_store(); 9903 ASSERT(Isolate::Current()->object_store()->growable_object_array_class()
9912 Class& cls = Class::Handle(object_store->growable_object_array_class()); 9904 != Class::null());
9913 GrowableObjectArray& result = GrowableObjectArray::Handle(); 9905 GrowableObjectArray& result = GrowableObjectArray::Handle();
9914 { 9906 {
9915 RawObject* raw = Object::Allocate(cls, 9907 RawObject* raw = Object::Allocate(GrowableObjectArray::kInstanceKind,
9916 GrowableObjectArray::InstanceSize(), 9908 GrowableObjectArray::InstanceSize(),
9917 space); 9909 space);
9918 NoGCScope no_gc; 9910 NoGCScope no_gc;
9919 result ^= raw; 9911 result ^= raw;
9920 result.SetLength(0); 9912 result.SetLength(0);
9921 result.SetData(array); 9913 result.SetData(array);
9922 } 9914 }
9923 return result.raw(); 9915 return result.raw();
9924 } 9916 }
9925 9917
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
9984 RawT* ByteArray::NewExternalImpl(const Class& cls, 9976 RawT* ByteArray::NewExternalImpl(const Class& cls,
9985 ElementT* data, 9977 ElementT* data,
9986 intptr_t len, 9978 intptr_t len,
9987 void* peer, 9979 void* peer,
9988 Dart_PeerFinalizer callback, 9980 Dart_PeerFinalizer callback,
9989 Heap::Space space) { 9981 Heap::Space space) {
9990 HandleT& result = HandleT::Handle(); 9982 HandleT& result = HandleT::Handle();
9991 ExternalByteArrayData<ElementT>* external_data = 9983 ExternalByteArrayData<ElementT>* external_data =
9992 new ExternalByteArrayData<ElementT>(data, peer, callback); 9984 new ExternalByteArrayData<ElementT>(data, peer, callback);
9993 { 9985 {
9994 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(), space); 9986 RawObject* raw = Object::Allocate(cls.id(), HandleT::InstanceSize(), space);
9995 NoGCScope no_gc; 9987 NoGCScope no_gc;
9996 result ^= raw; 9988 result ^= raw;
9997 result.SetLength(len); 9989 result.SetLength(len);
9998 result.SetExternalData(external_data); 9990 result.SetExternalData(external_data);
9999 } 9991 }
10000 AddFinalizer(result, external_data, ExternalByteArrayFinalize<ElementT>); 9992 AddFinalizer(result, external_data, ExternalByteArrayFinalize<ElementT>);
10001 return result.raw(); 9993 return result.raw();
10002 } 9994 }
10003 9995
10004 9996
(...skipping 15 matching lines...) Expand all
10020 // ByteArray is an abstract class. 10012 // ByteArray is an abstract class.
10021 UNREACHABLE(); 10013 UNREACHABLE();
10022 return "ByteArray"; 10014 return "ByteArray";
10023 } 10015 }
10024 10016
10025 10017
10026 template<typename HandleT, typename RawT> 10018 template<typename HandleT, typename RawT>
10027 RawT* ByteArray::NewImpl(const Class& cls, intptr_t len, Heap::Space space) { 10019 RawT* ByteArray::NewImpl(const Class& cls, intptr_t len, Heap::Space space) {
10028 HandleT& result = HandleT::Handle(); 10020 HandleT& result = HandleT::Handle();
10029 { 10021 {
10030 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space); 10022 RawObject* raw = Object::Allocate(cls.id(),
10023 HandleT::InstanceSize(len),
10024 space);
10031 NoGCScope no_gc; 10025 NoGCScope no_gc;
10032 result ^= raw; 10026 result ^= raw;
10033 result.SetLength(len); 10027 result.SetLength(len);
10034 if (len > 0) { 10028 if (len > 0) {
10035 memset(result.ByteAddr(0), 0, result.ByteLength()); 10029 memset(result.ByteAddr(0), 0, result.ByteLength());
10036 } 10030 }
10037 } 10031 }
10038 return result.raw(); 10032 return result.raw();
10039 } 10033 }
10040 10034
10041 10035
10042 template<typename HandleT, typename RawT, typename ElementT> 10036 template<typename HandleT, typename RawT, typename ElementT>
10043 RawT* ByteArray::NewImpl(const Class& cls, 10037 RawT* ByteArray::NewImpl(const Class& cls,
10044 const ElementT* data, 10038 const ElementT* data,
10045 intptr_t len, 10039 intptr_t len,
10046 Heap::Space space) { 10040 Heap::Space space) {
10047 HandleT& result = HandleT::Handle(); 10041 HandleT& result = HandleT::Handle();
10048 { 10042 {
10049 RawObject* raw = Object::Allocate(cls, HandleT::InstanceSize(len), space); 10043 RawObject* raw = Object::Allocate(cls.id(),
10044 HandleT::InstanceSize(len),
10045 space);
10050 NoGCScope no_gc; 10046 NoGCScope no_gc;
10051 result ^= raw; 10047 result ^= raw;
10052 result.SetLength(len); 10048 result.SetLength(len);
10053 if (len > 0) { 10049 if (len > 0) {
10054 memmove(result.ByteAddr(0), data, result.ByteLength()); 10050 memmove(result.ByteAddr(0), data, result.ByteLength());
10055 } 10051 }
10056 } 10052 }
10057 return result.raw(); 10053 return result.raw();
10058 } 10054 }
10059 10055
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
10471 10467
10472 RawClosure* Closure::New(const Function& function, 10468 RawClosure* Closure::New(const Function& function,
10473 const Context& context, 10469 const Context& context,
10474 Heap::Space space) { 10470 Heap::Space space) {
10475 Isolate* isolate = Isolate::Current(); 10471 Isolate* isolate = Isolate::Current();
10476 ASSERT(context.isolate() == isolate); 10472 ASSERT(context.isolate() == isolate);
10477 10473
10478 const Class& cls = Class::Handle(function.signature_class()); 10474 const Class& cls = Class::Handle(function.signature_class());
10479 Closure& result = Closure::Handle(); 10475 Closure& result = Closure::Handle();
10480 { 10476 {
10481 RawObject* raw = Object::Allocate(cls, Closure::InstanceSize(), space); 10477 RawObject* raw = Object::Allocate(cls.id(), Closure::InstanceSize(), space);
10482 NoGCScope no_gc; 10478 NoGCScope no_gc;
10483 result ^= raw; 10479 result ^= raw;
10484 } 10480 }
10485 result.set_function(function); 10481 result.set_function(function);
10486 result.set_context(context); 10482 result.set_context(context);
10487 return result.raw(); 10483 return result.raw();
10488 } 10484 }
10489 10485
10490 10486
10491 void Closure::set_context(const Context& value) const { 10487 void Closure::set_context(const Context& value) const {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
10569 function_array.SetAt((index + i), function); 10565 function_array.SetAt((index + i), function);
10570 code_array.SetAt((index + i), code); 10566 code_array.SetAt((index + i), code);
10571 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint()); 10567 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint());
10572 pc_offset_array.SetAt((index + i), pc_offset); 10568 pc_offset_array.SetAt((index + i), pc_offset);
10573 } 10569 }
10574 } 10570 }
10575 10571
10576 10572
10577 RawStacktrace* Stacktrace::New(const GrowableArray<uword>& stack_frame_pcs, 10573 RawStacktrace* Stacktrace::New(const GrowableArray<uword>& stack_frame_pcs,
10578 Heap::Space space) { 10574 Heap::Space space) {
10579 const Class& cls = Class::Handle( 10575 ASSERT(Isolate::Current()->object_store()->stacktrace_class() !=
10580 Isolate::Current()->object_store()->stacktrace_class()); 10576 Class::null());
10581 Stacktrace& result = Stacktrace::Handle(); 10577 Stacktrace& result = Stacktrace::Handle();
10582 { 10578 {
10583 RawObject* raw = Object::Allocate(cls, 10579 RawObject* raw = Object::Allocate(Stacktrace::kInstanceKind,
10584 Stacktrace::InstanceSize(), 10580 Stacktrace::InstanceSize(),
10585 space); 10581 space);
10586 NoGCScope no_gc; 10582 NoGCScope no_gc;
10587 result ^= raw; 10583 result ^= raw;
10588 } 10584 }
10589 intptr_t length = stack_frame_pcs.length(); 10585 intptr_t length = stack_frame_pcs.length();
10590 // Create arrays for the function, code and pc_offset triplet for each frame. 10586 // Create arrays for the function, code and pc_offset triplet for each frame.
10591 const Array& function_array = Array::Handle(Array::New(length)); 10587 const Array& function_array = Array::Handle(Array::New(length));
10592 const Array& code_array = Array::Handle(Array::New(length)); 10588 const Array& code_array = Array::Handle(Array::New(length));
10593 const Array& pc_offset_array = Array::Handle(Array::New(length)); 10589 const Array& pc_offset_array = Array::Handle(Array::New(length));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
10696 StorePointer(&raw_ptr()->pattern_, pattern.raw()); 10692 StorePointer(&raw_ptr()->pattern_, pattern.raw());
10697 } 10693 }
10698 10694
10699 10695
10700 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { 10696 void JSRegExp::set_num_bracket_expressions(intptr_t value) const {
10701 raw_ptr()->num_bracket_expressions_ = Smi::New(value); 10697 raw_ptr()->num_bracket_expressions_ = Smi::New(value);
10702 } 10698 }
10703 10699
10704 10700
10705 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { 10701 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) {
10706 const Class& cls = Class::Handle( 10702 ASSERT(Isolate::Current()->object_store()->jsregexp_class() !=
10707 Isolate::Current()->object_store()->jsregexp_class()); 10703 Class::null());
10708 JSRegExp& result = JSRegExp::Handle(); 10704 JSRegExp& result = JSRegExp::Handle();
10709 { 10705 {
10710 RawObject* raw = Object::Allocate(cls, 10706 RawObject* raw = Object::Allocate(JSRegExp::kInstanceKind,
10711 JSRegExp::InstanceSize(len), 10707 JSRegExp::InstanceSize(len),
10712 space); 10708 space);
10713 NoGCScope no_gc; 10709 NoGCScope no_gc;
10714 result ^= raw; 10710 result ^= raw;
10715 result.set_type(kUnitialized); 10711 result.set_type(kUnitialized);
10716 result.set_flags(0); 10712 result.set_flags(0);
10717 result.SetLength(len); 10713 result.SetLength(len);
10718 } 10714 }
10719 return result.raw(); 10715 return result.raw();
10720 } 10716 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
10780 const String& str = String::Handle(pattern()); 10776 const String& str = String::Handle(pattern());
10781 const char* format = "JSRegExp: pattern=%s flags=%s"; 10777 const char* format = "JSRegExp: pattern=%s flags=%s";
10782 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10778 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10783 char* chars = reinterpret_cast<char*>( 10779 char* chars = reinterpret_cast<char*>(
10784 Isolate::Current()->current_zone()->Allocate(len + 1)); 10780 Isolate::Current()->current_zone()->Allocate(len + 1));
10785 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10781 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10786 return chars; 10782 return chars;
10787 } 10783 }
10788 10784
10789 } // namespace dart 10785 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/parser.cc » ('j') | vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698