| 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 "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" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 { | 271 { |
| 272 intptr_t size = Class::InstanceSize(); | 272 intptr_t size = Class::InstanceSize(); |
| 273 uword address = heap->Allocate(size, Heap::kOld); | 273 uword address = heap->Allocate(size, Heap::kOld); |
| 274 class_class_ = reinterpret_cast<RawClass*>(address + kHeapObjectTag); | 274 class_class_ = reinterpret_cast<RawClass*>(address + kHeapObjectTag); |
| 275 InitializeObject(address, Class::kInstanceKind, size); | 275 InitializeObject(address, Class::kInstanceKind, size); |
| 276 // Make the class_ field point to itself. | 276 // Make the class_ field point to itself. |
| 277 class_class_->ptr()->class_ = class_class_; | 277 class_class_->ptr()->class_ = class_class_; |
| 278 | 278 |
| 279 Class fake; | 279 Class fake; |
| 280 // Initialization from Class::New<Class>. | 280 // Initialization from Class::New<Class>. |
| 281 cls = class_class_; | 281 // Directly set raw_ to break a circular dependency: SetRaw will attempt |
| 282 // to lookup class class in the class table where it is not registered yet. |
| 283 cls.raw_ = class_class_; |
| 282 cls.set_handle_vtable(fake.vtable()); | 284 cls.set_handle_vtable(fake.vtable()); |
| 283 cls.set_instance_size(Class::InstanceSize()); | 285 cls.set_instance_size(Class::InstanceSize()); |
| 284 cls.set_next_field_offset(Class::InstanceSize()); | 286 cls.set_next_field_offset(Class::InstanceSize()); |
| 285 cls.set_instance_kind(Class::kInstanceKind); | 287 cls.set_instance_kind(Class::kInstanceKind); |
| 286 cls.set_index(Class::kInstanceKind); | 288 cls.set_index(Class::kInstanceKind); |
| 287 cls.raw_ptr()->is_const_ = false; | 289 cls.raw_ptr()->is_const_ = false; |
| 288 cls.raw_ptr()->is_interface_ = false; | 290 cls.raw_ptr()->is_interface_ = false; |
| 289 cls.set_is_finalized(); | 291 cls.set_is_finalized(); |
| 290 cls.raw_ptr()->type_arguments_instance_field_offset_ = | 292 cls.raw_ptr()->type_arguments_instance_field_offset_ = |
| 291 Class::kNoTypeArguments; | 293 Class::kNoTypeArguments; |
| (...skipping 9820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10112 const String& str = String::Handle(pattern()); | 10114 const String& str = String::Handle(pattern()); |
| 10113 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10115 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10114 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10116 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10115 char* chars = reinterpret_cast<char*>( | 10117 char* chars = reinterpret_cast<char*>( |
| 10116 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10118 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10117 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10119 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10118 return chars; | 10120 return chars; |
| 10119 } | 10121 } |
| 10120 | 10122 |
| 10121 } // namespace dart | 10123 } // namespace dart |
| OLD | NEW |