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

Unified Diff: src/compiler/raw-machine-assembler.h

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 | « src/compiler/pipeline.cc ('k') | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/raw-machine-assembler.h
diff --git a/src/compiler/raw-machine-assembler.h b/src/compiler/raw-machine-assembler.h
new file mode 100644
index 0000000000000000000000000000000000000000..16aa1eff9bea53fdc7182189f6dd75181465e5ad
--- /dev/null
+++ b/src/compiler/raw-machine-assembler.h
@@ -0,0 +1,130 @@
+// 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.
+
+#ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
+#define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
+
+#include "src/v8.h"
+
+#include "src/compiler/common-operator.h"
+#include "src/compiler/graph-builder.h"
+#include "src/compiler/machine-node-factory.h"
+#include "src/compiler/machine-operator.h"
+#include "src/compiler/node.h"
+#include "src/compiler/operator.h"
+
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+class BasicBlock;
+class Schedule;
+
+
+class RawMachineAssembler : public GraphBuilder,
+ public MachineNodeFactory<RawMachineAssembler> {
+ public:
+ class Label {
+ public:
+ Label() : block_(NULL), used_(false), bound_(false) {}
+ ~Label() { ASSERT(bound_ || !used_); }
+
+ BasicBlock* block() { return block_; }
+
+ private:
+ // Private constructor for exit label.
+ explicit Label(BasicBlock* block)
+ : block_(block), used_(false), bound_(false) {}
+
+ BasicBlock* block_;
+ bool used_;
+ bool bound_;
+ friend class RawMachineAssembler;
+ DISALLOW_COPY_AND_ASSIGN(Label);
+ };
+
+ RawMachineAssembler(
+ Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder,
+ MachineRepresentation word = MachineOperatorBuilder::pointer_rep());
+ virtual ~RawMachineAssembler() {}
+
+ Isolate* isolate() const { return zone()->isolate(); }
+ Zone* zone() const { return graph()->zone(); }
+ MachineOperatorBuilder* machine() { return &machine_; }
+ CommonOperatorBuilder* common() { return &common_; }
+ CallDescriptor* call_descriptor() const {
+ return call_descriptor_builder_->BuildCallDescriptor(zone());
+ }
+ int parameter_count() const {
+ return call_descriptor_builder_->parameter_count();
+ }
+ const MachineRepresentation* parameter_types() const {
+ return call_descriptor_builder_->parameter_types();
+ }
+
+ // Parameters.
+ Node* Parameter(int index);
+
+ // Control flow.
+ Label* Exit();
+ void Goto(Label* label);
+ void Branch(Node* condition, Label* true_val, Label* false_val);
+ // Call to a JS function with zero parameters.
+ Node* CallJS0(Node* function, Node* receiver, Label* continuation,
+ Label* deoptimization);
+ // Call to a runtime function with zero parameters.
+ Node* CallRuntime1(Runtime::FunctionId function, Node* arg0,
+ Label* continuation, Label* deoptimization);
+ void Return(Node* value);
+ void Bind(Label* label);
+ void Deoptimize(Node* state);
+
+ // Variables.
+ Node* Phi(Node* n1, Node* n2) { return NewNode(common()->Phi(2), n1, n2); }
+ Node* Phi(Node* n1, Node* n2, Node* n3) {
+ return NewNode(common()->Phi(3), n1, n2, n3);
+ }
+ Node* Phi(Node* n1, Node* n2, Node* n3, Node* n4) {
+ return NewNode(common()->Phi(4), n1, n2, n3, n4);
+ }
+
+ // MachineAssembler is invalid after export.
+ Schedule* Export();
+
+ protected:
+ virtual Node* MakeNode(Operator* op, int input_count, Node** inputs);
+
+ Schedule* schedule() {
+ ASSERT(ScheduleValid());
+ return schedule_;
+ }
+
+ private:
+ bool ScheduleValid() { return schedule_ != NULL; }
+
+ BasicBlock* Use(Label* label);
+ BasicBlock* EnsureBlock(Label* label);
+ BasicBlock* CurrentBlock();
+
+ typedef std::vector<MachineRepresentation,
+ zone_allocator<MachineRepresentation> >
+ RepresentationVector;
+
+ Schedule* schedule_;
+ MachineOperatorBuilder machine_;
+ CommonOperatorBuilder common_;
+ MachineCallDescriptorBuilder* call_descriptor_builder_;
+ Node** parameters_;
+ Label exit_label_;
+ BasicBlock* current_block_;
+
+ DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler);
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698