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

Unified Diff: test/cctest/compiler/compiler/graph-builder-tester.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/compiler/graph-tester.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/compiler/graph-builder-tester.cc
diff --git a/test/cctest/compiler/compiler/graph-builder-tester.cc b/test/cctest/compiler/compiler/graph-builder-tester.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2d8f9d593eae859b97999db1a55d160191738ca3
--- /dev/null
+++ b/test/cctest/compiler/compiler/graph-builder-tester.cc
@@ -0,0 +1,64 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "test/cctest/compiler/graph-builder-tester.h"
+#include "src/compiler/pipeline.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+MachineCallHelper::MachineCallHelper(Zone* zone,
+ MachineCallDescriptorBuilder* builder)
+ : CallHelper(zone->isolate()),
+ call_descriptor_builder_(builder),
+ parameters_(NULL),
+ graph_(NULL) {}
+
+
+void MachineCallHelper::InitParameters(GraphBuilder* builder,
+ CommonOperatorBuilder* common) {
+ ASSERT_EQ(NULL, parameters_);
+ graph_ = builder->graph();
+ if (parameter_count() == 0) return;
+ parameters_ = builder->graph()->zone()->NewArray<Node*>(parameter_count());
+ for (int i = 0; i < parameter_count(); ++i) {
+ parameters_[i] = builder->NewNode(common->Parameter(i));
+ }
+}
+
+
+byte* MachineCallHelper::Generate() {
+ ASSERT(parameter_count() == 0 || parameters_ != NULL);
+ if (code_.is_null()) {
+ Zone* zone = graph_->zone();
+ CompilationInfo info(zone->isolate(), zone);
+ Linkage linkage(&info, call_descriptor_builder_->BuildCallDescriptor(zone));
+ Pipeline pipeline(&info);
+ code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_);
+ }
+ return code_.ToHandleChecked()->entry();
+}
+
+
+void MachineCallHelper::VerifyParameters(
+ int parameter_count, MachineRepresentation* parameter_types) {
+ CHECK_EQ(this->parameter_count(), parameter_count);
+ const MachineRepresentation* expected_types =
+ call_descriptor_builder_->parameter_types();
+ for (int i = 0; i < parameter_count; i++) {
+ CHECK_EQ(expected_types[i], parameter_types[i]);
+ }
+}
+
+
+Node* MachineCallHelper::Parameter(int offset) {
+ ASSERT_NE(NULL, parameters_);
+ ASSERT(0 <= offset && offset < parameter_count());
+ return parameters_[offset];
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
« no previous file with comments | « test/cctest/compiler/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/compiler/graph-tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698