| 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 5924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5935 RawObject* raw = Object::Allocate(library_class, | 5935 RawObject* raw = Object::Allocate(library_class, |
| 5936 Library::InstanceSize(), | 5936 Library::InstanceSize(), |
| 5937 Heap::kOld); | 5937 Heap::kOld); |
| 5938 return reinterpret_cast<RawLibrary*>(raw); | 5938 return reinterpret_cast<RawLibrary*>(raw); |
| 5939 } | 5939 } |
| 5940 | 5940 |
| 5941 | 5941 |
| 5942 RawLibrary* Library::NewLibraryHelper(const String& url, | 5942 RawLibrary* Library::NewLibraryHelper(const String& url, |
| 5943 bool import_core_lib) { | 5943 bool import_core_lib) { |
| 5944 const Library& result = Library::Handle(Library::New()); | 5944 const Library& result = Library::Handle(Library::New()); |
| 5945 result.raw_ptr()->name_ = url.raw(); | 5945 result.StorePointer(&result.raw_ptr()->name_, url.raw()); |
| 5946 result.raw_ptr()->url_ = url.raw(); | 5946 result.StorePointer(&result.raw_ptr()->url_, url.raw()); |
| 5947 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); | 5947 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); |
| 5948 result.raw_ptr()->dictionary_ = Array::Empty(); | 5948 result.raw_ptr()->dictionary_ = Array::Empty(); |
| 5949 result.raw_ptr()->anonymous_classes_ = Array::Empty(); | 5949 result.raw_ptr()->anonymous_classes_ = Array::Empty(); |
| 5950 result.raw_ptr()->num_anonymous_ = 0; | 5950 result.raw_ptr()->num_anonymous_ = 0; |
| 5951 result.raw_ptr()->imports_ = Array::Empty(); | 5951 result.raw_ptr()->imports_ = Array::Empty(); |
| 5952 result.raw_ptr()->loaded_scripts_ = Array::null(); | 5952 result.raw_ptr()->loaded_scripts_ = Array::null(); |
| 5953 result.set_native_entry_resolver(NULL); | 5953 result.set_native_entry_resolver(NULL); |
| 5954 result.raw_ptr()->corelib_imported_ = true; | 5954 result.raw_ptr()->corelib_imported_ = true; |
| 5955 result.set_debuggable(false); | 5955 result.set_debuggable(false); |
| 5956 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; | 5956 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7703 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle(); | 7703 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle(); |
| 7704 type_arguments ^= *FieldAddrAtOffset(field_offset); | 7704 type_arguments ^= *FieldAddrAtOffset(field_offset); |
| 7705 return type_arguments.raw(); | 7705 return type_arguments.raw(); |
| 7706 } | 7706 } |
| 7707 | 7707 |
| 7708 | 7708 |
| 7709 void Instance::SetTypeArguments(const AbstractTypeArguments& value) const { | 7709 void Instance::SetTypeArguments(const AbstractTypeArguments& value) const { |
| 7710 const Class& cls = Class::Handle(clazz()); | 7710 const Class& cls = Class::Handle(clazz()); |
| 7711 intptr_t field_offset = cls.type_arguments_instance_field_offset(); | 7711 intptr_t field_offset = cls.type_arguments_instance_field_offset(); |
| 7712 ASSERT(field_offset != Class::kNoTypeArguments); | 7712 ASSERT(field_offset != Class::kNoTypeArguments); |
| 7713 *FieldAddrAtOffset(field_offset) = value.raw(); | 7713 SetFieldAtOffset(field_offset, value); |
| 7714 } | 7714 } |
| 7715 | 7715 |
| 7716 | 7716 |
| 7717 bool Instance::IsInstanceOf(const AbstractType& other, | 7717 bool Instance::IsInstanceOf(const AbstractType& other, |
| 7718 const AbstractTypeArguments& other_instantiator, | 7718 const AbstractTypeArguments& other_instantiator, |
| 7719 Error* malformed_error) const { | 7719 Error* malformed_error) const { |
| 7720 ASSERT(other.IsFinalized()); | 7720 ASSERT(other.IsFinalized()); |
| 7721 ASSERT(!other.IsDynamicType()); | 7721 ASSERT(!other.IsDynamicType()); |
| 7722 ASSERT(!other.IsMalformed()); | 7722 ASSERT(!other.IsMalformed()); |
| 7723 if (IsNull()) { | 7723 if (IsNull()) { |
| (...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10577 NoGCScope no_gc; | 10577 NoGCScope no_gc; |
| 10578 result ^= raw; | 10578 result ^= raw; |
| 10579 } | 10579 } |
| 10580 result.set_function(function); | 10580 result.set_function(function); |
| 10581 result.set_context(context); | 10581 result.set_context(context); |
| 10582 return result.raw(); | 10582 return result.raw(); |
| 10583 } | 10583 } |
| 10584 | 10584 |
| 10585 | 10585 |
| 10586 void Closure::set_context(const Context& value) const { | 10586 void Closure::set_context(const Context& value) const { |
| 10587 raw_ptr()->context_ = value.raw(); | 10587 StorePointer(&raw_ptr()->context_, value.raw()); |
| 10588 } | 10588 } |
| 10589 | 10589 |
| 10590 | 10590 |
| 10591 void Closure::set_function(const Function& value) const { | 10591 void Closure::set_function(const Function& value) const { |
| 10592 raw_ptr()->function_ = value.raw(); | 10592 StorePointer(&raw_ptr()->function_, value.raw()); |
| 10593 } | 10593 } |
| 10594 | 10594 |
| 10595 | 10595 |
| 10596 const char* Closure::ToCString() const { | 10596 const char* Closure::ToCString() const { |
| 10597 const Function& fun = Function::Handle(function()); | 10597 const Function& fun = Function::Handle(function()); |
| 10598 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); | 10598 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 10599 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); | 10599 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); |
| 10600 const char* from = is_implicit_closure ? " from " : ""; | 10600 const char* from = is_implicit_closure ? " from " : ""; |
| 10601 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; | 10601 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| 10602 const char* format = "Closure: %s%s%s"; | 10602 const char* format = "Closure: %s%s%s"; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10875 const String& str = String::Handle(pattern()); | 10875 const String& str = String::Handle(pattern()); |
| 10876 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10876 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10877 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10877 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10878 char* chars = reinterpret_cast<char*>( | 10878 char* chars = reinterpret_cast<char*>( |
| 10879 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10879 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10880 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10880 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10881 return chars; | 10881 return chars; |
| 10882 } | 10882 } |
| 10883 | 10883 |
| 10884 } // namespace dart | 10884 } // namespace dart |
| OLD | NEW |