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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_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 4296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 4307
4308 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4308 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4309 compiler->GenerateCallRuntime(token_pos(), 4309 compiler->GenerateCallRuntime(token_pos(),
4310 deopt_id(), 4310 deopt_id(),
4311 kReThrowRuntimeEntry, 4311 kReThrowRuntimeEntry,
4312 locs()); 4312 locs());
4313 __ int3(); 4313 __ int3();
4314 } 4314 }
4315 4315
4316 4316
4317 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4318 __ Bind(compiler->GetJumpLabel(this));
4319 if (!compiler->is_optimizing()) {
4320 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4321 deopt_id_,
4322 Scanner::kDummyTokenIndex);
4323 // Add an edge counter.
srdjan 2013/08/14 00:28:24 I would add/use special counter objects, that way
4324 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
4325 counter.SetAt(0, Smi::Handle(Smi::New(0)));
4326 Label done;
4327 __ Comment("Edge counter");
4328 __ LoadObject(EAX, counter);
4329 __ addl(FieldAddress(EAX, Array::element_offset(0)),
4330 Immediate(Smi::RawValue(1)));
4331 __ j(NO_OVERFLOW, &done);
4332 __ movl(FieldAddress(EAX, Array::element_offset(0)),
4333 Immediate(Smi::RawValue(Smi::kMaxValue)));
4334 __ Bind(&done);
4335 }
4336 if (HasParallelMove()) {
4337 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4338 }
4339 }
4340
4341
4317 LocationSummary* GotoInstr::MakeLocationSummary() const { 4342 LocationSummary* GotoInstr::MakeLocationSummary() const {
4318 return new LocationSummary(0, 0, LocationSummary::kNoCall); 4343 return new LocationSummary(0, 0, LocationSummary::kNoCall);
4319 } 4344 }
4320 4345
4321 4346
4322 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4347 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4348 if (!compiler->is_optimizing()) {
4349 // Add deoptimization descriptor for deoptimizing instructions that may
4350 // be inserted before this instruction.
4351 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4352 GetDeoptId(),
4353 0); // No token position.
4354 // Add an edge counter.
4355 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
4356 counter.SetAt(0, Smi::Handle(Smi::New(0)));
4357 Label done;
4358 __ Comment("Edge counter");
4359 __ LoadObject(EAX, counter);
4360 __ addl(FieldAddress(EAX, Array::element_offset(0)),
4361 Immediate(Smi::RawValue(1)));
4362 __ j(NO_OVERFLOW, &done);
4363 __ movl(FieldAddress(EAX, Array::element_offset(0)),
4364 Immediate(Smi::RawValue(Smi::kMaxValue)));
4365 __ Bind(&done);
4366 }
4323 if (HasParallelMove()) { 4367 if (HasParallelMove()) {
4324 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4368 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4325 } 4369 }
4326 4370
4327 // We can fall through if the successor is the next block in the list. 4371 // We can fall through if the successor is the next block in the list.
4328 // Otherwise, we need a jump. 4372 // Otherwise, we need a jump.
4329 if (!compiler->CanFallThroughTo(successor())) { 4373 if (!compiler->CanFallThroughTo(successor())) {
4330 __ jmp(compiler->GetJumpLabel(successor())); 4374 __ jmp(compiler->GetJumpLabel(successor()));
4331 } 4375 }
4332 } 4376 }
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
4747 PcDescriptors::kOther, 4791 PcDescriptors::kOther,
4748 locs()); 4792 locs());
4749 __ Drop(2); // Discard type arguments and receiver. 4793 __ Drop(2); // Discard type arguments and receiver.
4750 } 4794 }
4751 4795
4752 } // namespace dart 4796 } // namespace dart
4753 4797
4754 #undef __ 4798 #undef __
4755 4799
4756 #endif // defined TARGET_ARCH_IA32 4800 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698