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

Unified Diff: src/compiler/code-stub-assembler.h

Issue 1475953002: [stubs] A new approach to TF stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge with ToT Created 5 years 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: src/compiler/code-stub-assembler.h
diff --git a/src/compiler/code-stub-assembler.h b/src/compiler/code-stub-assembler.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9190e262acdce123f3e1053b31a831540a95725
--- /dev/null
+++ b/src/compiler/code-stub-assembler.h
@@ -0,0 +1,107 @@
+// Copyright 2015 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_CODE_STUB_ASSEMBLER_H_
+#define V8_COMPILER_CODE_STUB_ASSEMBLER_H_
+
+// Clients of this interface shouldn't depend on lots of compiler internals.
+// Do not include anything from src/compiler here!
+#include "src/allocation.h"
+#include "src/base/smart-pointers.h"
+#include "src/builtins.h"
+#include "src/frames.h"
+#include "src/interpreter/bytecodes.h"
Michael Starzinger 2015/12/01 18:06:53 nit: The "bytecodes.h" header shouldn't be needed
danno 2015/12/02 07:00:19 Done.
+#include "src/runtime/runtime.h"
+#include "src/zone-containers.h"
+
+namespace v8 {
+namespace internal {
+
+class CallInterfaceDescriptor;
+class Isolate;
+class Zone;
+
+namespace compiler {
+
+class CallDescriptor;
+class Graph;
+class Node;
+class Operator;
+class RawMachineAssembler;
+class Schedule;
+
+class CodeStubAssembler {
adamk 2015/12/01 19:27:30 Would love to see documentation for this class som
danno 2015/12/02 07:00:19 Agreed. The InterpreterAssembler doesn't have any
+ public:
+ CodeStubAssembler(Isolate* isolate, Zone* zone,
+ const CallInterfaceDescriptor& descriptor, Code::Kind kind,
+ const char* name);
+ virtual ~CodeStubAssembler();
+
+ Handle<Code> GenerateCode();
+
+ // Constants.
+ Node* Int32Constant(int value);
+ Node* IntPtrConstant(intptr_t value);
+ Node* NumberConstant(double value);
+ Node* HeapConstant(Handle<HeapObject> object);
+ Node* BooleanConstant(bool value);
+
+ Node* Parameter(int value);
+ void Return(Node* value);
+
+ // Tag and untag Smi values.
+ Node* SmiTag(Node* value);
+ Node* SmiUntag(Node* value);
+
+ // Basic arithmetic operations.
+ Node* IntPtrAdd(Node* a, Node* b);
+ Node* IntPtrSub(Node* a, Node* b);
+ Node* WordShl(Node* value, int shift);
+
+ // Load a field from an object on the heap.
+ Node* LoadObjectField(Node* object, int offset);
+
+ // Call runtime function.
+ Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1);
+ Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1,
+ Node* arg2);
+
+ Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
+ Node* arg1);
+ Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context,
+ Node* arg1, Node* arg2);
+
+ private:
+ friend class CodeStubAssemblerTester;
+ // Close the graph.
+ void End();
+
+ Graph* graph();
Michael Starzinger 2015/12/01 18:06:53 nit: Can we move this accessor down so that it liv
danno 2015/12/02 07:00:19 Done.
+
+ Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
+ Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
+
+ Node* SmiShiftBitsConstant();
+
+ // Adds an end node of the graph.
+ void AddEndInput(Node* input);
+
+ // Private helpers which delegate to RawMachineAssembler.
+ Isolate* isolate();
+ Zone* zone();
+
+ base::SmartPointer<RawMachineAssembler> raw_assembler_;
+ ZoneVector<Node*> end_nodes_;
+ Code::Kind kind_;
+ const char* name_;
+ bool code_generated_;
+
+ DISALLOW_COPY_AND_ASSIGN(CodeStubAssembler);
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_

Powered by Google App Engine
This is Rietveld 408576698