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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 11956004: Fix vm code base so that it can be built for --arch=simarm (no snapshot yet). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
===================================================================
--- runtime/vm/intermediate_language.cc (revision 17245)
+++ runtime/vm/intermediate_language.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -1902,116 +1902,7 @@
UNREACHABLE();
}
-LocationSummary* ThrowInstr::MakeLocationSummary() const {
- return new LocationSummary(0, 0, LocationSummary::kCall);
-}
-
-
-void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- compiler->GenerateCallRuntime(token_pos(),
- kThrowRuntimeEntry,
- locs());
- __ int3();
-}
-
-
-LocationSummary* ReThrowInstr::MakeLocationSummary() const {
- return new LocationSummary(0, 0, LocationSummary::kCall);
-}
-
-
-void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- compiler->GenerateCallRuntime(token_pos(),
- kReThrowRuntimeEntry,
- locs());
- __ int3();
-}
-
-
-LocationSummary* GotoInstr::MakeLocationSummary() const {
- return new LocationSummary(0, 0, LocationSummary::kNoCall);
-}
-
-
-void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- // Add deoptimization descriptor for deoptimizing instructions
- // that may be inserted before this instruction.
- if (!compiler->is_optimizing()) {
- compiler->AddCurrentDescriptor(PcDescriptors::kDeoptBefore,
- GetDeoptId(),
- 0); // No token position.
- }
-
- if (HasParallelMove()) {
- compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
- }
-
- // We can fall through if the successor is the next block in the list.
- // Otherwise, we need a jump.
- if (!compiler->IsNextBlock(successor())) {
- __ jmp(compiler->GetBlockLabel(successor()));
- }
-}
-
-
-static Condition NegateCondition(Condition condition) {
- switch (condition) {
- case EQUAL: return NOT_EQUAL;
- case NOT_EQUAL: return EQUAL;
- case LESS: return GREATER_EQUAL;
- case LESS_EQUAL: return GREATER;
- case GREATER: return LESS_EQUAL;
- case GREATER_EQUAL: return LESS;
- case BELOW: return ABOVE_EQUAL;
- case BELOW_EQUAL: return ABOVE;
- case ABOVE: return BELOW_EQUAL;
- case ABOVE_EQUAL: return BELOW;
- default:
- OS::Print("Error %d\n", condition);
- UNIMPLEMENTED();
- return EQUAL;
- }
-}
-
-
-void ControlInstruction::EmitBranchOnValue(FlowGraphCompiler* compiler,
- bool value) {
- if (value && compiler->IsNextBlock(false_successor())) {
- __ jmp(compiler->GetBlockLabel(true_successor()));
- } else if (!value && compiler->IsNextBlock(true_successor())) {
- __ jmp(compiler->GetBlockLabel(false_successor()));
- }
-}
-
-
-void ControlInstruction::EmitBranchOnCondition(FlowGraphCompiler* compiler,
- Condition true_condition) {
- if (compiler->IsNextBlock(false_successor())) {
- // If the next block is the false successor we will fall through to it.
- __ j(true_condition, compiler->GetBlockLabel(true_successor()));
- } else {
- // If the next block is the true successor we negate comparison and fall
- // through to it.
- ASSERT(compiler->IsNextBlock(true_successor()));
- Condition false_condition = NegateCondition(true_condition);
- __ j(false_condition, compiler->GetBlockLabel(false_successor()));
- }
-}
-
-
-LocationSummary* CurrentContextInstr::MakeLocationSummary() const {
- return LocationSummary::Make(0,
- Location::RequiresRegister(),
- LocationSummary::kNoCall);
-}
-
-
-void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ MoveRegister(locs()->out().reg(), CTX);
-}
-
-
LocationSummary* StoreContextInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
@@ -2037,107 +1928,6 @@
}
-LocationSummary* StrictCompareInstr::MakeLocationSummary() const {
- const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- locs->set_in(0, Location::RegisterOrConstant(left()));
- locs->set_in(1, Location::RegisterOrConstant(right()));
- locs->set_out(Location::RequiresRegister());
- return locs;
-}
-
-
-// Special code for numbers (compare values instead of references.)
-void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
- Location left = locs()->in(0);
- Location right = locs()->in(1);
- if (left.IsConstant() && right.IsConstant()) {
- // TODO(vegorov): should be eliminated earlier by constant propagation.
- const bool result = (kind() == Token::kEQ_STRICT) ?
- left.constant().raw() == right.constant().raw() :
- left.constant().raw() != right.constant().raw();
- __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False());
- return;
- }
- if (left.IsConstant()) {
- compiler->EmitEqualityRegConstCompare(right.reg(),
- left.constant(),
- needs_number_check());
- } else if (right.IsConstant()) {
- compiler->EmitEqualityRegConstCompare(left.reg(),
- right.constant(),
- needs_number_check());
- } else {
- compiler->EmitEqualityRegRegCompare(left.reg(),
- right.reg(),
- needs_number_check());
- }
-
- Register result = locs()->out().reg();
- Label load_true, done;
- Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL;
- __ j(true_condition, &load_true, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
- __ jmp(&done, Assembler::kNearJump);
- __ Bind(&load_true);
- __ LoadObject(result, Bool::True());
- __ Bind(&done);
-}
-
-
-void StrictCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
- BranchInstr* branch) {
- ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
- Location left = locs()->in(0);
- Location right = locs()->in(1);
- if (left.IsConstant() && right.IsConstant()) {
- // TODO(vegorov): should be eliminated earlier by constant propagation.
- const bool result = (kind() == Token::kEQ_STRICT) ?
- left.constant().raw() == right.constant().raw() :
- left.constant().raw() != right.constant().raw();
- branch->EmitBranchOnValue(compiler, result);
- return;
- }
- if (left.IsConstant()) {
- compiler->EmitEqualityRegConstCompare(right.reg(),
- left.constant(),
- needs_number_check());
- } else if (right.IsConstant()) {
- compiler->EmitEqualityRegConstCompare(left.reg(),
- right.constant(),
- needs_number_check());
- } else {
- compiler->EmitEqualityRegRegCompare(left.reg(),
- right.reg(),
- needs_number_check());
- }
-
- Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL;
- branch->EmitBranchOnCondition(compiler, true_condition);
-}
-
-
-void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- // The arguments to the stub include the closure, as does the arguments
- // descriptor.
- Register temp_reg = locs()->temp(0).reg();
- int argument_count = ArgumentCount();
- const Array& arguments_descriptor =
- Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
- argument_names()));
- __ LoadObject(temp_reg, arguments_descriptor);
- compiler->GenerateDartCall(deopt_id(),
- token_pos(),
- &StubCode::CallClosureFunctionLabel(),
- PcDescriptors::kOther,
- locs());
- __ Drop(argument_count);
-}
-
-
LocationSummary* InstanceCallInstr::MakeLocationSummary() const {
return MakeCallSummary();
}
@@ -2225,107 +2015,6 @@
}
-LocationSummary* BooleanNegateInstr::MakeLocationSummary() const {
- return LocationSummary::Make(1,
- Location::RequiresRegister(),
- LocationSummary::kNoCall);
-}
-
-
-void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register value = locs()->in(0).reg();
- Register result = locs()->out().reg();
-
- Label done;
- __ LoadObject(result, Bool::True());
- __ CompareRegisters(result, value);
- __ j(NOT_EQUAL, &done, Assembler::kNearJump);
- __ LoadObject(result, Bool::False());
- __ Bind(&done);
-}
-
-
-LocationSummary* ChainContextInstr::MakeLocationSummary() const {
- return LocationSummary::Make(1,
- Location::NoLocation(),
- LocationSummary::kNoCall);
-}
-
-
-void ChainContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register context_value = locs()->in(0).reg();
-
- // Chain the new context in context_value to its parent in CTX.
- __ StoreIntoObject(context_value,
- FieldAddress(context_value, Context::parent_offset()),
- CTX);
- // Set new context as current context.
- __ MoveRegister(CTX, context_value);
-}
-
-
-LocationSummary* StoreVMFieldInstr::MakeLocationSummary() const {
- const intptr_t kNumInputs = 2;
- const intptr_t kNumTemps = 0;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister()
- : Location::RequiresRegister());
- locs->set_in(1, Location::RequiresRegister());
- return locs;
-}
-
-
-void StoreVMFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register value_reg = locs()->in(0).reg();
- Register dest_reg = locs()->in(1).reg();
-
- if (value()->NeedsStoreBuffer()) {
- __ StoreIntoObject(dest_reg, FieldAddress(dest_reg, offset_in_bytes()),
- value_reg);
- } else {
- __ StoreIntoObjectNoBarrier(
- dest_reg, FieldAddress(dest_reg, offset_in_bytes()), value_reg);
- }
-}
-
-
-LocationSummary* AllocateObjectInstr::MakeLocationSummary() const {
- return MakeCallSummary();
-}
-
-
-void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const Class& cls = Class::ZoneHandle(constructor().Owner());
- const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls));
- const ExternalLabel label(cls.ToCString(), stub.EntryPoint());
- compiler->GenerateCall(token_pos(),
- &label,
- PcDescriptors::kOther,
- locs());
- __ Drop(ArgumentCount()); // Discard arguments.
-}
-
-
-LocationSummary* CreateClosureInstr::MakeLocationSummary() const {
- return MakeCallSummary();
-}
-
-
-void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const Function& closure_function = function();
- ASSERT(!closure_function.IsImplicitStaticClosureFunction());
- const Code& stub = Code::Handle(
- StubCode::GetAllocationStubForClosure(closure_function));
- const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
- compiler->GenerateCall(token_pos(),
- &label,
- PcDescriptors::kOther,
- locs());
- __ Drop(2); // Discard type arguments and receiver.
-}
-
-
Environment* Environment::From(const GrowableArray<Definition*>& definitions,
intptr_t fixed_parameter_count,
const Function& function) {
@@ -3005,7 +2694,6 @@
}
}
-
#undef __
} // namespace dart
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698