| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3222 if (IsClosureFunction()) { | 3222 if (IsClosureFunction()) { |
| 3223 const Object& obj = Object::Handle(raw_ptr()->data_); | 3223 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3224 ASSERT(!obj.IsNull()); | 3224 ASSERT(!obj.IsNull()); |
| 3225 ClosureData::Cast(obj).set_closure_allocation_stub(value); | 3225 ClosureData::Cast(obj).set_closure_allocation_stub(value); |
| 3226 return; | 3226 return; |
| 3227 } | 3227 } |
| 3228 UNREACHABLE(); | 3228 UNREACHABLE(); |
| 3229 } | 3229 } |
| 3230 | 3230 |
| 3231 | 3231 |
| 3232 RawFunction* Function::method_extractor() const { |
| 3233 ASSERT(IsImplicitClosureFunction()); |
| 3234 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3235 ASSERT(!obj.IsNull()); |
| 3236 return ClosureData::Cast(obj).method_extractor(); |
| 3237 } |
| 3238 |
| 3239 |
| 3240 void Function::set_method_extractor(const Function& value) const { |
| 3241 ASSERT(IsImplicitClosureFunction()); |
| 3242 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3243 ASSERT(!obj.IsNull()); |
| 3244 ClosureData::Cast(obj).set_method_extractor(value); |
| 3245 } |
| 3246 |
| 3247 |
| 3248 RawFunction* Function::extracted_method_closure() const { |
| 3249 ASSERT(kind() == RawFunction::kMethodExtractor); |
| 3250 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3251 ASSERT(obj.IsFunction()); |
| 3252 return Function::Cast(obj).raw(); |
| 3253 } |
| 3254 |
| 3255 |
| 3256 void Function::set_extracted_method_closure(const Function& value) const { |
| 3257 ASSERT(kind() == RawFunction::kMethodExtractor); |
| 3258 ASSERT(raw_ptr()->data_ == Object::null()); |
| 3259 set_data(value); |
| 3260 } |
| 3261 |
| 3262 |
| 3232 RawFunction* Function::parent_function() const { | 3263 RawFunction* Function::parent_function() const { |
| 3233 if (IsClosureFunction()) { | 3264 if (IsClosureFunction()) { |
| 3234 const Object& obj = Object::Handle(raw_ptr()->data_); | 3265 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 3235 ASSERT(!obj.IsNull()); | 3266 ASSERT(!obj.IsNull()); |
| 3236 return ClosureData::Cast(obj).parent_function(); | 3267 return ClosureData::Cast(obj).parent_function(); |
| 3237 } | 3268 } |
| 3238 return Function::null(); | 3269 return Function::null(); |
| 3239 } | 3270 } |
| 3240 | 3271 |
| 3241 | 3272 |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4326 break; | 4357 break; |
| 4327 case RawFunction::kImplicitGetter: | 4358 case RawFunction::kImplicitGetter: |
| 4328 kind_str = " getter"; | 4359 kind_str = " getter"; |
| 4329 break; | 4360 break; |
| 4330 case RawFunction::kImplicitSetter: | 4361 case RawFunction::kImplicitSetter: |
| 4331 kind_str = " setter"; | 4362 kind_str = " setter"; |
| 4332 break; | 4363 break; |
| 4333 case RawFunction::kConstImplicitGetter: | 4364 case RawFunction::kConstImplicitGetter: |
| 4334 kind_str = " const-getter"; | 4365 kind_str = " const-getter"; |
| 4335 break; | 4366 break; |
| 4367 case RawFunction::kMethodExtractor: |
| 4368 kind_str = " method-extractor"; |
| 4369 break; |
| 4336 default: | 4370 default: |
| 4337 UNREACHABLE(); | 4371 UNREACHABLE(); |
| 4338 } | 4372 } |
| 4339 const char* kFormat = "Function '%s':%s%s%s%s."; | 4373 const char* kFormat = "Function '%s':%s%s%s%s."; |
| 4340 const char* function_name = String::Handle(name()).ToCString(); | 4374 const char* function_name = String::Handle(name()).ToCString(); |
| 4341 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, | 4375 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, |
| 4342 static_str, abstract_str, kind_str, const_str) + 1; | 4376 static_str, abstract_str, kind_str, const_str) + 1; |
| 4343 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 4377 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 4344 OS::SNPrint(chars, len, kFormat, function_name, | 4378 OS::SNPrint(chars, len, kFormat, function_name, |
| 4345 static_str, abstract_str, kind_str, const_str); | 4379 static_str, abstract_str, kind_str, const_str); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4359 } | 4393 } |
| 4360 | 4394 |
| 4361 | 4395 |
| 4362 void ClosureData::set_closure_allocation_stub(const Code& value) const { | 4396 void ClosureData::set_closure_allocation_stub(const Code& value) const { |
| 4363 ASSERT(!value.IsNull()); | 4397 ASSERT(!value.IsNull()); |
| 4364 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null()); | 4398 ASSERT(raw_ptr()->closure_allocation_stub_ == Code::null()); |
| 4365 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw()); | 4399 StorePointer(&raw_ptr()->closure_allocation_stub_, value.raw()); |
| 4366 } | 4400 } |
| 4367 | 4401 |
| 4368 | 4402 |
| 4403 void ClosureData::set_method_extractor(const Function& value) const { |
| 4404 ASSERT(!value.IsNull()); |
| 4405 ASSERT(raw_ptr()->method_extractor_ == Function::null()); |
| 4406 StorePointer(&raw_ptr()->method_extractor_, value.raw()); |
| 4407 } |
| 4408 |
| 4409 |
| 4369 void ClosureData::set_parent_function(const Function& value) const { | 4410 void ClosureData::set_parent_function(const Function& value) const { |
| 4370 StorePointer(&raw_ptr()->parent_function_, value.raw()); | 4411 StorePointer(&raw_ptr()->parent_function_, value.raw()); |
| 4371 } | 4412 } |
| 4372 | 4413 |
| 4373 | 4414 |
| 4374 void ClosureData::set_signature_class(const Class& value) const { | 4415 void ClosureData::set_signature_class(const Class& value) const { |
| 4375 StorePointer(&raw_ptr()->signature_class_, value.raw()); | 4416 StorePointer(&raw_ptr()->signature_class_, value.raw()); |
| 4376 } | 4417 } |
| 4377 | 4418 |
| 4378 | 4419 |
| (...skipping 8104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12483 } | 12524 } |
| 12484 return result.raw(); | 12525 return result.raw(); |
| 12485 } | 12526 } |
| 12486 | 12527 |
| 12487 | 12528 |
| 12488 const char* WeakProperty::ToCString() const { | 12529 const char* WeakProperty::ToCString() const { |
| 12489 return "_WeakProperty"; | 12530 return "_WeakProperty"; |
| 12490 } | 12531 } |
| 12491 | 12532 |
| 12492 } // namespace dart | 12533 } // namespace dart |
| OLD | NEW |