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 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/builtins/builtins-descriptors.h" | 8 #include "src/builtins/builtins-descriptors.h" |
9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 Handle<Code> code(isolate->builtins()->StringFromCharCode()); | 236 Handle<Code> code(isolate->builtins()->StringFromCharCode()); |
237 return Callable(code, BuiltinDescriptor(isolate)); | 237 return Callable(code, BuiltinDescriptor(isolate)); |
238 } | 238 } |
239 | 239 |
240 #define TFS_BUILTIN(Name) \ | 240 #define TFS_BUILTIN(Name) \ |
241 Callable CodeFactory::Name(Isolate* isolate) { \ | 241 Callable CodeFactory::Name(Isolate* isolate) { \ |
242 Handle<Code> code(isolate->builtins()->Name()); \ | 242 Handle<Code> code(isolate->builtins()->Name()); \ |
243 return Callable(code, Builtin_##Name##_InterfaceDescriptor(isolate)); \ | 243 return Callable(code, Builtin_##Name##_InterfaceDescriptor(isolate)); \ |
244 } | 244 } |
245 | 245 |
246 TFS_BUILTIN(ToString) | |
247 TFS_BUILTIN(Add) | 246 TFS_BUILTIN(Add) |
248 TFS_BUILTIN(Subtract) | |
249 TFS_BUILTIN(Multiply) | |
250 TFS_BUILTIN(Divide) | |
251 TFS_BUILTIN(Modulus) | |
252 TFS_BUILTIN(BitwiseAnd) | 247 TFS_BUILTIN(BitwiseAnd) |
253 TFS_BUILTIN(BitwiseOr) | 248 TFS_BUILTIN(BitwiseOr) |
254 TFS_BUILTIN(BitwiseXor) | 249 TFS_BUILTIN(BitwiseXor) |
255 TFS_BUILTIN(ShiftLeft) | 250 TFS_BUILTIN(ClassOf) |
256 TFS_BUILTIN(ShiftRight) | 251 TFS_BUILTIN(CopyFastSmiOrObjectElements) |
257 TFS_BUILTIN(ShiftRightLogical) | 252 TFS_BUILTIN(CreateIterResultObject) |
258 TFS_BUILTIN(LessThan) | 253 TFS_BUILTIN(Divide) |
259 TFS_BUILTIN(LessThanOrEqual) | |
260 TFS_BUILTIN(GreaterThan) | |
261 TFS_BUILTIN(GreaterThanOrEqual) | |
262 TFS_BUILTIN(Equal) | 254 TFS_BUILTIN(Equal) |
263 TFS_BUILTIN(StrictEqual) | |
264 TFS_BUILTIN(CreateIterResultObject) | |
265 TFS_BUILTIN(HasProperty) | |
266 TFS_BUILTIN(NonNumberToNumber) | |
267 TFS_BUILTIN(StringToNumber) | |
268 TFS_BUILTIN(ToBoolean) | |
269 TFS_BUILTIN(ToInteger) | |
270 TFS_BUILTIN(ToLength) | |
271 TFS_BUILTIN(ToName) | |
272 TFS_BUILTIN(ToNumber) | |
273 TFS_BUILTIN(ToObject) | |
274 TFS_BUILTIN(ClassOf) | |
275 TFS_BUILTIN(Typeof) | |
276 TFS_BUILTIN(InstanceOf) | |
277 TFS_BUILTIN(OrdinaryHasInstance) | |
278 TFS_BUILTIN(CopyFastSmiOrObjectElements) | |
279 TFS_BUILTIN(GrowFastDoubleElements) | |
280 TFS_BUILTIN(GrowFastSmiOrObjectElements) | |
281 TFS_BUILTIN(NewUnmappedArgumentsElements) | |
282 TFS_BUILTIN(FastCloneRegExp) | 255 TFS_BUILTIN(FastCloneRegExp) |
283 TFS_BUILTIN(FastNewClosure) | 256 TFS_BUILTIN(FastNewClosure) |
284 TFS_BUILTIN(FastNewObject) | 257 TFS_BUILTIN(FastNewObject) |
285 TFS_BUILTIN(FastNewRestParameter) | 258 TFS_BUILTIN(FastNewRestParameter) |
286 TFS_BUILTIN(FastNewSloppyArguments) | 259 TFS_BUILTIN(FastNewSloppyArguments) |
287 TFS_BUILTIN(FastNewStrictArguments) | 260 TFS_BUILTIN(FastNewStrictArguments) |
288 TFS_BUILTIN(ForInFilter) | 261 TFS_BUILTIN(ForInFilter) |
289 TFS_BUILTIN(GetSuperConstructor) | 262 TFS_BUILTIN(GetSuperConstructor) |
| 263 TFS_BUILTIN(GreaterThan) |
| 264 TFS_BUILTIN(GreaterThanOrEqual) |
| 265 TFS_BUILTIN(GrowFastDoubleElements) |
| 266 TFS_BUILTIN(GrowFastSmiOrObjectElements) |
| 267 TFS_BUILTIN(HasProperty) |
| 268 TFS_BUILTIN(InstanceOf) |
| 269 TFS_BUILTIN(KeyedLoadIC_Megamorphic) |
| 270 TFS_BUILTIN(LessThan) |
| 271 TFS_BUILTIN(LessThanOrEqual) |
290 TFS_BUILTIN(LoadIC_Uninitialized) | 272 TFS_BUILTIN(LoadIC_Uninitialized) |
291 TFS_BUILTIN(KeyedLoadIC_Megamorphic) | 273 TFS_BUILTIN(Modulus) |
292 TFS_BUILTIN(PromiseHandleReject) | 274 TFS_BUILTIN(Multiply) |
293 TFS_BUILTIN(RegExpReplace) | 275 TFS_BUILTIN(NewUnmappedArgumentsElements) |
294 TFS_BUILTIN(RegExpSplit) | 276 TFS_BUILTIN(NonNumberToNumber) |
295 TFS_BUILTIN(StringCharAt) | 277 TFS_BUILTIN(OrdinaryHasInstance) |
296 TFS_BUILTIN(StringCharCodeAt) | 278 TFS_BUILTIN(ShiftLeft) |
297 TFS_BUILTIN(StringEqual) | 279 TFS_BUILTIN(ShiftRight) |
298 TFS_BUILTIN(StringLessThan) | 280 TFS_BUILTIN(ShiftRightLogical) |
299 TFS_BUILTIN(StringLessThanOrEqual) | 281 TFS_BUILTIN(StrictEqual) |
300 TFS_BUILTIN(StringGreaterThan) | 282 TFS_BUILTIN(StringToNumber) |
301 TFS_BUILTIN(StringGreaterThanOrEqual) | 283 TFS_BUILTIN(Subtract) |
302 TFS_BUILTIN(AsyncGeneratorResolve) | 284 TFS_BUILTIN(ToInteger) |
303 TFS_BUILTIN(AsyncGeneratorReject) | 285 TFS_BUILTIN(ToLength) |
304 TFS_BUILTIN(AsyncGeneratorResumeNext) | 286 TFS_BUILTIN(ToNumber) |
305 | 287 |
306 #undef TFS_BUILTIN | 288 #undef TFS_BUILTIN |
307 | 289 |
308 // static | 290 // static |
309 Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, | 291 Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, |
310 PretenureFlag pretenure_flag) { | 292 PretenureFlag pretenure_flag) { |
311 StringAddStub stub(isolate, flags, pretenure_flag); | 293 StringAddStub stub(isolate, flags, pretenure_flag); |
312 return make_callable(stub); | 294 return make_callable(stub); |
313 } | 295 } |
314 | 296 |
315 // static | 297 // static |
316 Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { | 298 Callable CodeFactory::StringCompare(Isolate* isolate, Token::Value token) { |
317 switch (token) { | 299 switch (token) { |
318 case Token::EQ: | 300 case Token::EQ: |
319 case Token::EQ_STRICT: | 301 case Token::EQ_STRICT: |
320 return StringEqual(isolate); | 302 return Builtins::CallableFor(isolate, Builtins::kStringEqual); |
321 case Token::LT: | 303 case Token::LT: |
322 return StringLessThan(isolate); | 304 return Builtins::CallableFor(isolate, Builtins::kStringLessThan); |
323 case Token::GT: | 305 case Token::GT: |
324 return StringGreaterThan(isolate); | 306 return Builtins::CallableFor(isolate, Builtins::kStringGreaterThan); |
325 case Token::LTE: | 307 case Token::LTE: |
326 return StringLessThanOrEqual(isolate); | 308 return Builtins::CallableFor(isolate, Builtins::kStringLessThanOrEqual); |
327 case Token::GTE: | 309 case Token::GTE: |
328 return StringGreaterThanOrEqual(isolate); | 310 return Builtins::CallableFor(isolate, |
| 311 Builtins::kStringGreaterThanOrEqual); |
329 default: | 312 default: |
330 break; | 313 break; |
331 } | 314 } |
332 UNREACHABLE(); | 315 UNREACHABLE(); |
333 } | 316 } |
334 | 317 |
335 // static | 318 // static |
336 Callable CodeFactory::StringIndexOf(Isolate* isolate) { | 319 Callable CodeFactory::StringIndexOf(Isolate* isolate) { |
337 return Callable(isolate->builtins()->StringIndexOf(), | 320 return Callable(isolate->builtins()->StringIndexOf(), |
338 StringIndexOfDescriptor(isolate)); | 321 StringIndexOfDescriptor(isolate)); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 510 } |
528 | 511 |
529 // static | 512 // static |
530 Callable CodeFactory::FunctionPrototypeBind(Isolate* isolate) { | 513 Callable CodeFactory::FunctionPrototypeBind(Isolate* isolate) { |
531 return Callable(isolate->builtins()->FunctionPrototypeBind(), | 514 return Callable(isolate->builtins()->FunctionPrototypeBind(), |
532 BuiltinDescriptor(isolate)); | 515 BuiltinDescriptor(isolate)); |
533 } | 516 } |
534 | 517 |
535 } // namespace internal | 518 } // namespace internal |
536 } // namespace v8 | 519 } // namespace v8 |
OLD | NEW |