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

Side by Side Diff: vm/intermediate_language_ia32.cc

Issue 10831178: Refactor Instruction classes to use a template base class. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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 | « vm/intermediate_language.cc ('k') | vm/intermediate_language_x64.cc » ('j') | 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 compiler->GenerateInstanceOf(cid(), 1016 compiler->GenerateInstanceOf(cid(),
1017 token_pos(), 1017 token_pos(),
1018 try_index(), 1018 try_index(),
1019 type(), 1019 type(),
1020 negate_result()); 1020 negate_result());
1021 ASSERT(locs()->out().reg() == EAX); 1021 ASSERT(locs()->out().reg() == EAX);
1022 } 1022 }
1023 1023
1024 1024
1025 LocationSummary* CreateArrayComp::MakeLocationSummary() const { 1025 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
1026 return MakeCallSummary(); 1026 const intptr_t kNumInputs = 1;
Kevin Millikin (Google) 2012/08/07 10:06:03 I have a feeling that this is always InputCount()
Florian Schneider 2012/08/07 10:23:55 Yes, that will be the case once all call-instructi
1027 const intptr_t kNumTemps = 0;
1028 LocationSummary* locs =
1029 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1030 locs->set_in(0, Location::RegisterLocation(ECX));
Kevin Millikin (Google) 2012/08/07 10:06:03 I don't really like the number '0' here. It has t
Florian Schneider 2012/08/07 10:23:55 Agreed. Let's consider removing those 0s and 1s in
1031 locs->set_out(Location::RegisterLocation(EAX));
1032 return locs;
1027 } 1033 }
1028 1034
1029 1035
1030 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1036 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1031 // TODO(fschneider): Support call-instructions that take inputs in registers.
1032 // Allocate the array. EDX = length, ECX = element type. 1037 // Allocate the array. EDX = length, ECX = element type.
1033 __ popl(ECX); 1038 ASSERT(locs()->in(0).reg() == ECX);
Kevin Millikin (Google) 2012/08/07 10:06:03 There's the 0 again.
1034 __ movl(EDX, Immediate(Smi::RawValue(ElementCount()))); 1039 __ movl(EDX, Immediate(Smi::RawValue(ElementCount())));
1035 compiler->GenerateCall(token_pos(), 1040 compiler->GenerateCall(token_pos(),
1036 try_index(), 1041 try_index(),
1037 &StubCode::AllocateArrayLabel(), 1042 &StubCode::AllocateArrayLabel(),
1038 PcDescriptors::kOther); 1043 PcDescriptors::kOther);
1039 ASSERT(locs()->out().reg() == EAX); 1044 ASSERT(locs()->out().reg() == EAX);
1040 1045
1041 // Pop the element values from the stack into the array. 1046 // Pop the element values from the stack into the array.
1042 __ leal(EDX, FieldAddress(EAX, Array::data_offset())); 1047 __ leal(EDX, FieldAddress(EAX, Array::data_offset()));
1043 for (int i = ElementCount() - 1; i >= 0; --i) { 1048 for (int i = ElementCount() - 1; i >= 0; --i) {
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 ASSERT(locs()->out().reg() == EAX); 2101 ASSERT(locs()->out().reg() == EAX);
2097 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2102 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2098 EmitBranchOnCondition(compiler, branch_condition); 2103 EmitBranchOnCondition(compiler, branch_condition);
2099 } 2104 }
2100 2105
2101 } // namespace dart 2106 } // namespace dart
2102 2107
2103 #undef __ 2108 #undef __
2104 2109
2105 #endif // defined TARGET_ARCH_X64 2110 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/intermediate_language.cc ('k') | vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698