| 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 6178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6189 } | 6189 } |
| 6190 if (!StaticBit::decode(kind_tag)) { | 6190 if (!StaticBit::decode(kind_tag)) { |
| 6191 return false; | 6191 return false; |
| 6192 } | 6192 } |
| 6193 RawClosureData* data = reinterpret_cast<RawClosureData*>(func->ptr()->data_); | 6193 RawClosureData* data = reinterpret_cast<RawClosureData*>(func->ptr()->data_); |
| 6194 RawFunction* parent_function = data->ptr()->parent_function_; | 6194 RawFunction* parent_function = data->ptr()->parent_function_; |
| 6195 return (parent_function->ptr()->data_ == reinterpret_cast<RawObject*>(func)); | 6195 return (parent_function->ptr()->data_ == reinterpret_cast<RawObject*>(func)); |
| 6196 } | 6196 } |
| 6197 | 6197 |
| 6198 | 6198 |
| 6199 bool Function::IsConstructorClosureFunction() const { |
| 6200 return IsClosureFunction() && |
| 6201 String::Handle(name()).StartsWith(Symbols::ConstructorClosurePrefix()); |
| 6202 } |
| 6203 |
| 6204 |
| 6199 RawFunction* Function::New() { | 6205 RawFunction* Function::New() { |
| 6200 ASSERT(Object::function_class() != Class::null()); | 6206 ASSERT(Object::function_class() != Class::null()); |
| 6201 RawObject* raw = Object::Allocate(Function::kClassId, | 6207 RawObject* raw = Object::Allocate(Function::kClassId, |
| 6202 Function::InstanceSize(), | 6208 Function::InstanceSize(), |
| 6203 Heap::kOld); | 6209 Heap::kOld); |
| 6204 return reinterpret_cast<RawFunction*>(raw); | 6210 return reinterpret_cast<RawFunction*>(raw); |
| 6205 } | 6211 } |
| 6206 | 6212 |
| 6207 | 6213 |
| 6208 RawFunction* Function::New(const String& name, | 6214 RawFunction* Function::New(const String& name, |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6496 pieces.Add(Symbols::RBrace()); | 6502 pieces.Add(Symbols::RBrace()); |
| 6497 } | 6503 } |
| 6498 } | 6504 } |
| 6499 } | 6505 } |
| 6500 | 6506 |
| 6501 | 6507 |
| 6502 RawInstance* Function::ImplicitStaticClosure() const { | 6508 RawInstance* Function::ImplicitStaticClosure() const { |
| 6503 if (implicit_static_closure() == Instance::null()) { | 6509 if (implicit_static_closure() == Instance::null()) { |
| 6504 Isolate* isolate = Isolate::Current(); | 6510 Isolate* isolate = Isolate::Current(); |
| 6505 ObjectStore* object_store = isolate->object_store(); | 6511 ObjectStore* object_store = isolate->object_store(); |
| 6506 const Context& context = Context::Handle(isolate, | 6512 const Context& context = |
| 6507 object_store->empty_context()); | 6513 Context::Handle(isolate, object_store->empty_context()); |
| 6508 Instance& closure = | 6514 Instance& closure = |
| 6509 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); | 6515 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); |
| 6510 const char* error_str = NULL; | 6516 const char* error_str = NULL; |
| 6511 closure ^= closure.CheckAndCanonicalize(&error_str); | 6517 closure ^= closure.CheckAndCanonicalize(&error_str); |
| 6512 ASSERT(!closure.IsNull()); | 6518 ASSERT(!closure.IsNull()); |
| 6513 set_implicit_static_closure(closure); | 6519 set_implicit_static_closure(closure); |
| 6514 } | 6520 } |
| 6515 return implicit_static_closure(); | 6521 return implicit_static_closure(); |
| 6516 } | 6522 } |
| 6517 | 6523 |
| (...skipping 14808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21326 return tag_label.ToCString(); | 21332 return tag_label.ToCString(); |
| 21327 } | 21333 } |
| 21328 | 21334 |
| 21329 | 21335 |
| 21330 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21336 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21331 Instance::PrintJSONImpl(stream, ref); | 21337 Instance::PrintJSONImpl(stream, ref); |
| 21332 } | 21338 } |
| 21333 | 21339 |
| 21334 | 21340 |
| 21335 } // namespace dart | 21341 } // namespace dart |
| OLD | NEW |