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

Side by Side Diff: vm/intermediate_language_x64.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
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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 compiler->GenerateInstanceOf(cid(), 1030 compiler->GenerateInstanceOf(cid(),
1031 token_pos(), 1031 token_pos(),
1032 try_index(), 1032 try_index(),
1033 type(), 1033 type(),
1034 negate_result()); 1034 negate_result());
1035 ASSERT(locs()->out().reg() == RAX); 1035 ASSERT(locs()->out().reg() == RAX);
1036 } 1036 }
1037 1037
1038 1038
1039 LocationSummary* CreateArrayComp::MakeLocationSummary() const { 1039 LocationSummary* CreateArrayComp::MakeLocationSummary() const {
1040 return MakeCallSummary(); 1040 const intptr_t kNumInputs = 1;
1041 const intptr_t kNumTemps = 0;
1042 LocationSummary* locs =
1043 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
1044 locs->set_in(0, Location::RegisterLocation(RBX));
1045 locs->set_out(Location::RegisterLocation(RAX));
1046 return locs;
1041 } 1047 }
1042 1048
1043 1049
1044 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1050 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1045 // TODO(fschneider): Support call-instructions that take inputs in registers.
1046 // Allocate the array. R10 = length, RBX = element type. 1051 // Allocate the array. R10 = length, RBX = element type.
1047 __ popq(RBX); 1052 ASSERT(locs()->in(0).reg() == RBX);
1048 __ movq(R10, Immediate(Smi::RawValue(ElementCount()))); 1053 __ movq(R10, Immediate(Smi::RawValue(ElementCount())));
1049 compiler->GenerateCall(token_pos(), 1054 compiler->GenerateCall(token_pos(),
1050 try_index(), 1055 try_index(),
1051 &StubCode::AllocateArrayLabel(), 1056 &StubCode::AllocateArrayLabel(),
1052 PcDescriptors::kOther); 1057 PcDescriptors::kOther);
1053 ASSERT(locs()->out().reg() == RAX); 1058 ASSERT(locs()->out().reg() == RAX);
1054 1059
1055 // Pop the element values from the stack into the array. 1060 // Pop the element values from the stack into the array.
1056 __ leaq(R10, FieldAddress(RAX, Array::data_offset())); 1061 __ leaq(R10, FieldAddress(RAX, Array::data_offset()));
1057 for (int i = ElementCount() - 1; i >= 0; --i) { 1062 for (int i = ElementCount() - 1; i >= 0; --i) {
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 ASSERT(locs()->out().reg() == RAX); 2108 ASSERT(locs()->out().reg() == RAX);
2104 __ CompareObject(locs()->out().reg(), compiler->bool_true()); 2109 __ CompareObject(locs()->out().reg(), compiler->bool_true());
2105 EmitBranchOnCondition(compiler, branch_condition); 2110 EmitBranchOnCondition(compiler, branch_condition);
2106 } 2111 }
2107 2112
2108 } // namespace dart 2113 } // namespace dart
2109 2114
2110 #undef __ 2115 #undef __
2111 2116
2112 #endif // defined TARGET_ARCH_X64 2117 #endif // defined TARGET_ARCH_X64
OLDNEW
« vm/intermediate_language_ia32.cc ('K') | « vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698