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 5525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5536 | 5536 |
5537 | 5537 |
5538 void Function::set_saved_args_desc(const Array& value) const { | 5538 void Function::set_saved_args_desc(const Array& value) const { |
5539 ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher || | 5539 ASSERT(kind() == RawFunction::kNoSuchMethodDispatcher || |
5540 kind() == RawFunction::kInvokeFieldDispatcher); | 5540 kind() == RawFunction::kInvokeFieldDispatcher); |
5541 ASSERT(raw_ptr()->data_ == Object::null()); | 5541 ASSERT(raw_ptr()->data_ == Object::null()); |
5542 set_data(value); | 5542 set_data(value); |
5543 } | 5543 } |
5544 | 5544 |
5545 | 5545 |
| 5546 RawField* Function::LookupImplicitGetterSetterField() const { |
| 5547 ASSERT((kind() == RawFunction::kImplicitGetter) || |
| 5548 (kind() == RawFunction::kImplicitSetter) || |
| 5549 (kind() == RawFunction::kImplicitStaticFinalGetter)); |
| 5550 const Class& owner = Class::Handle(Owner()); |
| 5551 ASSERT(!owner.IsNull()); |
| 5552 const Array& fields = Array::Handle(owner.fields()); |
| 5553 ASSERT(!fields.IsNull()); |
| 5554 Field& field = Field::Handle(); |
| 5555 for (intptr_t i = 0; i < fields.Length(); i++) { |
| 5556 field ^= fields.At(i); |
| 5557 ASSERT(!field.IsNull()); |
| 5558 if (field.token_pos() == token_pos()) { |
| 5559 return field.raw(); |
| 5560 } |
| 5561 } |
| 5562 return Field::null(); |
| 5563 } |
| 5564 |
| 5565 |
| 5566 |
5546 RawFunction* Function::parent_function() const { | 5567 RawFunction* Function::parent_function() const { |
5547 if (IsClosureFunction()) { | 5568 if (IsClosureFunction()) { |
5548 const Object& obj = Object::Handle(raw_ptr()->data_); | 5569 const Object& obj = Object::Handle(raw_ptr()->data_); |
5549 ASSERT(!obj.IsNull()); | 5570 ASSERT(!obj.IsNull()); |
5550 return ClosureData::Cast(obj).parent_function(); | 5571 return ClosureData::Cast(obj).parent_function(); |
5551 } | 5572 } |
5552 return Function::null(); | 5573 return Function::null(); |
5553 } | 5574 } |
5554 | 5575 |
5555 | 5576 |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7292 jsobj.AddProperty("_optimizable", is_optimizable()); | 7313 jsobj.AddProperty("_optimizable", is_optimizable()); |
7293 jsobj.AddProperty("_inlinable", is_inlinable()); | 7314 jsobj.AddProperty("_inlinable", is_inlinable()); |
7294 code = unoptimized_code(); | 7315 code = unoptimized_code(); |
7295 if (!code.IsNull()) { | 7316 if (!code.IsNull()) { |
7296 jsobj.AddProperty("_unoptimizedCode", code); | 7317 jsobj.AddProperty("_unoptimizedCode", code); |
7297 } | 7318 } |
7298 jsobj.AddProperty("_usageCounter", usage_counter()); | 7319 jsobj.AddProperty("_usageCounter", usage_counter()); |
7299 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); | 7320 jsobj.AddProperty("_optimizedCallSiteCount", optimized_call_site_count()); |
7300 jsobj.AddProperty("_deoptimizations", | 7321 jsobj.AddProperty("_deoptimizations", |
7301 static_cast<intptr_t>(deoptimization_counter())); | 7322 static_cast<intptr_t>(deoptimization_counter())); |
| 7323 if ((kind() == RawFunction::kImplicitGetter) || |
| 7324 (kind() == RawFunction::kImplicitSetter) || |
| 7325 (kind() == RawFunction::kImplicitStaticFinalGetter)) { |
| 7326 const Field& field = Field::Handle(LookupImplicitGetterSetterField()); |
| 7327 if (!field.IsNull()) { |
| 7328 jsobj.AddProperty("_field", field); |
| 7329 } |
| 7330 } |
7302 | 7331 |
7303 const Script& script = Script::Handle(this->script()); | 7332 const Script& script = Script::Handle(this->script()); |
7304 if (!script.IsNull()) { | 7333 if (!script.IsNull()) { |
7305 jsobj.AddLocation(script, token_pos(), end_token_pos()); | 7334 jsobj.AddLocation(script, token_pos(), end_token_pos()); |
7306 } | 7335 } |
7307 } | 7336 } |
7308 | 7337 |
7309 | 7338 |
7310 void ClosureData::set_context_scope(const ContextScope& value) const { | 7339 void ClosureData::set_context_scope(const ContextScope& value) const { |
7311 StorePointer(&raw_ptr()->context_scope_, value.raw()); | 7340 StorePointer(&raw_ptr()->context_scope_, value.raw()); |
(...skipping 14585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21897 return tag_label.ToCString(); | 21926 return tag_label.ToCString(); |
21898 } | 21927 } |
21899 | 21928 |
21900 | 21929 |
21901 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21930 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21902 Instance::PrintJSONImpl(stream, ref); | 21931 Instance::PrintJSONImpl(stream, ref); |
21903 } | 21932 } |
21904 | 21933 |
21905 | 21934 |
21906 } // namespace dart | 21935 } // namespace dart |
OLD | NEW |