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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 10382234: Introduce locations based code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed Srdjan comments Created 8 years, 7 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_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f0b3173ff79b80306a6337d1156e71d671279685
--- /dev/null
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -0,0 +1,66 @@
+// Copyright (c) 2012, 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.
+
+#include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
+#if defined(TARGET_ARCH_X64)
+
+#include "vm/flow_graph_compiler.h"
+#include "vm/locations.h"
+
+#define __ compiler->assembler()->
+
+namespace dart {
+
+
+static LocationSummary* MakeSimpleLocationSummary(
+ intptr_t input_count, Location out) {
+ LocationSummary* summary = new LocationSummary(input_count);
+ for (intptr_t i = 0; i < input_count; i++) {
+ summary->set_in(i, UnallocatedLocation::Register());
+ }
+ summary->set_out(out);
+ return summary;
+}
+
+
+LocationSummary* StrictCompareComp::MakeLocationSummary() {
+ return MakeSimpleLocationSummary(2, UnallocatedLocation::SameAsFirstInput());
+}
+
+
+void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Bool& bool_true = Bool::ZoneHandle(Bool::True());
+ const Bool& bool_false = Bool::ZoneHandle(Bool::False());
+
+ Register left = locs()->in(0).AsRegister();
+ Register right = locs()->in(1).AsRegister();
+ Register result = locs()->out().AsRegister();
+
+ __ cmpq(left, right);
+ Label load_true, done;
+ if (kind() == Token::kEQ_STRICT) {
+ __ j(EQUAL, &load_true, Assembler::kNearJump);
+ } else {
+ __ j(NOT_EQUAL, &load_true, Assembler::kNearJump);
+ }
+ __ LoadObject(result, bool_false);
+ __ jmp(&done, Assembler::kNearJump);
+ __ Bind(&load_true);
+ __ LoadObject(result, bool_true);
+ __ Bind(&done);
+}
+
+
+void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ computation()->EmitNativeCode(compiler);
+ __ pushq(locs()->out().AsRegister());
+}
+
+
+#undef __
+
+
+} // namespace dart
+
+#endif // defined TARGET_ARCH_X64

Powered by Google App Engine
This is Rietveld 408576698