Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 10460002: Move CreateArray and CreateClosure to new location template. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 928
929 929
930 void FlowGraphCompiler::VisitAllocateObjectWithBoundsCheck( 930 void FlowGraphCompiler::VisitAllocateObjectWithBoundsCheck(
931 AllocateObjectWithBoundsCheckComp* comp) { 931 AllocateObjectWithBoundsCheckComp* comp) {
932 // Moved to intermediate_language_x64.cc. 932 // Moved to intermediate_language_x64.cc.
933 UNREACHABLE(); 933 UNREACHABLE();
934 } 934 }
935 935
936 936
937 void FlowGraphCompiler::VisitCreateArray(CreateArrayComp* comp) { 937 void FlowGraphCompiler::VisitCreateArray(CreateArrayComp* comp) {
938 // 1. Allocate the array. R10 = length, RBX = element type. 938 // Moved to intermediate_language_x64.cc.
939 __ movq(R10, Immediate(Smi::RawValue(comp->ElementCount()))); 939 UNREACHABLE();
940 LoadValue(RBX, comp->element_type());
941 GenerateCall(comp->token_index(),
942 comp->try_index(),
943 &StubCode::AllocateArrayLabel(),
944 PcDescriptors::kOther);
945
946 // 2. Initialize the array in RAX with the element values.
947 __ leaq(RCX, FieldAddress(RAX, Array::data_offset()));
948 for (int i = comp->ElementCount() - 1; i >= 0; --i) {
949 if (comp->ElementAt(i)->IsUse()) {
950 __ popq(Address(RCX, i * kWordSize));
951 } else {
952 LoadValue(RDX, comp->ElementAt(i));
953 __ movq(Address(RCX, i * kWordSize), RDX);
954 }
955 }
956 } 940 }
957 941
958 942
959 void FlowGraphCompiler::VisitCreateClosure(CreateClosureComp* comp) { 943 void FlowGraphCompiler::VisitCreateClosure(CreateClosureComp* comp) {
960 const Function& function = comp->function(); 944 // Moved to intermediate_language_x64.cc.
961 const Code& stub = Code::Handle( 945 UNREACHABLE();
962 StubCode::GetAllocationStubForClosure(function));
963 const ExternalLabel label(function.ToCString(), stub.EntryPoint());
964 GenerateCall(comp->token_index(), comp->try_index(), &label,
965 PcDescriptors::kOther);
966
967 const Class& cls = Class::Handle(function.signature_class());
968 if (cls.HasTypeArguments()) {
969 __ popq(RCX); // Discard type arguments.
970 }
971 if (function.IsImplicitInstanceClosureFunction()) {
972 __ popq(RCX); // Discard receiver.
973 }
974 } 946 }
975 947
976 948
977 void FlowGraphCompiler::VisitLoadVMField(LoadVMFieldComp* comp) { 949 void FlowGraphCompiler::VisitLoadVMField(LoadVMFieldComp* comp) {
978 // Moved to intermediate_language_x64.cc. 950 // Moved to intermediate_language_x64.cc.
979 UNREACHABLE(); 951 UNREACHABLE();
980 } 952 }
981 953
982 954
983 void FlowGraphCompiler::VisitStoreVMField(StoreVMFieldComp* comp) { 955 void FlowGraphCompiler::VisitStoreVMField(StoreVMFieldComp* comp) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 if (negated) { 1238 if (negated) {
1267 intptr_t target_index = instr->true_successor()->postorder_number(); 1239 intptr_t target_index = instr->true_successor()->postorder_number();
1268 __ j(EQUAL, &block_info_[target_index]->label); 1240 __ j(EQUAL, &block_info_[target_index]->label);
1269 } else { 1241 } else {
1270 intptr_t target_index = instr->false_successor()->postorder_number(); 1242 intptr_t target_index = instr->false_successor()->postorder_number();
1271 __ j(NOT_EQUAL, &block_info_[target_index]->label); 1243 __ j(NOT_EQUAL, &block_info_[target_index]->label);
1272 } 1244 }
1273 } 1245 }
1274 1246
1275 1247
1276 // Coped from CodeGenerator::CopyParameters (CodeGenerator will be deprecated). 1248 // Copied from CodeGenerator::CopyParameters (CodeGenerator will be deprecated).
1277 void FlowGraphCompiler::CopyParameters() { 1249 void FlowGraphCompiler::CopyParameters() {
1278 const Function& function = parsed_function_.function(); 1250 const Function& function = parsed_function_.function();
1279 LocalScope* scope = parsed_function_.node_sequence()->scope(); 1251 LocalScope* scope = parsed_function_.node_sequence()->scope();
1280 const int num_fixed_params = function.num_fixed_parameters(); 1252 const int num_fixed_params = function.num_fixed_parameters();
1281 const int num_opt_params = function.num_optional_parameters(); 1253 const int num_opt_params = function.num_optional_parameters();
1282 ASSERT(parsed_function_.first_parameter_index() == 1254 ASSERT(parsed_function_.first_parameter_index() ==
1283 ParsedFunction::kFirstLocalSlotIndex); 1255 ParsedFunction::kFirstLocalSlotIndex);
1284 // Copy positional arguments. 1256 // Copy positional arguments.
1285 // Check that no fewer than num_fixed_params positional arguments are passed 1257 // Check that no fewer than num_fixed_params positional arguments are passed
1286 // in and that no more than num_params arguments are passed in. 1258 // in and that no more than num_params arguments are passed in.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 } 1504 }
1533 // Even if an intrinsified version of the function was successfully 1505 // Even if an intrinsified version of the function was successfully
1534 // generated, it may fall through to the non-intrinsified method body. 1506 // generated, it may fall through to the non-intrinsified method body.
1535 if (!FLAG_trace_functions) { 1507 if (!FLAG_trace_functions) {
1536 return Intrinsifier::Intrinsify(parsed_function_.function(), assembler_); 1508 return Intrinsifier::Intrinsify(parsed_function_.function(), assembler_);
1537 } 1509 }
1538 return false; 1510 return false;
1539 } 1511 }
1540 1512
1541 1513
1542 // TODO(srdjan): Investigate where to put the argument type checks for
1543 // checked mode.
1544 void FlowGraphCompiler::CompileGraph() { 1514 void FlowGraphCompiler::CompileGraph() {
1545 InitCompiler(); 1515 InitCompiler();
1546 if (TryIntrinsify()) { 1516 if (TryIntrinsify()) {
1547 // Make it patchable: code must have a minimum code size, nop(2) increases 1517 // Make it patchable: code must have a minimum code size, nop(2) increases
1548 // the minimum code size appropriately. 1518 // the minimum code size appropriately.
1549 __ nop(2); 1519 __ nop(2);
1550 __ int3(); 1520 __ int3();
1551 __ jmp(&StubCode::FixCallersTargetLabel()); 1521 __ jmp(&StubCode::FixCallersTargetLabel());
1552 return; 1522 return;
1553 } 1523 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 1692
1723 void FlowGraphCompiler::FinalizeComments(const Code& code) { 1693 void FlowGraphCompiler::FinalizeComments(const Code& code) {
1724 code.set_comments(assembler_->GetCodeComments()); 1694 code.set_comments(assembler_->GetCodeComments());
1725 } 1695 }
1726 1696
1727 #undef __ 1697 #undef __
1728 1698
1729 } // namespace dart 1699 } // namespace dart
1730 1700
1731 #endif // defined TARGET_ARCH_X64 1701 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language_x64.cc » ('j') | runtime/vm/intermediate_language_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698