Chromium Code Reviews| 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 4206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4217 const Object& obj = Object::Handle(raw_ptr()->data_); | 4217 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 4218 ASSERT(!obj.IsNull()); | 4218 ASSERT(!obj.IsNull()); |
| 4219 ClosureData::Cast(obj).set_parent_function(value); | 4219 ClosureData::Cast(obj).set_parent_function(value); |
| 4220 return; | 4220 return; |
| 4221 } | 4221 } |
| 4222 UNREACHABLE(); | 4222 UNREACHABLE(); |
| 4223 } | 4223 } |
| 4224 | 4224 |
| 4225 | 4225 |
| 4226 RawFunction* Function::implicit_closure_function() const { | 4226 RawFunction* Function::implicit_closure_function() const { |
| 4227 if (IsClosureFunction() || IsSignatureFunction()) { | 4227 if (IsClosureFunction() || |
| 4228 IsSignatureFunction() || | |
| 4229 IsStaticInitializerFunction()) { | |
| 4228 return Function::null(); | 4230 return Function::null(); |
| 4229 } | 4231 } |
| 4230 const Object& obj = Object::Handle(raw_ptr()->data_); | 4232 const Object& obj = Object::Handle(raw_ptr()->data_); |
| 4231 ASSERT(obj.IsNull() || obj.IsFunction()); | 4233 ASSERT(obj.IsNull() || obj.IsFunction()); |
| 4232 return (obj.IsNull()) ? Function::null() : Function::Cast(obj).raw(); | 4234 return (obj.IsNull()) ? Function::null() : Function::Cast(obj).raw(); |
| 4233 } | 4235 } |
| 4234 | 4236 |
| 4235 | 4237 |
| 4236 void Function::set_implicit_closure_function(const Function& value) const { | 4238 void Function::set_implicit_closure_function(const Function& value) const { |
| 4237 ASSERT(!IsClosureFunction() && !IsSignatureFunction()); | 4239 ASSERT(!IsClosureFunction() && !IsSignatureFunction()); |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5420 ToFullyQualifiedCString(), | 5422 ToFullyQualifiedCString(), |
| 5421 fp, | 5423 fp, |
| 5422 SourceFingerprint()); | 5424 SourceFingerprint()); |
| 5423 return false; | 5425 return false; |
| 5424 } | 5426 } |
| 5425 } | 5427 } |
| 5426 return true; | 5428 return true; |
| 5427 } | 5429 } |
| 5428 | 5430 |
| 5429 | 5431 |
| 5432 RawFunction* Function::NewStaticInitializer(const String& field_name, | |
| 5433 const AbstractType& result_type, | |
| 5434 const Class& cls, | |
| 5435 intptr_t initializer_pos) { | |
| 5436 const String& init_name = | |
| 5437 String::Handle(Symbols::New(String::Handle( | |
| 5438 String::Concat(Symbols::InitPrefix(), field_name)))); | |
|
srdjan
2013/10/30 17:54:15
Indent another 4 spaces
Florian Schneider
2013/10/31 16:34:53
Done.
| |
| 5439 const Function& init_function = Function::ZoneHandle( | |
| 5440 Function::New(init_name, | |
| 5441 RawFunction::kStaticInitializer, | |
| 5442 true, // static | |
| 5443 false, // !const | |
| 5444 false, // !abstract | |
| 5445 false, // !external | |
| 5446 cls, | |
| 5447 initializer_pos)); | |
| 5448 init_function.set_result_type(result_type); | |
|
srdjan
2013/10/30 17:54:15
Please add a comment describing the special settin
Florian Schneider
2013/10/31 16:34:53
Done.
| |
| 5449 init_function.set_is_visible(false); | |
| 5450 init_function.set_is_optimizable(false); | |
| 5451 init_function.set_is_inlinable(false); | |
| 5452 return init_function.raw(); | |
| 5453 } | |
| 5454 | |
| 5455 | |
| 5430 const char* Function::ToCString() const { | 5456 const char* Function::ToCString() const { |
| 5431 const char* static_str = is_static() ? " static" : ""; | 5457 const char* static_str = is_static() ? " static" : ""; |
| 5432 const char* abstract_str = is_abstract() ? " abstract" : ""; | 5458 const char* abstract_str = is_abstract() ? " abstract" : ""; |
| 5433 const char* kind_str = NULL; | 5459 const char* kind_str = NULL; |
| 5434 const char* const_str = is_const() ? " const" : ""; | 5460 const char* const_str = is_const() ? " const" : ""; |
| 5435 switch (kind()) { | 5461 switch (kind()) { |
| 5436 case RawFunction::kRegularFunction: | 5462 case RawFunction::kRegularFunction: |
| 5437 case RawFunction::kClosureFunction: | 5463 case RawFunction::kClosureFunction: |
| 5438 case RawFunction::kGetterFunction: | 5464 case RawFunction::kGetterFunction: |
| 5439 case RawFunction::kSetterFunction: | 5465 case RawFunction::kSetterFunction: |
| 5440 kind_str = ""; | 5466 kind_str = ""; |
| 5441 break; | 5467 break; |
| 5442 case RawFunction::kSignatureFunction: | 5468 case RawFunction::kSignatureFunction: |
| 5443 kind_str = " signature"; | 5469 kind_str = " signature"; |
| 5444 break; | 5470 break; |
| 5445 case RawFunction::kConstructor: | 5471 case RawFunction::kConstructor: |
| 5446 kind_str = is_static() ? " factory" : " constructor"; | 5472 kind_str = is_static() ? " factory" : " constructor"; |
| 5447 break; | 5473 break; |
| 5448 case RawFunction::kImplicitGetter: | 5474 case RawFunction::kImplicitGetter: |
| 5449 kind_str = " getter"; | 5475 kind_str = " getter"; |
| 5450 break; | 5476 break; |
| 5451 case RawFunction::kImplicitSetter: | 5477 case RawFunction::kImplicitSetter: |
| 5452 kind_str = " setter"; | 5478 kind_str = " setter"; |
| 5453 break; | 5479 break; |
| 5480 case RawFunction::kStaticInitializer: | |
| 5481 kind_str = " static-initializer"; | |
| 5482 break; | |
| 5454 case RawFunction::kImplicitStaticFinalGetter: | 5483 case RawFunction::kImplicitStaticFinalGetter: |
| 5455 kind_str = " static-final-getter"; | 5484 kind_str = " static-final-getter"; |
| 5456 break; | 5485 break; |
| 5457 case RawFunction::kMethodExtractor: | 5486 case RawFunction::kMethodExtractor: |
| 5458 kind_str = " method-extractor"; | 5487 kind_str = " method-extractor"; |
| 5459 break; | 5488 break; |
| 5460 case RawFunction::kNoSuchMethodDispatcher: | 5489 case RawFunction::kNoSuchMethodDispatcher: |
| 5461 kind_str = " no-such-method-dispatcher"; | 5490 kind_str = " no-such-method-dispatcher"; |
| 5462 break; | 5491 break; |
| 5463 case RawFunction::kInvokeFieldDispatcher: | 5492 case RawFunction::kInvokeFieldDispatcher: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5515 break; | 5544 break; |
| 5516 case RawFunction::kNoSuchMethodDispatcher: | 5545 case RawFunction::kNoSuchMethodDispatcher: |
| 5517 kind_string = "no such method"; | 5546 kind_string = "no such method"; |
| 5518 break; | 5547 break; |
| 5519 case RawFunction::kClosureFunction: | 5548 case RawFunction::kClosureFunction: |
| 5520 kind_string = "closure"; | 5549 kind_string = "closure"; |
| 5521 break; | 5550 break; |
| 5522 case RawFunction::kConstructor: | 5551 case RawFunction::kConstructor: |
| 5523 kind_string = "constructor"; | 5552 kind_string = "constructor"; |
| 5524 break; | 5553 break; |
| 5554 case RawFunction::kStaticInitializer: | |
| 5555 kind_string = "static initializer"; | |
| 5556 break; | |
| 5525 case RawFunction::kImplicitStaticFinalGetter: | 5557 case RawFunction::kImplicitStaticFinalGetter: |
| 5526 kind_string = "static final getter"; | 5558 kind_string = "static final getter"; |
| 5527 break; | 5559 break; |
| 5528 default: | 5560 default: |
| 5529 UNREACHABLE(); | 5561 UNREACHABLE(); |
| 5530 } | 5562 } |
| 5531 jsobj.AddProperty("kind", kind_string); | 5563 jsobj.AddProperty("kind", kind_string); |
| 5532 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); | 5564 jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); |
| 5533 jsobj.AddProperty("usage_counter", usage_counter()); | 5565 jsobj.AddProperty("usage_counter", usage_counter()); |
| 5534 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); | 5566 jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); |
| (...skipping 10061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15596 return "_MirrorReference"; | 15628 return "_MirrorReference"; |
| 15597 } | 15629 } |
| 15598 | 15630 |
| 15599 | 15631 |
| 15600 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15632 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15601 JSONObject jsobj(stream); | 15633 JSONObject jsobj(stream); |
| 15602 } | 15634 } |
| 15603 | 15635 |
| 15604 | 15636 |
| 15605 } // namespace dart | 15637 } // namespace dart |
| OLD | NEW |