| 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 2263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 return Function::null(); | 2274 return Function::null(); |
| 2275 } | 2275 } |
| 2276 return Function::Cast(object).raw(); | 2276 return Function::Cast(object).raw(); |
| 2277 } | 2277 } |
| 2278 | 2278 |
| 2279 | 2279 |
| 2280 void Class::AddClosureFunction(const Function& function) const { | 2280 void Class::AddClosureFunction(const Function& function) const { |
| 2281 GrowableObjectArray& closures = | 2281 GrowableObjectArray& closures = |
| 2282 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); | 2282 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); |
| 2283 if (closures.IsNull()) { | 2283 if (closures.IsNull()) { |
| 2284 closures = GrowableObjectArray::New(4); | 2284 closures = GrowableObjectArray::New(4, Heap::kOld); |
| 2285 StorePointer(&raw_ptr()->closure_functions_, closures.raw()); | 2285 StorePointer(&raw_ptr()->closure_functions_, closures.raw()); |
| 2286 } | 2286 } |
| 2287 ASSERT(function.IsNonImplicitClosureFunction()); | 2287 ASSERT(function.IsNonImplicitClosureFunction()); |
| 2288 ASSERT(function.Owner() == this->raw()); | 2288 ASSERT(function.Owner() == this->raw()); |
| 2289 closures.Add(function); | 2289 closures.Add(function, Heap::kOld); |
| 2290 } | 2290 } |
| 2291 | 2291 |
| 2292 | 2292 |
| 2293 // Lookup the innermost closure function that contains token at token_pos. | 2293 // Lookup the innermost closure function that contains token at token_pos. |
| 2294 RawFunction* Class::LookupClosureFunction(intptr_t token_pos) const { | 2294 RawFunction* Class::LookupClosureFunction(intptr_t token_pos) const { |
| 2295 if (raw_ptr()->closure_functions_ == GrowableObjectArray::null()) { | 2295 if (raw_ptr()->closure_functions_ == GrowableObjectArray::null()) { |
| 2296 return Function::null(); | 2296 return Function::null(); |
| 2297 } | 2297 } |
| 2298 const GrowableObjectArray& closures = | 2298 const GrowableObjectArray& closures = |
| 2299 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); | 2299 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); |
| (...skipping 5166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7466 } else { | 7466 } else { |
| 7467 jsobj.AddProperty("_guardLength", guarded_list_length()); | 7467 jsobj.AddProperty("_guardLength", guarded_list_length()); |
| 7468 } | 7468 } |
| 7469 const Class& origin_cls = Class::Handle(origin()); | 7469 const Class& origin_cls = Class::Handle(origin()); |
| 7470 const Script& script = Script::Handle(origin_cls.script()); | 7470 const Script& script = Script::Handle(origin_cls.script()); |
| 7471 if (!script.IsNull()) { | 7471 if (!script.IsNull()) { |
| 7472 jsobj.AddLocation(script, token_pos()); | 7472 jsobj.AddLocation(script, token_pos()); |
| 7473 } | 7473 } |
| 7474 } | 7474 } |
| 7475 | 7475 |
| 7476 |
| 7476 // Build a closure object that gets (or sets) the contents of a static | 7477 // Build a closure object that gets (or sets) the contents of a static |
| 7477 // field f and cache the closure in a newly created static field | 7478 // field f and cache the closure in a newly created static field |
| 7478 // named #f (or #f= in case of a setter). | 7479 // named #f (or #f= in case of a setter). |
| 7479 RawInstance* Field::AccessorClosure(bool make_setter) const { | 7480 RawInstance* Field::AccessorClosure(bool make_setter) const { |
| 7480 ASSERT(is_static()); | 7481 ASSERT(is_static()); |
| 7481 const Class& field_owner = Class::Handle(owner()); | 7482 const Class& field_owner = Class::Handle(owner()); |
| 7482 | 7483 |
| 7483 String& closure_name = String::Handle(this->name()); | 7484 String& closure_name = String::Handle(this->name()); |
| 7484 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); | 7485 closure_name = Symbols::FromConcat(Symbols::HashMark(), closure_name); |
| 7485 if (make_setter) { | 7486 if (make_setter) { |
| (...skipping 14044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21530 return tag_label.ToCString(); | 21531 return tag_label.ToCString(); |
| 21531 } | 21532 } |
| 21532 | 21533 |
| 21533 | 21534 |
| 21534 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21535 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21535 Instance::PrintJSONImpl(stream, ref); | 21536 Instance::PrintJSONImpl(stream, ref); |
| 21536 } | 21537 } |
| 21537 | 21538 |
| 21538 | 21539 |
| 21539 } // namespace dart | 21540 } // namespace dart |
| OLD | NEW |