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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 14740005: Initial support for polymorphic inlining. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index b085eed1ae17e8bcad95bc3a5199f42d51a7fc60..8692beb1ebd2d2814d6ed0ecd20edba4723e1a5b 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -1077,13 +1077,10 @@ static bool CanBeImmediateIndex(Value* index, intptr_t cid) {
LocationSummary* StringFromCharCodeInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
// TODO(fschneider): Allow immediate operands for the char code.
- locs->set_in(0, Location::RequiresRegister());
- locs->set_out(Location::RequiresRegister());
- return locs;
+ return LocationSummary::Make(kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
}
@@ -1101,12 +1098,9 @@ void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* LoadUntaggedInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- locs->set_in(0, Location::RequiresRegister());
- locs->set_out(Location::RequiresRegister());
- return locs;
+ return LocationSummary::Make(kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
}
@@ -1117,6 +1111,29 @@ void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* LoadClassIdInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 1;
+ return LocationSummary::Make(kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
+}
+
+
+void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Register object = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+ Label load, done;
+ __ testl(object, Immediate(kSmiTagMask));
srdjan 2013/05/02 20:06:30 We may be able to determine that object is never S
+ __ j(NOT_ZERO, &load, Assembler::kNearJump);
+ __ movl(result, Immediate(Smi::RawValue(kSmiCid)));
+ __ jmp(&done);
+ __ Bind(&load);
+ __ LoadClassId(result, object);
+ __ SmiTag(result);
+ __ Bind(&done);
+}
+
+
CompileType LoadIndexedInstr::ComputeType() const {
switch (class_id_) {
case kArrayCid:
@@ -3184,12 +3201,9 @@ void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
- const intptr_t kNumTemps = 0;
- LocationSummary* summary =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- summary->set_in(0, Location::RequiresRegister());
- summary->set_out(Location::SameAsFirstInput());
- return summary;
+ return LocationSummary::Make(kNumInputs,
+ Location::SameAsFirstInput(),
+ LocationSummary::kNoCall);
}
@@ -3267,7 +3281,7 @@ void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0));
const intptr_t kNumberOfArguments = 1;
- compiler->GenerateStaticCall(instance_call()->deopt_id(),
+ compiler->GenerateStaticCall(deopt_id(),
instance_call()->token_pos(),
target,
kNumberOfArguments,
@@ -3363,7 +3377,7 @@ LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary() const {
void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(),
+ Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptPolymorphicInstanceCallTestFail);
if (ic_data().NumberOfChecks() == 0) {
__ jmp(deopt);
@@ -3373,7 +3387,7 @@ void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (!with_checks()) {
ASSERT(ic_data().HasOneTarget());
const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
- compiler->GenerateStaticCall(instance_call()->deopt_id(),
+ compiler->GenerateStaticCall(deopt_id(),
instance_call()->token_pos(),
target,
instance_call()->ArgumentCount(),
@@ -3394,7 +3408,7 @@ void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
instance_call()->ArgumentCount(),
instance_call()->argument_names(),
deopt,
- instance_call()->deopt_id(),
+ deopt_id(),
instance_call()->token_pos(),
locs());
}

Powered by Google App Engine
This is Rietveld 408576698