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