OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 Isolate* isolate() const { return zone()->isolate(); } | 51 Isolate* isolate() const { return zone()->isolate(); } |
52 Zone* zone() const { return graph()->zone(); } | 52 Zone* zone() const { return graph()->zone(); } |
53 MachineOperatorBuilder* machine() { return &machine_; } | 53 MachineOperatorBuilder* machine() { return &machine_; } |
54 CommonOperatorBuilder* common() { return &common_; } | 54 CommonOperatorBuilder* common() { return &common_; } |
55 CallDescriptor* call_descriptor() const { return call_descriptor_; } | 55 CallDescriptor* call_descriptor() const { return call_descriptor_; } |
56 size_t parameter_count() const { return machine_sig_->parameter_count(); } | 56 size_t parameter_count() const { return machine_sig_->parameter_count(); } |
57 MachineSignature* machine_sig() const { return machine_sig_; } | 57 MachineSignature* machine_sig() const { return machine_sig_; } |
58 | 58 |
59 Node* UndefinedConstant() { | 59 Node* UndefinedConstant() { |
60 Unique<Object> unique = Unique<Object>::CreateImmovable( | 60 Unique<HeapObject> unique = Unique<HeapObject>::CreateImmovable( |
61 isolate()->factory()->undefined_value()); | 61 isolate()->factory()->undefined_value()); |
62 return NewNode(common()->HeapConstant(unique)); | 62 return NewNode(common()->HeapConstant(unique)); |
63 } | 63 } |
64 | 64 |
65 // Constants. | 65 // Constants. |
66 Node* PointerConstant(void* value) { | 66 Node* PointerConstant(void* value) { |
67 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); | 67 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); |
68 } | 68 } |
69 Node* IntPtrConstant(intptr_t value) { | 69 Node* IntPtrConstant(intptr_t value) { |
70 // TODO(dcarney): mark generated code as unserializable if value != 0. | 70 // TODO(dcarney): mark generated code as unserializable if value != 0. |
71 return kPointerSize == 8 ? Int64Constant(value) | 71 return kPointerSize == 8 ? Int64Constant(value) |
72 : Int32Constant(static_cast<int>(value)); | 72 : Int32Constant(static_cast<int>(value)); |
73 } | 73 } |
74 Node* Int32Constant(int32_t value) { | 74 Node* Int32Constant(int32_t value) { |
75 return NewNode(common()->Int32Constant(value)); | 75 return NewNode(common()->Int32Constant(value)); |
76 } | 76 } |
77 Node* Int64Constant(int64_t value) { | 77 Node* Int64Constant(int64_t value) { |
78 return NewNode(common()->Int64Constant(value)); | 78 return NewNode(common()->Int64Constant(value)); |
79 } | 79 } |
80 Node* NumberConstant(double value) { | 80 Node* NumberConstant(double value) { |
81 return NewNode(common()->NumberConstant(value)); | 81 return NewNode(common()->NumberConstant(value)); |
82 } | 82 } |
83 Node* Float32Constant(float value) { | 83 Node* Float32Constant(float value) { |
84 return NewNode(common()->Float32Constant(value)); | 84 return NewNode(common()->Float32Constant(value)); |
85 } | 85 } |
86 Node* Float64Constant(double value) { | 86 Node* Float64Constant(double value) { |
87 return NewNode(common()->Float64Constant(value)); | 87 return NewNode(common()->Float64Constant(value)); |
88 } | 88 } |
89 Node* HeapConstant(Handle<Object> object) { | 89 Node* HeapConstant(Handle<HeapObject> object) { |
90 Unique<Object> val = Unique<Object>::CreateUninitialized(object); | 90 Unique<HeapObject> val = Unique<HeapObject>::CreateUninitialized(object); |
91 return NewNode(common()->HeapConstant(val)); | 91 return NewNode(common()->HeapConstant(val)); |
92 } | 92 } |
93 | 93 |
94 Node* Projection(int index, Node* a) { | 94 Node* Projection(int index, Node* a) { |
95 return NewNode(common()->Projection(index), a); | 95 return NewNode(common()->Projection(index), a); |
96 } | 96 } |
97 | 97 |
98 // Memory Operations. | 98 // Memory Operations. |
99 Node* Load(MachineType rep, Node* base) { | 99 Node* Load(MachineType rep, Node* base) { |
100 return Load(rep, base, Int32Constant(0)); | 100 return Load(rep, base, Int32Constant(0)); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 BasicBlock* current_block_; | 438 BasicBlock* current_block_; |
439 | 439 |
440 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 440 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
441 }; | 441 }; |
442 | 442 |
443 } // namespace compiler | 443 } // namespace compiler |
444 } // namespace internal | 444 } // namespace internal |
445 } // namespace v8 | 445 } // namespace v8 |
446 | 446 |
447 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 447 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |