Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | |
| 6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | |
| 7 | |
| 8 // Clients of this interface shouldn't depend on lots of compiler internals. | |
| 9 // Do not include anything from src/compiler here! | |
| 10 #include "src/allocation.h" | |
| 11 #include "src/base/smart-pointers.h" | |
| 12 #include "src/builtins.h" | |
| 13 #include "src/frames.h" | |
| 14 #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.
| |
| 15 #include "src/runtime/runtime.h" | |
| 16 #include "src/zone-containers.h" | |
| 17 | |
| 18 namespace v8 { | |
| 19 namespace internal { | |
| 20 | |
| 21 class CallInterfaceDescriptor; | |
| 22 class Isolate; | |
| 23 class Zone; | |
| 24 | |
| 25 namespace compiler { | |
| 26 | |
| 27 class CallDescriptor; | |
| 28 class Graph; | |
| 29 class Node; | |
| 30 class Operator; | |
| 31 class RawMachineAssembler; | |
| 32 class Schedule; | |
| 33 | |
| 34 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
| |
| 35 public: | |
| 36 CodeStubAssembler(Isolate* isolate, Zone* zone, | |
| 37 const CallInterfaceDescriptor& descriptor, Code::Kind kind, | |
| 38 const char* name); | |
| 39 virtual ~CodeStubAssembler(); | |
| 40 | |
| 41 Handle<Code> GenerateCode(); | |
| 42 | |
| 43 // Constants. | |
| 44 Node* Int32Constant(int value); | |
| 45 Node* IntPtrConstant(intptr_t value); | |
| 46 Node* NumberConstant(double value); | |
| 47 Node* HeapConstant(Handle<HeapObject> object); | |
| 48 Node* BooleanConstant(bool value); | |
| 49 | |
| 50 Node* Parameter(int value); | |
| 51 void Return(Node* value); | |
| 52 | |
| 53 // Tag and untag Smi values. | |
| 54 Node* SmiTag(Node* value); | |
| 55 Node* SmiUntag(Node* value); | |
| 56 | |
| 57 // Basic arithmetic operations. | |
| 58 Node* IntPtrAdd(Node* a, Node* b); | |
| 59 Node* IntPtrSub(Node* a, Node* b); | |
| 60 Node* WordShl(Node* value, int shift); | |
| 61 | |
| 62 // Load a field from an object on the heap. | |
| 63 Node* LoadObjectField(Node* object, int offset); | |
| 64 | |
| 65 // Call runtime function. | |
| 66 Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1); | |
| 67 Node* CallRuntime(Runtime::FunctionId function_id, Node* context, Node* arg1, | |
| 68 Node* arg2); | |
| 69 | |
| 70 Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context, | |
| 71 Node* arg1); | |
| 72 Node* TailCallRuntime(Runtime::FunctionId function_id, Node* context, | |
| 73 Node* arg1, Node* arg2); | |
| 74 | |
| 75 private: | |
| 76 friend class CodeStubAssemblerTester; | |
| 77 // Close the graph. | |
| 78 void End(); | |
| 79 | |
| 80 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.
| |
| 81 | |
| 82 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); | |
| 83 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); | |
| 84 | |
| 85 Node* SmiShiftBitsConstant(); | |
| 86 | |
| 87 // Adds an end node of the graph. | |
| 88 void AddEndInput(Node* input); | |
| 89 | |
| 90 // Private helpers which delegate to RawMachineAssembler. | |
| 91 Isolate* isolate(); | |
| 92 Zone* zone(); | |
| 93 | |
| 94 base::SmartPointer<RawMachineAssembler> raw_assembler_; | |
| 95 ZoneVector<Node*> end_nodes_; | |
| 96 Code::Kind kind_; | |
| 97 const char* name_; | |
| 98 bool code_generated_; | |
| 99 | |
| 100 DISALLOW_COPY_AND_ASSIGN(CodeStubAssembler); | |
| 101 }; | |
| 102 | |
| 103 } // namespace compiler | |
| 104 } // namespace internal | |
| 105 } // namespace v8 | |
| 106 | |
| 107 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | |
| OLD | NEW |