Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 5 | #include "src/code-factory.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 6 | |
| 7 | #include "src/bootstrapper.h" |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 8 | #include "src/ic/ic.h" |
| 9 | |
| 10 | namespace v8 { |
| 11 | namespace internal { |
| 12 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 13 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 14 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 15 | Callable CodeFactory::LoadIC(Isolate* isolate, TypeofMode typeof_mode) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 16 | LoadICTrampolineStub stub(isolate, LoadICState(typeof_mode)); |
| 17 | return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 20 | // static |
| 21 | Callable CodeFactory::ApiGetter(Isolate* isolate) { |
| 22 | CallApiGetterStub stub(isolate); |
| 23 | return Callable(stub.GetCode(), ApiGetterDescriptor(isolate)); |
| 24 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 25 | |
| 26 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 27 | Callable CodeFactory::LoadICInOptimizedCode( |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 28 | Isolate* isolate, TypeofMode typeof_mode, |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 29 | InlineCacheState initialization_state) { |
| 30 | auto code = LoadIC::initialize_stub_in_optimized_code( |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 31 | isolate, LoadICState(typeof_mode).GetExtraICState(), |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 32 | initialization_state); |
| 33 | return Callable(code, LoadWithVectorDescriptor(isolate)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | |
| 37 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 38 | Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 39 | KeyedLoadICTrampolineStub stub(isolate, LoadICState(kNoExtraICState)); |
| 40 | return Callable(stub.GetCode(), LoadDescriptor(isolate)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | |
| 44 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 45 | Callable CodeFactory::KeyedLoadICInOptimizedCode( |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 46 | Isolate* isolate, InlineCacheState initialization_state) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 47 | auto code = KeyedLoadIC::initialize_stub_in_optimized_code( |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 48 | isolate, initialization_state, kNoExtraICState); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 49 | if (initialization_state != MEGAMORPHIC) { |
| 50 | return Callable(code, LoadWithVectorDescriptor(isolate)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 51 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 52 | return Callable(code, LoadDescriptor(isolate)); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | |
| 56 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 57 | Callable CodeFactory::CallIC(Isolate* isolate, int argc, |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 58 | ConvertReceiverMode mode, |
| 59 | TailCallMode tail_call_mode) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 60 | CallICTrampolineStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
| 61 | return Callable(stub.GetCode(), CallFunctionWithFeedbackDescriptor(isolate)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | |
| 65 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 66 | Callable CodeFactory::CallICInOptimizedCode(Isolate* isolate, int argc, |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 67 | ConvertReceiverMode mode, |
| 68 | TailCallMode tail_call_mode) { |
| 69 | return Callable(CallIC::initialize_stub_in_optimized_code(isolate, argc, mode, |
| 70 | tail_call_mode), |
| 71 | CallFunctionWithFeedbackAndVectorDescriptor(isolate)); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | |
| 75 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 76 | Callable CodeFactory::StoreIC(Isolate* isolate, LanguageMode language_mode) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 77 | VectorStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
| 78 | return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | |
| 82 | // static |
| 83 | Callable CodeFactory::StoreICInOptimizedCode( |
| 84 | Isolate* isolate, LanguageMode language_mode, |
| 85 | InlineCacheState initialization_state) { |
| 86 | CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC |
| 87 | ? VectorStoreICDescriptor(isolate) |
| 88 | : StoreDescriptor(isolate); |
| 89 | return Callable(StoreIC::initialize_stub_in_optimized_code( |
| 90 | isolate, language_mode, initialization_state), |
| 91 | descriptor); |
| 92 | } |
| 93 | |
| 94 | |
| 95 | // static |
| 96 | Callable CodeFactory::KeyedStoreIC(Isolate* isolate, |
| 97 | LanguageMode language_mode) { |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 98 | VectorKeyedStoreICTrampolineStub stub(isolate, StoreICState(language_mode)); |
| 99 | return Callable(stub.GetCode(), VectorStoreICTrampolineDescriptor(isolate)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | |
| 103 | // static |
| 104 | Callable CodeFactory::KeyedStoreICInOptimizedCode( |
| 105 | Isolate* isolate, LanguageMode language_mode, |
| 106 | InlineCacheState initialization_state) { |
| 107 | CallInterfaceDescriptor descriptor = initialization_state != MEGAMORPHIC |
| 108 | ? VectorStoreICDescriptor(isolate) |
| 109 | : StoreDescriptor(isolate); |
| 110 | return Callable(KeyedStoreIC::initialize_stub_in_optimized_code( |
| 111 | isolate, language_mode, initialization_state), |
| 112 | descriptor); |
| 113 | } |
| 114 | |
| 115 | |
| 116 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 117 | Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { |
| 118 | Handle<Code> code = CompareIC::GetUninitialized(isolate, op); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 119 | return Callable(code, CompareDescriptor(isolate)); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 124 | Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op) { |
| 125 | BinaryOpICStub stub(isolate, op); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 126 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 127 | } |
| 128 | |
| 129 | |
| 130 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 131 | Callable CodeFactory::InstanceOf(Isolate* isolate) { |
| 132 | InstanceOfStub stub(isolate); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 133 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 134 | } |
| 135 | |
| 136 | |
| 137 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 138 | Callable CodeFactory::ToBoolean(Isolate* isolate) { |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 139 | ToBooleanStub stub(isolate); |
| 140 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | |
| 144 | // static |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 145 | Callable CodeFactory::ToNumber(Isolate* isolate) { |
| 146 | ToNumberStub stub(isolate); |
| 147 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 148 | } |
| 149 | |
| 150 | |
| 151 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 152 | Callable CodeFactory::NonNumberToNumber(Isolate* isolate) { |
| 153 | NonNumberToNumberStub stub(isolate); |
| 154 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 155 | } |
| 156 | |
| 157 | // static |
| 158 | Callable CodeFactory::StringToNumber(Isolate* isolate) { |
| 159 | StringToNumberStub stub(isolate); |
| 160 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 161 | } |
| 162 | |
| 163 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 164 | Callable CodeFactory::ToString(Isolate* isolate) { |
| 165 | ToStringStub stub(isolate); |
| 166 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 167 | } |
| 168 | |
| 169 | |
| 170 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 171 | Callable CodeFactory::ToName(Isolate* isolate) { |
| 172 | ToNameStub stub(isolate); |
| 173 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 174 | } |
| 175 | |
| 176 | |
| 177 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 178 | Callable CodeFactory::ToInteger(Isolate* isolate) { |
| 179 | ToIntegerStub stub(isolate); |
| 180 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 181 | } |
| 182 | |
| 183 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 184 | Callable CodeFactory::ToLength(Isolate* isolate) { |
| 185 | ToLengthStub stub(isolate); |
| 186 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 187 | } |
| 188 | |
| 189 | |
| 190 | // static |
| 191 | Callable CodeFactory::ToObject(Isolate* isolate) { |
| 192 | ToObjectStub stub(isolate); |
| 193 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 194 | } |
| 195 | |
| 196 | |
| 197 | // static |
| 198 | Callable CodeFactory::NumberToString(Isolate* isolate) { |
| 199 | NumberToStringStub stub(isolate); |
| 200 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | // static |
| 205 | Callable CodeFactory::RegExpConstructResult(Isolate* isolate) { |
| 206 | RegExpConstructResultStub stub(isolate); |
| 207 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | // static |
| 212 | Callable CodeFactory::RegExpExec(Isolate* isolate) { |
| 213 | RegExpExecStub stub(isolate); |
| 214 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 215 | } |
| 216 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 217 | // static |
| 218 | Callable CodeFactory::Add(Isolate* isolate) { |
| 219 | AddStub stub(isolate); |
| 220 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 221 | } |
| 222 | |
| 223 | // static |
| 224 | Callable CodeFactory::Subtract(Isolate* isolate) { |
| 225 | SubtractStub stub(isolate); |
| 226 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 227 | } |
| 228 | |
| 229 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 230 | Callable CodeFactory::Multiply(Isolate* isolate) { |
| 231 | MultiplyStub stub(isolate); |
| 232 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 233 | } |
| 234 | |
| 235 | // static |
| 236 | Callable CodeFactory::Divide(Isolate* isolate) { |
| 237 | DivideStub stub(isolate); |
| 238 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 239 | } |
| 240 | |
| 241 | // static |
| 242 | Callable CodeFactory::Modulus(Isolate* isolate) { |
| 243 | ModulusStub stub(isolate); |
| 244 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 245 | } |
| 246 | |
| 247 | // static |
| 248 | Callable CodeFactory::ShiftRight(Isolate* isolate) { |
| 249 | ShiftRightStub stub(isolate); |
| 250 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 251 | } |
| 252 | |
| 253 | // static |
| 254 | Callable CodeFactory::ShiftRightLogical(Isolate* isolate) { |
| 255 | ShiftRightLogicalStub stub(isolate); |
| 256 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 257 | } |
| 258 | |
| 259 | // static |
| 260 | Callable CodeFactory::ShiftLeft(Isolate* isolate) { |
| 261 | ShiftLeftStub stub(isolate); |
| 262 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 263 | } |
| 264 | |
| 265 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 266 | Callable CodeFactory::BitwiseAnd(Isolate* isolate) { |
| 267 | BitwiseAndStub stub(isolate); |
| 268 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 269 | } |
| 270 | |
| 271 | // static |
| 272 | Callable CodeFactory::BitwiseOr(Isolate* isolate) { |
| 273 | BitwiseOrStub stub(isolate); |
| 274 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 275 | } |
| 276 | |
| 277 | // static |
| 278 | Callable CodeFactory::BitwiseXor(Isolate* isolate) { |
| 279 | BitwiseXorStub stub(isolate); |
| 280 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 281 | } |
| 282 | |
| 283 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 284 | Callable CodeFactory::Inc(Isolate* isolate) { |
| 285 | IncStub stub(isolate); |
| 286 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 287 | } |
| 288 | |
| 289 | // static |
| 290 | Callable CodeFactory::Dec(Isolate* isolate) { |
| 291 | DecStub stub(isolate); |
| 292 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 293 | } |
| 294 | |
| 295 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 296 | Callable CodeFactory::LessThan(Isolate* isolate) { |
| 297 | LessThanStub stub(isolate); |
| 298 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 299 | } |
| 300 | |
| 301 | // static |
| 302 | Callable CodeFactory::LessThanOrEqual(Isolate* isolate) { |
| 303 | LessThanOrEqualStub stub(isolate); |
| 304 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 305 | } |
| 306 | |
| 307 | // static |
| 308 | Callable CodeFactory::GreaterThan(Isolate* isolate) { |
| 309 | GreaterThanStub stub(isolate); |
| 310 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 311 | } |
| 312 | |
| 313 | // static |
| 314 | Callable CodeFactory::GreaterThanOrEqual(Isolate* isolate) { |
| 315 | GreaterThanOrEqualStub stub(isolate); |
| 316 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 317 | } |
| 318 | |
| 319 | // static |
| 320 | Callable CodeFactory::Equal(Isolate* isolate) { |
| 321 | EqualStub stub(isolate); |
| 322 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 323 | } |
| 324 | |
| 325 | // static |
| 326 | Callable CodeFactory::NotEqual(Isolate* isolate) { |
| 327 | NotEqualStub stub(isolate); |
| 328 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 329 | } |
| 330 | |
| 331 | // static |
| 332 | Callable CodeFactory::StrictEqual(Isolate* isolate) { |
| 333 | StrictEqualStub stub(isolate); |
| 334 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 335 | } |
| 336 | |
| 337 | // static |
| 338 | Callable CodeFactory::StrictNotEqual(Isolate* isolate) { |
| 339 | StrictNotEqualStub stub(isolate); |
| 340 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 341 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 342 | |
| 343 | // static |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 344 | Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, |
| 345 | PretenureFlag pretenure_flag) { |
| 346 | StringAddStub stub(isolate, flags, pretenure_flag); |
| 347 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 348 | } |
| 349 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 350 | // static |
| 351 | Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { |
| 352 | switch (token) { |
| 353 | case Token::EQ: |
| 354 | case Token::EQ_STRICT: |
| 355 | return StringEqual(isolate); |
| 356 | case Token::NE: |
| 357 | case Token::NE_STRICT: |
| 358 | return StringNotEqual(isolate); |
| 359 | case Token::LT: |
| 360 | return StringLessThan(isolate); |
| 361 | case Token::GT: |
| 362 | return StringGreaterThan(isolate); |
| 363 | case Token::LTE: |
| 364 | return StringLessThanOrEqual(isolate); |
| 365 | case Token::GTE: |
| 366 | return StringGreaterThanOrEqual(isolate); |
| 367 | default: |
| 368 | break; |
| 369 | } |
| 370 | UNREACHABLE(); |
| 371 | return StringEqual(isolate); |
| 372 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 373 | |
| 374 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 375 | Callable CodeFactory::StringEqual(Isolate* isolate) { |
| 376 | StringEqualStub stub(isolate); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 377 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 378 | } |
| 379 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 380 | // static |
| 381 | Callable CodeFactory::StringNotEqual(Isolate* isolate) { |
| 382 | StringNotEqualStub stub(isolate); |
| 383 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 384 | } |
| 385 | |
| 386 | // static |
| 387 | Callable CodeFactory::StringLessThan(Isolate* isolate) { |
| 388 | StringLessThanStub stub(isolate); |
| 389 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 390 | } |
| 391 | |
| 392 | // static |
| 393 | Callable CodeFactory::StringLessThanOrEqual(Isolate* isolate) { |
| 394 | StringLessThanOrEqualStub stub(isolate); |
| 395 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 396 | } |
| 397 | |
| 398 | // static |
| 399 | Callable CodeFactory::StringGreaterThan(Isolate* isolate) { |
| 400 | StringGreaterThanStub stub(isolate); |
| 401 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 402 | } |
| 403 | |
| 404 | // static |
| 405 | Callable CodeFactory::StringGreaterThanOrEqual(Isolate* isolate) { |
| 406 | StringGreaterThanOrEqualStub stub(isolate); |
| 407 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 408 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 409 | |
| 410 | // static |
| 411 | Callable CodeFactory::SubString(Isolate* isolate) { |
| 412 | SubStringStub stub(isolate); |
| 413 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 414 | } |
| 415 | |
| 416 | |
| 417 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 418 | Callable CodeFactory::ResumeGenerator(Isolate* isolate) { |
| 419 | return Callable(isolate->builtins()->ResumeGeneratorTrampoline(), |
| 420 | ResumeGeneratorDescriptor(isolate)); |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 424 | Callable CodeFactory::Typeof(Isolate* isolate) { |
| 425 | TypeofStub stub(isolate); |
| 426 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 427 | } |
| 428 | |
| 429 | |
| 430 | // static |
| 431 | Callable CodeFactory::FastCloneRegExp(Isolate* isolate) { |
| 432 | FastCloneRegExpStub stub(isolate); |
| 433 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 434 | } |
| 435 | |
| 436 | |
| 437 | // static |
| 438 | Callable CodeFactory::FastCloneShallowArray(Isolate* isolate) { |
| 439 | // TODO(mstarzinger): Thread through AllocationSiteMode at some point. |
| 440 | FastCloneShallowArrayStub stub(isolate, DONT_TRACK_ALLOCATION_SITE); |
| 441 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 442 | } |
| 443 | |
| 444 | |
| 445 | // static |
| 446 | Callable CodeFactory::FastCloneShallowObject(Isolate* isolate, int length) { |
| 447 | FastCloneShallowObjectStub stub(isolate, length); |
| 448 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 449 | } |
| 450 | |
| 451 | |
| 452 | // static |
| 453 | Callable CodeFactory::FastNewContext(Isolate* isolate, int slot_count) { |
| 454 | FastNewContextStub stub(isolate, slot_count); |
| 455 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 456 | } |
| 457 | |
| 458 | |
| 459 | // static |
| 460 | Callable CodeFactory::FastNewClosure(Isolate* isolate, |
| 461 | LanguageMode language_mode, |
| 462 | FunctionKind kind) { |
| 463 | FastNewClosureStub stub(isolate, language_mode, kind); |
| 464 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 465 | } |
| 466 | |
| 467 | |
| 468 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 469 | Callable CodeFactory::FastNewObject(Isolate* isolate) { |
| 470 | FastNewObjectStub stub(isolate); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 471 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 472 | } |
| 473 | |
| 474 | |
| 475 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 476 | Callable CodeFactory::FastNewRestParameter(Isolate* isolate, |
| 477 | bool skip_stub_frame) { |
| 478 | FastNewRestParameterStub stub(isolate, skip_stub_frame); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 479 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 480 | } |
| 481 | |
| 482 | |
| 483 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 484 | Callable CodeFactory::FastNewSloppyArguments(Isolate* isolate, |
| 485 | bool skip_stub_frame) { |
| 486 | FastNewSloppyArgumentsStub stub(isolate, skip_stub_frame); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 487 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 488 | } |
| 489 | |
| 490 | |
| 491 | // static |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 492 | Callable CodeFactory::FastNewStrictArguments(Isolate* isolate, |
| 493 | bool skip_stub_frame) { |
| 494 | FastNewStrictArgumentsStub stub(isolate, skip_stub_frame); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 495 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 496 | } |
| 497 | |
| 498 | |
| 499 | // static |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 500 | Callable CodeFactory::AllocateHeapNumber(Isolate* isolate) { |
| 501 | AllocateHeapNumberStub stub(isolate); |
| 502 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 503 | } |
| 504 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 505 | #define SIMD128_ALLOC(TYPE, Type, type, lane_count, lane_type) \ |
| 506 | Callable CodeFactory::Allocate##Type(Isolate* isolate) { \ |
| 507 | Allocate##Type##Stub stub(isolate); \ |
| 508 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); \ |
| 509 | } |
| 510 | SIMD128_TYPES(SIMD128_ALLOC) |
| 511 | #undef SIMD128_ALLOC |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 512 | |
| 513 | // static |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 514 | Callable CodeFactory::ArgumentAdaptor(Isolate* isolate) { |
| 515 | return Callable(isolate->builtins()->ArgumentsAdaptorTrampoline(), |
| 516 | ArgumentAdaptorDescriptor(isolate)); |
| 517 | } |
| 518 | |
| 519 | |
| 520 | // static |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame] | 521 | Callable CodeFactory::Call(Isolate* isolate, ConvertReceiverMode mode, |
| 522 | TailCallMode tail_call_mode) { |
| 523 | return Callable(isolate->builtins()->Call(mode, tail_call_mode), |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 524 | CallTrampolineDescriptor(isolate)); |
| 525 | } |
| 526 | |
| 527 | |
| 528 | // static |
| 529 | Callable CodeFactory::CallFunction(Isolate* isolate, ConvertReceiverMode mode) { |
| 530 | return Callable(isolate->builtins()->CallFunction(mode), |
| 531 | CallTrampolineDescriptor(isolate)); |
| 532 | } |
| 533 | |
| 534 | |
| 535 | // static |
| 536 | Callable CodeFactory::Construct(Isolate* isolate) { |
| 537 | return Callable(isolate->builtins()->Construct(), |
| 538 | ConstructTrampolineDescriptor(isolate)); |
| 539 | } |
| 540 | |
| 541 | |
| 542 | // static |
| 543 | Callable CodeFactory::ConstructFunction(Isolate* isolate) { |
| 544 | return Callable(isolate->builtins()->ConstructFunction(), |
| 545 | ConstructTrampolineDescriptor(isolate)); |
| 546 | } |
| 547 | |
Ben Murdoch | c561043 | 2016-08-08 18:44:38 +0100 | [diff] [blame^] | 548 | // static |
| 549 | Callable CodeFactory::HasProperty(Isolate* isolate) { |
| 550 | HasPropertyStub stub(isolate); |
| 551 | return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); |
| 552 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 553 | |
| 554 | // static |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 555 | Callable CodeFactory::InterpreterPushArgsAndCall(Isolate* isolate, |
| 556 | TailCallMode tail_call_mode) { |
| 557 | return Callable( |
| 558 | isolate->builtins()->InterpreterPushArgsAndCall(tail_call_mode), |
| 559 | InterpreterPushArgsAndCallDescriptor(isolate)); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | |
| 563 | // static |
| 564 | Callable CodeFactory::InterpreterPushArgsAndConstruct(Isolate* isolate) { |
| 565 | return Callable(isolate->builtins()->InterpreterPushArgsAndConstruct(), |
| 566 | InterpreterPushArgsAndConstructDescriptor(isolate)); |
| 567 | } |
| 568 | |
| 569 | |
| 570 | // static |
| 571 | Callable CodeFactory::InterpreterCEntry(Isolate* isolate, int result_size) { |
| 572 | // Note: If we ever use fpregs in the interpreter then we will need to |
| 573 | // save fpregs too. |
| 574 | CEntryStub stub(isolate, result_size, kDontSaveFPRegs, kArgvInRegister); |
| 575 | return Callable(stub.GetCode(), InterpreterCEntryDescriptor(isolate)); |
| 576 | } |
| 577 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 578 | } // namespace internal |
| 579 | } // namespace v8 |