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

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

Issue 24744002: Pattern match on generated code to find edge counters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 years, 2 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/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.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) 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4375 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4376 if (!compiler->CanFallThroughTo(normal_entry())) { 4376 if (!compiler->CanFallThroughTo(normal_entry())) {
4377 __ b(compiler->GetJumpLabel(normal_entry())); 4377 __ b(compiler->GetJumpLabel(normal_entry()));
4378 } 4378 }
4379 } 4379 }
4380 4380
4381 4381
4382 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4382 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4383 __ Bind(compiler->GetJumpLabel(this)); 4383 __ Bind(compiler->GetJumpLabel(this));
4384 if (!compiler->is_optimizing()) { 4384 if (!compiler->is_optimizing()) {
4385 compiler->EmitEdgeCounter();
4386 // Add an edge counter.
4387 // On ARM the deoptimization descriptor points after the edge counter
4388 // code so that we can reuse the same pattern matching code as at call
4389 // sites, which matches backwards from the end of the pattern.
4385 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, 4390 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4386 deopt_id_, 4391 deopt_id_,
4387 Scanner::kDummyTokenIndex); 4392 Scanner::kDummyTokenIndex);
4388 // Add an edge counter.
4389 const Array& counter = Array::ZoneHandle(Array::New(1, Heap::kOld));
4390 counter.SetAt(0, Smi::Handle(Smi::New(0)));
4391 __ Comment("Edge counter");
4392 __ LoadObject(R0, counter);
4393 __ ldr(IP, FieldAddress(R0, Array::element_offset(0)));
4394 __ adds(IP, IP, ShifterOperand(Smi::RawValue(1)));
4395 __ LoadImmediate(IP, Smi::RawValue(Smi::kMaxValue), VS); // If overflow.
4396 __ str(IP, FieldAddress(R0, Array::element_offset(0)));
4397 } 4393 }
4398 if (HasParallelMove()) { 4394 if (HasParallelMove()) {
4399 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4395 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4400 } 4396 }
4401 } 4397 }
4402 4398
4403 4399
4404 LocationSummary* GotoInstr::MakeLocationSummary() const { 4400 LocationSummary* GotoInstr::MakeLocationSummary() const {
4405 return new LocationSummary(0, 0, LocationSummary::kNoCall); 4401 return new LocationSummary(0, 0, LocationSummary::kNoCall);
4406 } 4402 }
4407 4403
4408 4404
4409 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4405 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4406 if (!compiler->is_optimizing()) {
4407 compiler->EmitEdgeCounter();
4408 // Add a deoptimization descriptor for deoptimizing instructions that
4409 // may be inserted before this instruction. On ARM this descriptor
4410 // points after the edge counter code so that we can reuse the same
4411 // pattern matching code as at call sites, which matches backwards from
4412 // the end of the pattern.
4413 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
4414 GetDeoptId(),
4415 Scanner::kDummyTokenIndex);
4416 }
4410 if (HasParallelMove()) { 4417 if (HasParallelMove()) {
4411 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); 4418 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
4412 } 4419 }
4413 4420
4414 // We can fall through if the successor is the next block in the list. 4421 // We can fall through if the successor is the next block in the list.
4415 // Otherwise, we need a jump. 4422 // Otherwise, we need a jump.
4416 if (!compiler->CanFallThroughTo(successor())) { 4423 if (!compiler->CanFallThroughTo(successor())) {
4417 __ b(compiler->GetJumpLabel(successor())); 4424 __ b(compiler->GetJumpLabel(successor()));
4418 } 4425 }
4419 } 4426 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
4616 compiler->GenerateCall(token_pos(), 4623 compiler->GenerateCall(token_pos(),
4617 &label, 4624 &label,
4618 PcDescriptors::kOther, 4625 PcDescriptors::kOther,
4619 locs()); 4626 locs());
4620 __ Drop(2); // Discard type arguments and receiver. 4627 __ Drop(2); // Discard type arguments and receiver.
4621 } 4628 }
4622 4629
4623 } // namespace dart 4630 } // namespace dart
4624 4631
4625 #endif // defined TARGET_ARCH_ARM 4632 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698