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

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

Issue 10459023: Move ExtractConstructorTypeArguments and CatchEntry 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "lib/error.h" 8 #include "lib/error.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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 __ popq(temp_reg); // Pop uninstantiated type arguments. 776 __ popq(temp_reg); // Pop uninstantiated type arguments.
777 __ popq(result_reg); // Pop instantiated type arguments. 777 __ popq(result_reg); // Pop instantiated type arguments.
778 __ Bind(&type_arguments_instantiated); 778 __ Bind(&type_arguments_instantiated);
779 ASSERT(instantiator_reg == result_reg); 779 ASSERT(instantiator_reg == result_reg);
780 // 'result_reg': Instantiated type arguments. 780 // 'result_reg': Instantiated type arguments.
781 } 781 }
782 782
783 783
784 LocationSummary* ExtractConstructorTypeArgumentsComp:: 784 LocationSummary* ExtractConstructorTypeArgumentsComp::
785 MakeLocationSummary() const { 785 MakeLocationSummary() const {
786 return NULL; 786 const intptr_t kNumInputs = 1;
787 const intptr_t kNumTemps = 1;
788 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
789 locs->set_in(0, Location::RequiresRegister());
790 locs->set_temp(0, Location::RequiresRegister());
791 locs->set_out(Location::SameAsFirstInput());
792 return locs;
787 } 793 }
788 794
789 795
790 void ExtractConstructorTypeArgumentsComp::EmitNativeCode( 796 void ExtractConstructorTypeArgumentsComp::EmitNativeCode(
791 FlowGraphCompiler* compiler) { 797 FlowGraphCompiler* compiler) {
792 UNIMPLEMENTED(); 798 Register instantiator_reg = locs()->in(0).reg();
799 Register temp_reg = locs()->temp(0).reg();
800 Register result_reg = locs()->out().reg();
Florian Schneider 2012/05/30 15:04:12 I'd add ASSERT(result_reg == instantiator_reg) her
regis 2012/05/30 15:09:10 Done.
801
802 // instantiator_reg is the instantiator type argument vector, i.e. an
803 // AbstractTypeArguments object (or null).
804 // If the instantiator is null and if the type argument vector
805 // instantiated from null becomes a vector of Dynamic, then use null as
806 // the type arguments.
807 Label type_arguments_instantiated;
808 const intptr_t len = type_arguments().Length();
809 if (type_arguments().IsRawInstantiatedRaw(len)) {
810 const Immediate raw_null =
811 Immediate(reinterpret_cast<intptr_t>(Object::null()));
812 __ cmpq(instantiator_reg, raw_null);
813 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
814 }
815 // Instantiate non-null type arguments.
816 if (type_arguments().IsUninstantiatedIdentity()) {
817 // Check if the instantiator type argument vector is a TypeArguments of a
818 // matching length and, if so, use it as the instantiated type_arguments.
819 // No need to check instantiator_reg for null here, because a null
820 // instantiator will have the wrong class (Null instead of TypeArguments).
821 Label type_arguments_uninstantiated;
822 __ LoadObject(temp_reg, Class::ZoneHandle(Object::type_arguments_class()));
823 __ cmpq(temp_reg, FieldAddress(instantiator_reg, Object::class_offset()));
824 __ j(NOT_EQUAL, &type_arguments_uninstantiated, Assembler::kNearJump);
825 Immediate arguments_length =
826 Immediate(Smi::RawValue(type_arguments().Length()));
827 __ cmpq(FieldAddress(instantiator_reg, TypeArguments::length_offset()),
828 arguments_length);
829 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump);
830 __ Bind(&type_arguments_uninstantiated);
831 }
832 // In the non-factory case, we rely on the allocation stub to
833 // instantiate the type arguments.
834 __ LoadObject(result_reg, type_arguments());
835 // result_reg: uninstantiated type arguments.
836 __ Bind(&type_arguments_instantiated);
837 // result_reg: uninstantiated or instantiated type arguments.
793 } 838 }
794 839
795 840
796 LocationSummary* ExtractConstructorInstantiatorComp:: 841 LocationSummary* ExtractConstructorInstantiatorComp::
797 MakeLocationSummary() const { 842 MakeLocationSummary() const {
798 const intptr_t kNumInputs = 1; 843 const intptr_t kNumInputs = 1;
799 const intptr_t kNumTemps = 1; 844 const intptr_t kNumTemps = 1;
800 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); 845 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
801 locs->set_in(0, Location::RequiresRegister()); 846 locs->set_in(0, Location::RequiresRegister());
802 locs->set_temp(0, Location::RequiresRegister()); 847 locs->set_temp(0, Location::RequiresRegister());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 compiler->GenerateCallRuntime(cid(), 960 compiler->GenerateCallRuntime(cid(),
916 token_index(), 961 token_index(),
917 try_index(), 962 try_index(),
918 kCloneContextRuntimeEntry); 963 kCloneContextRuntimeEntry);
919 __ popq(result); // Remove argument. 964 __ popq(result); // Remove argument.
920 __ popq(result); // Get result (cloned context). 965 __ popq(result); // Get result (cloned context).
921 } 966 }
922 967
923 968
924 LocationSummary* CatchEntryComp::MakeLocationSummary() const { 969 LocationSummary* CatchEntryComp::MakeLocationSummary() const {
925 return NULL; 970 return MakeSimpleLocationSummary(0, Location::NoLocation());
926 } 971 }
927 972
928 973
974 // Restore stack and initialize the two exception variables:
975 // exception and stack trace variables.
929 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { 976 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) {
930 UNIMPLEMENTED(); 977 // Restore RSP from RBP as we are coming from a throw and the code for
978 // popping arguments has not been run.
979 const intptr_t locals_space_size = compiler->StackSize() * kWordSize;
980 ASSERT(locals_space_size >= 0);
981 const intptr_t offset_size = -locals_space_size +
Florian Schneider 2012/05/30 15:04:12 This is a matter of taste: I prefer breaking after
regis 2012/05/30 15:09:10 Done.
982 FlowGraphCompiler::kLocalsOffsetFromFP;
983 __ leaq(RSP, Address(RBP, offset_size));
984
985 ASSERT(!exception_var().is_captured());
986 ASSERT(!stacktrace_var().is_captured());
987 __ movq(Address(RBP, exception_var().index() * kWordSize),
988 kExceptionObjectReg);
989 __ movq(Address(RBP, stacktrace_var().index() * kWordSize),
990 kStackTraceObjectReg);
931 } 991 }
932 992
933 993
934 LocationSummary* BinaryOpComp::MakeLocationSummary() const { 994 LocationSummary* BinaryOpComp::MakeLocationSummary() const {
935 const intptr_t kNumTemps = 1; 995 const intptr_t kNumTemps = 1;
936 const intptr_t kNumInputs = 2; 996 const intptr_t kNumInputs = 2;
937 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); 997 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps);
938 summary->set_in(0, Location::RequiresRegister()); 998 summary->set_in(0, Location::RequiresRegister());
939 summary->set_in(1, Location::RequiresRegister()); 999 summary->set_in(1, Location::RequiresRegister());
940 summary->set_out(Location::SameAsFirstInput()); 1000 summary->set_out(Location::SameAsFirstInput());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 if (locs()->out().reg() != RAX) { 1067 if (locs()->out().reg() != RAX) {
1008 __ movq(locs()->out().reg(), RAX); 1068 __ movq(locs()->out().reg(), RAX);
1009 } 1069 }
1010 } 1070 }
1011 1071
1012 } // namespace dart 1072 } // namespace dart
1013 1073
1014 #undef __ 1074 #undef __
1015 1075
1016 #endif // defined TARGET_ARCH_X64 1076 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698