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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 void FlowGraphVisitor::VisitBlocks() { | 49 void FlowGraphVisitor::VisitBlocks() { |
| 50 for (intptr_t i = 0; i < block_order_.length(); ++i) { | 50 for (intptr_t i = 0; i < block_order_.length(); ++i) { |
| 51 Instruction* current = block_order_[i]->Accept(this); | 51 Instruction* current = block_order_[i]->Accept(this); |
| 52 while ((current != NULL) && !current->IsBlockEntry()) { | 52 while ((current != NULL) && !current->IsBlockEntry()) { |
| 53 current = current->Accept(this); | 53 current = current->Accept(this); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 void Computation::ReplaceWith(Computation* other) { | |
| 60 ASSERT(other->instr() == NULL); | |
| 61 ASSERT(instr() != NULL); | |
| 62 other->set_instr(other->instr()); | |
|
Vyacheslav Egorov (Google)
2012/06/13 09:02:27
we definitely need to eradicate bind/do. the fact
srdjan
2012/06/13 18:34:24
Yes, agreed.
| |
| 63 instr()->replace_computation(other); | |
| 64 set_instr(NULL); | |
| 65 } | |
| 66 | |
| 67 | |
| 59 intptr_t InstanceCallComp::InputCount() const { | 68 intptr_t InstanceCallComp::InputCount() const { |
| 60 return ArgumentCount(); | 69 return ArgumentCount(); |
| 61 } | 70 } |
| 62 | 71 |
| 63 | 72 |
| 64 intptr_t StaticCallComp::InputCount() const { | 73 intptr_t StaticCallComp::InputCount() const { |
| 65 return ArgumentCount(); | 74 return ArgumentCount(); |
| 66 } | 75 } |
| 67 | 76 |
| 68 | 77 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 // TODO(regis): The result type may be generic. Consider upper bounds. | 385 // TODO(regis): The result type may be generic. Consider upper bounds. |
| 377 return signature_function.result_type(); | 386 return signature_function.result_type(); |
| 378 } | 387 } |
| 379 | 388 |
| 380 | 389 |
| 381 RawAbstractType* InstanceCallComp::StaticType() const { | 390 RawAbstractType* InstanceCallComp::StaticType() const { |
| 382 return Type::DynamicType(); | 391 return Type::DynamicType(); |
| 383 } | 392 } |
| 384 | 393 |
| 385 | 394 |
| 395 RawAbstractType* CheckedInstanceCallComp::StaticType() const { | |
| 396 return Type::DynamicType(); | |
| 397 } | |
| 398 | |
| 399 | |
| 386 RawAbstractType* StaticCallComp::StaticType() const { | 400 RawAbstractType* StaticCallComp::StaticType() const { |
| 387 return function().result_type(); | 401 return function().result_type(); |
| 388 } | 402 } |
| 389 | 403 |
| 390 | 404 |
| 391 RawAbstractType* LoadLocalComp::StaticType() const { | 405 RawAbstractType* LoadLocalComp::StaticType() const { |
| 392 return local().type().raw(); | 406 return local().type().raw(); |
| 393 } | 407 } |
| 394 | 408 |
| 395 | 409 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 compiler->GenerateInstanceCall(cid(), | 861 compiler->GenerateInstanceCall(cid(), |
| 848 token_index(), | 862 token_index(), |
| 849 try_index(), | 863 try_index(), |
| 850 function_name(), | 864 function_name(), |
| 851 ArgumentCount(), | 865 ArgumentCount(), |
| 852 argument_names(), | 866 argument_names(), |
| 853 checked_argument_count()); | 867 checked_argument_count()); |
| 854 } | 868 } |
| 855 | 869 |
| 856 | 870 |
| 871 LocationSummary* CheckedInstanceCallComp::MakeLocationSummary() const { | |
| 872 return MakeCallSummary(); | |
| 873 } | |
| 874 | |
| 875 | |
| 876 void CheckedInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 877 // TODO(srdjan): Add checked calls, a series of checks each issuing | |
| 878 // a direct call to the target if check succeeds. | |
| 879 ASSERT(VerifyCallComputation(instance_call())); | |
| 880 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | |
| 881 instance_call()->cid(), | |
| 882 instance_call()->token_index(), | |
| 883 instance_call()->try_index()); | |
| 884 compiler->GenerateInstanceCall(instance_call()->cid(), | |
| 885 instance_call()->token_index(), | |
| 886 instance_call()->try_index(), | |
| 887 instance_call()->function_name(), | |
| 888 instance_call()->ArgumentCount(), | |
| 889 instance_call()->argument_names(), | |
| 890 instance_call()->checked_argument_count()); | |
| 891 } | |
| 892 | |
| 893 | |
| 857 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 894 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
| 858 return MakeCallSummary(); | 895 return MakeCallSummary(); |
| 859 } | 896 } |
| 860 | 897 |
| 861 | 898 |
| 862 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 899 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 863 ASSERT(VerifyCallComputation(this)); | 900 ASSERT(VerifyCallComputation(this)); |
| 864 compiler->GenerateStaticCall(cid(), | 901 compiler->GenerateStaticCall(cid(), |
| 865 token_index(), | 902 token_index(), |
| 866 try_index(), | 903 try_index(), |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 994 StubCode::GetAllocationStubForClosure(closure_function)); | 1031 StubCode::GetAllocationStubForClosure(closure_function)); |
| 995 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1032 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 996 compiler->GenerateCall(token_index(), try_index(), &label, | 1033 compiler->GenerateCall(token_index(), try_index(), &label, |
| 997 PcDescriptors::kOther); | 1034 PcDescriptors::kOther); |
| 998 __ Drop(2); // Discard type arguments and receiver. | 1035 __ Drop(2); // Discard type arguments and receiver. |
| 999 } | 1036 } |
| 1000 | 1037 |
| 1001 #undef __ | 1038 #undef __ |
| 1002 | 1039 |
| 1003 } // namespace dart | 1040 } // namespace dart |
| OLD | NEW |