| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 7578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7589 return value.raw() == Object::sentinel().raw(); | 7589 return value.raw() == Object::sentinel().raw(); |
| 7590 } | 7590 } |
| 7591 | 7591 |
| 7592 | 7592 |
| 7593 void Field::SetPrecompiledInitializer(const Function& initializer) const { | 7593 void Field::SetPrecompiledInitializer(const Function& initializer) const { |
| 7594 StorePointer(&raw_ptr()->initializer_.precompiled_, initializer.raw()); | 7594 StorePointer(&raw_ptr()->initializer_.precompiled_, initializer.raw()); |
| 7595 } | 7595 } |
| 7596 | 7596 |
| 7597 | 7597 |
| 7598 bool Field::HasPrecompiledInitializer() const { | 7598 bool Field::HasPrecompiledInitializer() const { |
| 7599 return raw_ptr()->initializer_.precompiled_->IsFunction(); | 7599 return raw_ptr()->initializer_.precompiled_->IsHeapObject() && |
| 7600 raw_ptr()->initializer_.precompiled_->IsFunction(); |
| 7600 } | 7601 } |
| 7601 | 7602 |
| 7602 | 7603 |
| 7603 void Field::SetSavedInitialStaticValue(const Instance& value) const { | 7604 void Field::SetSavedInitialStaticValue(const Instance& value) const { |
| 7605 ASSERT(!HasPrecompiledInitializer()); |
| 7604 StorePointer(&raw_ptr()->initializer_.saved_value_, value.raw()); | 7606 StorePointer(&raw_ptr()->initializer_.saved_value_, value.raw()); |
| 7605 } | 7607 } |
| 7606 | 7608 |
| 7607 | 7609 |
| 7608 void Field::EvaluateInitializer() const { | 7610 void Field::EvaluateInitializer() const { |
| 7609 ASSERT(is_static()); | 7611 ASSERT(is_static()); |
| 7610 if (StaticValue() == Object::sentinel().raw()) { | 7612 if (StaticValue() == Object::sentinel().raw()) { |
| 7611 SetStaticValue(Object::transition_sentinel()); | 7613 SetStaticValue(Object::transition_sentinel()); |
| 7612 Object& value = Object::Handle(Compiler::EvaluateStaticInitializer(*this)); | 7614 Object& value = Object::Handle(Compiler::EvaluateStaticInitializer(*this)); |
| 7613 if (value.IsError()) { | 7615 if (value.IsError()) { |
| 7614 SetStaticValue(Object::null_instance()); | 7616 SetStaticValue(Object::null_instance()); |
| 7615 Exceptions::PropagateError(Error::Cast(value)); | 7617 Exceptions::PropagateError(Error::Cast(value)); |
| 7616 UNREACHABLE(); | 7618 UNREACHABLE(); |
| 7617 } | 7619 } |
| 7618 ASSERT(value.IsNull() || value.IsInstance()); | 7620 ASSERT(value.IsNull() || value.IsInstance()); |
| 7619 SetStaticValue(value.IsNull() ? Instance::null_instance() | 7621 SetStaticValue(value.IsNull() ? Instance::null_instance() |
| 7620 : Instance::Cast(value)); | 7622 : Instance::Cast(value)); |
| 7621 return; | 7623 return; |
| 7622 } else if (StaticValue() == Object::transition_sentinel().raw()) { | 7624 } else if (StaticValue() == Object::transition_sentinel().raw()) { |
| 7623 SetStaticValue(Object::null_instance()); | 7625 SetStaticValue(Object::null_instance()); |
| 7624 const Array& ctor_args = Array::Handle(Array::New(1)); | 7626 const Array& ctor_args = Array::Handle(Array::New(1)); |
| 7625 const String& field_name = String::Handle(name()); | 7627 const String& field_name = String::Handle(name()); |
| 7626 ctor_args.SetAt(0, field_name); | 7628 ctor_args.SetAt(0, field_name); |
| 7627 Exceptions::ThrowByType(Exceptions::kCyclicInitializationError, ctor_args); | 7629 Exceptions::ThrowByType(Exceptions::kCyclicInitializationError, ctor_args); |
| 7628 UNREACHABLE(); | 7630 UNREACHABLE(); |
| 7629 return; | 7631 return; |
| 7630 } | 7632 } |
| (...skipping 13803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21434 return tag_label.ToCString(); | 21436 return tag_label.ToCString(); |
| 21435 } | 21437 } |
| 21436 | 21438 |
| 21437 | 21439 |
| 21438 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21440 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21439 Instance::PrintJSONImpl(stream, ref); | 21441 Instance::PrintJSONImpl(stream, ref); |
| 21440 } | 21442 } |
| 21441 | 21443 |
| 21442 | 21444 |
| 21443 } // namespace dart | 21445 } // namespace dart |
| OLD | NEW |