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

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

Issue 18111006: Collect edge count profiling data and reorder basic blocks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 4134
4135 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4135 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4136 compiler->GenerateCallRuntime(token_pos(), 4136 compiler->GenerateCallRuntime(token_pos(),
4137 deopt_id(), 4137 deopt_id(),
4138 kReThrowRuntimeEntry, 4138 kReThrowRuntimeEntry,
4139 locs()); 4139 locs());
4140 __ int3(); 4140 __ int3();
4141 } 4141 }
4142 4142
4143 4143
4144 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4145 __ Bind(compiler->GetJumpLabel(this));
4146 if (!compiler->is_optimizing()) {
4147 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4148 deopt_id_,
4149 Scanner::kDummyTokenIndex);
4150 // Add an edge counter.
4151 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
4152 counter.SetAt(0, Smi::Handle(Smi::New(0)));
4153 Label done;
4154 __ Comment("Edge counter");
4155 __ LoadObject(RAX, counter);
4156 __ addq(FieldAddress(RAX, Array::element_offset(0)),
4157 Immediate(Smi::RawValue(1)));
4158 __ j(NO_OVERFLOW, &done);
4159 __ movq(FieldAddress(RAX, Array::element_offset(0)),
4160 Immediate(Smi::RawValue(Smi::kMaxValue)));
4161 __ Bind(&done);
4162 }
4163 if (HasParallelMove()) {
4164 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4165 }
4166 }
4167
4168
4144 LocationSummary* GotoInstr::MakeLocationSummary() const { 4169 LocationSummary* GotoInstr::MakeLocationSummary() const {
4145 return new LocationSummary(0, 0, LocationSummary::kNoCall); 4170 return new LocationSummary(0, 0, LocationSummary::kNoCall);
4146 } 4171 }
4147 4172
4148 4173
4149 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4174 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4175 if (!compiler->is_optimizing()) {
4176 // Add deoptimization descriptor for deoptimizing instructions that may
4177 // be inserted before this instruction.
4178 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4179 GetDeoptId(),
4180 0); // No token position.
4181 // Add an edge counter.
4182 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
4183 counter.SetAt(0, Smi::Handle(Smi::New(0)));
4184 Label done;
4185 __ Comment("Edge counter");
4186 __ LoadObject(RAX, counter);
4187 __ addq(FieldAddress(RAX, Array::element_offset(0)),
4188 Immediate(Smi::RawValue(1)));
4189 __ j(NO_OVERFLOW, &done);
4190 __ movq(FieldAddress(RAX, Array::element_offset(0)),
4191 Immediate(Smi::RawValue(Smi::kMaxValue)));
4192 __ Bind(&done);
4193 }
4150 if (HasParallelMove()) { 4194 if (HasParallelMove()) {
4151 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4195 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4152 } 4196 }
4153 4197
4154 // We can fall through if the successor is the next block in the list. 4198 // We can fall through if the successor is the next block in the list.
4155 // Otherwise, we need a jump. 4199 // Otherwise, we need a jump.
4156 if (!compiler->CanFallThroughTo(successor())) { 4200 if (!compiler->CanFallThroughTo(successor())) {
4157 __ jmp(compiler->GetJumpLabel(successor())); 4201 __ jmp(compiler->GetJumpLabel(successor()));
4158 } 4202 }
4159 } 4203 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
4417 PcDescriptors::kOther, 4461 PcDescriptors::kOther,
4418 locs()); 4462 locs());
4419 __ Drop(2); // Discard type arguments and receiver. 4463 __ Drop(2); // Discard type arguments and receiver.
4420 } 4464 }
4421 4465
4422 } // namespace dart 4466 } // namespace dart
4423 4467
4424 #undef __ 4468 #undef __
4425 4469
4426 #endif // defined TARGET_ARCH_X64 4470 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698