| 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()); |
| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 // TODO(regis): The result type may be generic. Consider upper bounds. | 469 // TODO(regis): The result type may be generic. Consider upper bounds. |
| 461 return signature_function.result_type(); | 470 return signature_function.result_type(); |
| 462 } | 471 } |
| 463 | 472 |
| 464 | 473 |
| 465 RawAbstractType* InstanceCallComp::StaticType() const { | 474 RawAbstractType* InstanceCallComp::StaticType() const { |
| 466 return Type::DynamicType(); | 475 return Type::DynamicType(); |
| 467 } | 476 } |
| 468 | 477 |
| 469 | 478 |
| 479 RawAbstractType* PolymorphicInstanceCallComp::StaticType() const { |
| 480 return Type::DynamicType(); |
| 481 } |
| 482 |
| 483 |
| 470 RawAbstractType* StaticCallComp::StaticType() const { | 484 RawAbstractType* StaticCallComp::StaticType() const { |
| 471 return function().result_type(); | 485 return function().result_type(); |
| 472 } | 486 } |
| 473 | 487 |
| 474 | 488 |
| 475 RawAbstractType* LoadLocalComp::StaticType() const { | 489 RawAbstractType* LoadLocalComp::StaticType() const { |
| 476 return local().type().raw(); | 490 return local().type().raw(); |
| 477 } | 491 } |
| 478 | 492 |
| 479 | 493 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 compiler->GenerateInstanceCall(cid(), | 986 compiler->GenerateInstanceCall(cid(), |
| 973 token_index(), | 987 token_index(), |
| 974 try_index(), | 988 try_index(), |
| 975 function_name(), | 989 function_name(), |
| 976 ArgumentCount(), | 990 ArgumentCount(), |
| 977 argument_names(), | 991 argument_names(), |
| 978 checked_argument_count()); | 992 checked_argument_count()); |
| 979 } | 993 } |
| 980 | 994 |
| 981 | 995 |
| 996 LocationSummary* PolymorphicInstanceCallComp::MakeLocationSummary() const { |
| 997 return MakeCallSummary(); |
| 998 } |
| 999 |
| 1000 |
| 1001 void PolymorphicInstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1002 // TODO(srdjan): Add checked calls, a series of checks each issuing |
| 1003 // a direct call to the target if check succeeds. |
| 1004 ASSERT(VerifyCallComputation(instance_call())); |
| 1005 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 1006 instance_call()->cid(), |
| 1007 instance_call()->token_index(), |
| 1008 instance_call()->try_index()); |
| 1009 compiler->GenerateInstanceCall(instance_call()->cid(), |
| 1010 instance_call()->token_index(), |
| 1011 instance_call()->try_index(), |
| 1012 instance_call()->function_name(), |
| 1013 instance_call()->ArgumentCount(), |
| 1014 instance_call()->argument_names(), |
| 1015 instance_call()->checked_argument_count()); |
| 1016 } |
| 1017 |
| 1018 |
| 982 LocationSummary* StaticCallComp::MakeLocationSummary() const { | 1019 LocationSummary* StaticCallComp::MakeLocationSummary() const { |
| 983 return MakeCallSummary(); | 1020 return MakeCallSummary(); |
| 984 } | 1021 } |
| 985 | 1022 |
| 986 | 1023 |
| 987 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1024 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 988 ASSERT(VerifyCallComputation(this)); | 1025 ASSERT(VerifyCallComputation(this)); |
| 989 compiler->GenerateStaticCall(cid(), | 1026 compiler->GenerateStaticCall(cid(), |
| 990 token_index(), | 1027 token_index(), |
| 991 try_index(), | 1028 try_index(), |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 StubCode::GetAllocationStubForClosure(closure_function)); | 1154 StubCode::GetAllocationStubForClosure(closure_function)); |
| 1118 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1155 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1119 compiler->GenerateCall(token_index(), try_index(), &label, | 1156 compiler->GenerateCall(token_index(), try_index(), &label, |
| 1120 PcDescriptors::kOther); | 1157 PcDescriptors::kOther); |
| 1121 __ Drop(2); // Discard type arguments and receiver. | 1158 __ Drop(2); // Discard type arguments and receiver. |
| 1122 } | 1159 } |
| 1123 | 1160 |
| 1124 #undef __ | 1161 #undef __ |
| 1125 | 1162 |
| 1126 } // namespace dart | 1163 } // namespace dart |
| OLD | NEW |