OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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 #include "src/compiler/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 void CodeAssembler::CallPrologue() {} | 63 void CodeAssembler::CallPrologue() {} |
64 | 64 |
65 void CodeAssembler::CallEpilogue() {} | 65 void CodeAssembler::CallEpilogue() {} |
66 | 66 |
67 Handle<Code> CodeAssembler::GenerateCode() { | 67 Handle<Code> CodeAssembler::GenerateCode() { |
68 DCHECK(!code_generated_); | 68 DCHECK(!code_generated_); |
69 | 69 |
70 Schedule* schedule = raw_assembler_->Export(); | 70 Schedule* schedule = raw_assembler_->Export(); |
71 Handle<Code> code = Pipeline::GenerateCodeForCodeStub( | 71 Handle<Code> code = Pipeline::GenerateCodeForCodeStub( |
72 isolate(), raw_assembler_->call_descriptor(), graph(), schedule, flags_, | 72 isolate(), raw_assembler_->call_descriptor(), raw_assembler_->graph(), |
73 name_); | 73 schedule, flags_, name_); |
74 | 74 |
75 code_generated_ = true; | 75 code_generated_ = true; |
76 return code; | 76 return code; |
77 } | 77 } |
78 | 78 |
79 bool CodeAssembler::Is64() const { return raw_assembler_->machine()->Is64(); } | 79 bool CodeAssembler::Is64() const { return raw_assembler_->machine()->Is64(); } |
80 | 80 |
81 bool CodeAssembler::IsFloat64RoundUpSupported() const { | 81 bool CodeAssembler::IsFloat64RoundUpSupported() const { |
82 return raw_assembler_->machine()->Float64RoundUp().IsSupported(); | 82 return raw_assembler_->machine()->Float64RoundUp().IsSupported(); |
83 } | 83 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 | 192 |
193 Node* CodeAssembler::LoadParentFramePointer() { | 193 Node* CodeAssembler::LoadParentFramePointer() { |
194 return raw_assembler_->LoadParentFramePointer(); | 194 return raw_assembler_->LoadParentFramePointer(); |
195 } | 195 } |
196 | 196 |
197 Node* CodeAssembler::LoadStackPointer() { | 197 Node* CodeAssembler::LoadStackPointer() { |
198 return raw_assembler_->LoadStackPointer(); | 198 return raw_assembler_->LoadStackPointer(); |
199 } | 199 } |
200 | 200 |
201 Node* CodeAssembler::SmiShiftBitsConstant() { | |
202 return IntPtrConstant(kSmiShiftSize + kSmiTagSize); | |
203 } | |
204 | |
205 #define DEFINE_CODE_ASSEMBLER_BINARY_OP(name) \ | 201 #define DEFINE_CODE_ASSEMBLER_BINARY_OP(name) \ |
206 Node* CodeAssembler::name(Node* a, Node* b) { \ | 202 Node* CodeAssembler::name(Node* a, Node* b) { \ |
207 return raw_assembler_->name(a, b); \ | 203 return raw_assembler_->name(a, b); \ |
208 } | 204 } |
209 CODE_ASSEMBLER_BINARY_OP_LIST(DEFINE_CODE_ASSEMBLER_BINARY_OP) | 205 CODE_ASSEMBLER_BINARY_OP_LIST(DEFINE_CODE_ASSEMBLER_BINARY_OP) |
210 #undef DEFINE_CODE_ASSEMBLER_BINARY_OP | 206 #undef DEFINE_CODE_ASSEMBLER_BINARY_OP |
211 | 207 |
212 Node* CodeAssembler::WordShl(Node* value, int shift) { | 208 Node* CodeAssembler::WordShl(Node* value, int shift) { |
213 return (shift != 0) ? raw_assembler_->WordShl(value, IntPtrConstant(shift)) | 209 return (shift != 0) ? raw_assembler_->WordShl(value, IntPtrConstant(shift)) |
214 : value; | 210 : value; |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 898 |
903 Bind(&end); | 899 Bind(&end); |
904 return value.value(); | 900 return value.value(); |
905 } | 901 } |
906 | 902 |
907 // RawMachineAssembler delegate helpers: | 903 // RawMachineAssembler delegate helpers: |
908 Isolate* CodeAssembler::isolate() const { return raw_assembler_->isolate(); } | 904 Isolate* CodeAssembler::isolate() const { return raw_assembler_->isolate(); } |
909 | 905 |
910 Factory* CodeAssembler::factory() const { return isolate()->factory(); } | 906 Factory* CodeAssembler::factory() const { return isolate()->factory(); } |
911 | 907 |
912 Graph* CodeAssembler::graph() const { return raw_assembler_->graph(); } | |
913 | |
914 Zone* CodeAssembler::zone() const { return raw_assembler_->zone(); } | 908 Zone* CodeAssembler::zone() const { return raw_assembler_->zone(); } |
915 | 909 |
916 // The core implementation of Variable is stored through an indirection so | 910 // The core implementation of Variable is stored through an indirection so |
917 // that it can outlive the often block-scoped Variable declarations. This is | 911 // that it can outlive the often block-scoped Variable declarations. This is |
918 // needed to ensure that variable binding and merging through phis can | 912 // needed to ensure that variable binding and merging through phis can |
919 // properly be verified. | 913 // properly be verified. |
920 class CodeAssembler::Variable::Impl : public ZoneObject { | 914 class CodeAssembler::Variable::Impl : public ZoneObject { |
921 public: | 915 public: |
922 explicit Impl(MachineRepresentation rep) : value_(nullptr), rep_(rep) {} | 916 explicit Impl(MachineRepresentation rep) : value_(nullptr), rep_(rep) {} |
923 Node* value_; | 917 Node* value_; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 } | 1052 } |
1059 } | 1053 } |
1060 } | 1054 } |
1061 | 1055 |
1062 bound_ = true; | 1056 bound_ = true; |
1063 } | 1057 } |
1064 | 1058 |
1065 } // namespace compiler | 1059 } // namespace compiler |
1066 } // namespace internal | 1060 } // namespace internal |
1067 } // namespace v8 | 1061 } // namespace v8 |
OLD | NEW |