| 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/compiler/js-operator.h" | 5 #include "src/compiler/js-operator.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" |
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return OpParameter<ConvertReceiverMode>(op); | 45 return OpParameter<ConvertReceiverMode>(op); |
| 46 } | 46 } |
| 47 | 47 |
| 48 | 48 |
| 49 ToBooleanHints ToBooleanHintsOf(Operator const* op) { | 49 ToBooleanHints ToBooleanHintsOf(Operator const* op) { |
| 50 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); | 50 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); |
| 51 return OpParameter<ToBooleanHints>(op); | 51 return OpParameter<ToBooleanHints>(op); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 bool operator==(BinaryOperationParameters const& lhs, | |
| 56 BinaryOperationParameters const& rhs) { | |
| 57 return lhs.language_mode() == rhs.language_mode() && | |
| 58 lhs.hints() == rhs.hints(); | |
| 59 } | |
| 60 | |
| 61 | |
| 62 bool operator!=(BinaryOperationParameters const& lhs, | |
| 63 BinaryOperationParameters const& rhs) { | |
| 64 return !(lhs == rhs); | |
| 65 } | |
| 66 | |
| 67 | |
| 68 size_t hash_value(BinaryOperationParameters const& p) { | |
| 69 return base::hash_combine(p.language_mode(), p.hints()); | |
| 70 } | |
| 71 | |
| 72 | |
| 73 std::ostream& operator<<(std::ostream& os, BinaryOperationParameters const& p) { | |
| 74 return os << p.language_mode() << ", " << p.hints(); | |
| 75 } | |
| 76 | |
| 77 | |
| 78 BinaryOperationParameters const& BinaryOperationParametersOf( | |
| 79 Operator const* op) { | |
| 80 DCHECK(op->opcode() == IrOpcode::kJSBitwiseOr || | |
| 81 op->opcode() == IrOpcode::kJSBitwiseXor || | |
| 82 op->opcode() == IrOpcode::kJSBitwiseAnd || | |
| 83 op->opcode() == IrOpcode::kJSShiftLeft || | |
| 84 op->opcode() == IrOpcode::kJSShiftRight || | |
| 85 op->opcode() == IrOpcode::kJSShiftRightLogical || | |
| 86 op->opcode() == IrOpcode::kJSAdd || | |
| 87 op->opcode() == IrOpcode::kJSSubtract || | |
| 88 op->opcode() == IrOpcode::kJSMultiply || | |
| 89 op->opcode() == IrOpcode::kJSDivide || | |
| 90 op->opcode() == IrOpcode::kJSModulus); | |
| 91 return OpParameter<BinaryOperationParameters>(op); | |
| 92 } | |
| 93 | |
| 94 | |
| 95 bool operator==(CallConstructParameters const& lhs, | 55 bool operator==(CallConstructParameters const& lhs, |
| 96 CallConstructParameters const& rhs) { | 56 CallConstructParameters const& rhs) { |
| 97 return lhs.arity() == rhs.arity() && lhs.feedback() == rhs.feedback(); | 57 return lhs.arity() == rhs.arity() && lhs.feedback() == rhs.feedback(); |
| 98 } | 58 } |
| 99 | 59 |
| 100 | 60 |
| 101 bool operator!=(CallConstructParameters const& lhs, | 61 bool operator!=(CallConstructParameters const& lhs, |
| 102 CallConstructParameters const& rhs) { | 62 CallConstructParameters const& rhs) { |
| 103 return !(lhs == rhs); | 63 return !(lhs == rhs); |
| 104 } | 64 } |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 367 } |
| 408 | 368 |
| 409 | 369 |
| 410 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { | 370 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { |
| 411 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || | 371 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || |
| 412 op->opcode() == IrOpcode::kJSCreateLiteralObject || | 372 op->opcode() == IrOpcode::kJSCreateLiteralObject || |
| 413 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); | 373 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); |
| 414 return OpParameter<CreateLiteralParameters>(op); | 374 return OpParameter<CreateLiteralParameters>(op); |
| 415 } | 375 } |
| 416 | 376 |
| 417 | |
| 418 #define CACHED_OP_LIST(V) \ | 377 #define CACHED_OP_LIST(V) \ |
| 419 V(Equal, Operator::kNoProperties, 2, 1) \ | 378 V(Equal, Operator::kNoProperties, 2, 1) \ |
| 420 V(NotEqual, Operator::kNoProperties, 2, 1) \ | 379 V(NotEqual, Operator::kNoProperties, 2, 1) \ |
| 421 V(StrictEqual, Operator::kNoThrow, 2, 1) \ | 380 V(StrictEqual, Operator::kNoThrow, 2, 1) \ |
| 422 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ | 381 V(StrictNotEqual, Operator::kNoThrow, 2, 1) \ |
| 382 V(LessThan, Operator::kNoProperties, 2, 1) \ |
| 383 V(GreaterThan, Operator::kNoProperties, 2, 1) \ |
| 384 V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \ |
| 385 V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) \ |
| 423 V(ToNumber, Operator::kNoProperties, 1, 1) \ | 386 V(ToNumber, Operator::kNoProperties, 1, 1) \ |
| 424 V(ToString, Operator::kNoProperties, 1, 1) \ | 387 V(ToString, Operator::kNoProperties, 1, 1) \ |
| 425 V(ToName, Operator::kNoProperties, 1, 1) \ | 388 V(ToName, Operator::kNoProperties, 1, 1) \ |
| 426 V(ToObject, Operator::kNoProperties, 1, 1) \ | 389 V(ToObject, Operator::kNoProperties, 1, 1) \ |
| 427 V(Yield, Operator::kNoProperties, 1, 1) \ | 390 V(Yield, Operator::kNoProperties, 1, 1) \ |
| 428 V(Create, Operator::kEliminatable, 2, 1) \ | 391 V(Create, Operator::kEliminatable, 2, 1) \ |
| 429 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ | 392 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ |
| 430 V(HasProperty, Operator::kNoProperties, 2, 1) \ | 393 V(HasProperty, Operator::kNoProperties, 2, 1) \ |
| 431 V(TypeOf, Operator::kEliminatable, 1, 1) \ | 394 V(TypeOf, Operator::kEliminatable, 1, 1) \ |
| 432 V(InstanceOf, Operator::kNoProperties, 2, 1) \ | 395 V(InstanceOf, Operator::kNoProperties, 2, 1) \ |
| 433 V(ForInDone, Operator::kPure, 2, 1) \ | 396 V(ForInDone, Operator::kPure, 2, 1) \ |
| 434 V(ForInNext, Operator::kNoProperties, 4, 1) \ | 397 V(ForInNext, Operator::kNoProperties, 4, 1) \ |
| 435 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ | 398 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ |
| 436 V(ForInStep, Operator::kPure, 1, 1) \ | 399 V(ForInStep, Operator::kPure, 1, 1) \ |
| 437 V(LoadMessage, Operator::kNoThrow, 0, 1) \ | 400 V(LoadMessage, Operator::kNoThrow, 0, 1) \ |
| 438 V(StoreMessage, Operator::kNoThrow, 1, 0) \ | 401 V(StoreMessage, Operator::kNoThrow, 1, 0) \ |
| 439 V(StackCheck, Operator::kNoProperties, 0, 0) \ | 402 V(StackCheck, Operator::kNoProperties, 0, 0) \ |
| 440 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ | 403 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ |
| 441 V(CreateModuleContext, Operator::kNoProperties, 2, 1) | 404 V(CreateModuleContext, Operator::kNoProperties, 2, 1) |
| 442 | 405 |
| 443 | |
| 444 #define CACHED_OP_LIST_WITH_LANGUAGE_MODE(V) \ | |
| 445 V(LessThan, Operator::kNoProperties, 2, 1) \ | |
| 446 V(GreaterThan, Operator::kNoProperties, 2, 1) \ | |
| 447 V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \ | |
| 448 V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) | |
| 449 | |
| 450 | |
| 451 struct JSOperatorGlobalCache final { | 406 struct JSOperatorGlobalCache final { |
| 452 #define CACHED(Name, properties, value_input_count, value_output_count) \ | 407 #define CACHED(Name, properties, value_input_count, value_output_count) \ |
| 453 struct Name##Operator final : public Operator { \ | 408 struct Name##Operator final : public Operator { \ |
| 454 Name##Operator() \ | 409 Name##Operator() \ |
| 455 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ | 410 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ |
| 456 value_input_count, Operator::ZeroIfPure(properties), \ | 411 value_input_count, Operator::ZeroIfPure(properties), \ |
| 457 Operator::ZeroIfEliminatable(properties), \ | 412 Operator::ZeroIfEliminatable(properties), \ |
| 458 value_output_count, Operator::ZeroIfPure(properties), \ | 413 value_output_count, Operator::ZeroIfPure(properties), \ |
| 459 Operator::ZeroIfNoThrow(properties)) {} \ | 414 Operator::ZeroIfNoThrow(properties)) {} \ |
| 460 }; \ | 415 }; \ |
| 461 Name##Operator k##Name##Operator; | 416 Name##Operator k##Name##Operator; |
| 462 CACHED_OP_LIST(CACHED) | 417 CACHED_OP_LIST(CACHED) |
| 463 #undef CACHED | 418 #undef CACHED |
| 464 | |
| 465 | |
| 466 #define CACHED_WITH_LANGUAGE_MODE(Name, properties, value_input_count, \ | |
| 467 value_output_count) \ | |
| 468 template <LanguageMode kLanguageMode> \ | |
| 469 struct Name##Operator final : public Operator1<LanguageMode> { \ | |
| 470 Name##Operator() \ | |
| 471 : Operator1<LanguageMode>( \ | |
| 472 IrOpcode::kJS##Name, properties, "JS" #Name, value_input_count, \ | |
| 473 Operator::ZeroIfPure(properties), \ | |
| 474 Operator::ZeroIfEliminatable(properties), value_output_count, \ | |
| 475 Operator::ZeroIfPure(properties), \ | |
| 476 Operator::ZeroIfNoThrow(properties), kLanguageMode) {} \ | |
| 477 }; \ | |
| 478 Name##Operator<SLOPPY> k##Name##SloppyOperator; \ | |
| 479 Name##Operator<STRICT> k##Name##StrictOperator; \ | |
| 480 Name##Operator<STRONG> k##Name##StrongOperator; | |
| 481 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | |
| 482 #undef CACHED_WITH_LANGUAGE_MODE | |
| 483 }; | 419 }; |
| 484 | 420 |
| 485 | 421 |
| 486 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = | 422 static base::LazyInstance<JSOperatorGlobalCache>::type kCache = |
| 487 LAZY_INSTANCE_INITIALIZER; | 423 LAZY_INSTANCE_INITIALIZER; |
| 488 | 424 |
| 489 | 425 |
| 490 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) | 426 JSOperatorBuilder::JSOperatorBuilder(Zone* zone) |
| 491 : cache_(kCache.Get()), zone_(zone) {} | 427 : cache_(kCache.Get()), zone_(zone) {} |
| 492 | 428 |
| 493 | 429 |
| 494 #define CACHED(Name, properties, value_input_count, value_output_count) \ | 430 #define CACHED(Name, properties, value_input_count, value_output_count) \ |
| 495 const Operator* JSOperatorBuilder::Name() { \ | 431 const Operator* JSOperatorBuilder::Name() { \ |
| 496 return &cache_.k##Name##Operator; \ | 432 return &cache_.k##Name##Operator; \ |
| 497 } | 433 } |
| 498 CACHED_OP_LIST(CACHED) | 434 CACHED_OP_LIST(CACHED) |
| 499 #undef CACHED | 435 #undef CACHED |
| 500 | 436 |
| 437 const Operator* JSOperatorBuilder::BitwiseOr(BinaryOperationHints hints) { |
| 438 // TODO(turbofan): Cache most important versions of this operator. |
| 439 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 440 IrOpcode::kJSBitwiseOr, Operator::kNoProperties, // opcode |
| 441 "JSBitwiseOr", // name |
| 442 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 443 hints); // parameter |
| 444 } |
| 501 | 445 |
| 502 #define CACHED_WITH_LANGUAGE_MODE(Name, properties, value_input_count, \ | 446 const Operator* JSOperatorBuilder::BitwiseXor(BinaryOperationHints hints) { |
| 503 value_output_count) \ | 447 // TODO(turbofan): Cache most important versions of this operator. |
| 504 const Operator* JSOperatorBuilder::Name(LanguageMode language_mode) { \ | 448 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 505 switch (language_mode) { \ | 449 IrOpcode::kJSBitwiseXor, Operator::kNoProperties, // opcode |
| 506 case SLOPPY: \ | 450 "JSBitwiseXor", // name |
| 507 return &cache_.k##Name##SloppyOperator; \ | 451 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 508 case STRICT: \ | 452 hints); // parameter |
| 509 return &cache_.k##Name##StrictOperator; \ | 453 } |
| 510 case STRONG: \ | |
| 511 return &cache_.k##Name##StrongOperator; \ | |
| 512 default: \ | |
| 513 break; /* %*!%^$#@ */ \ | |
| 514 } \ | |
| 515 UNREACHABLE(); \ | |
| 516 return nullptr; \ | |
| 517 } | |
| 518 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | |
| 519 #undef CACHED_WITH_LANGUAGE_MODE | |
| 520 | 454 |
| 455 const Operator* JSOperatorBuilder::BitwiseAnd(BinaryOperationHints hints) { |
| 456 // TODO(turbofan): Cache most important versions of this operator. |
| 457 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 458 IrOpcode::kJSBitwiseAnd, Operator::kNoProperties, // opcode |
| 459 "JSBitwiseAnd", // name |
| 460 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 461 hints); // parameter |
| 462 } |
| 521 | 463 |
| 522 const Operator* JSOperatorBuilder::BitwiseOr(LanguageMode language_mode, | 464 const Operator* JSOperatorBuilder::ShiftLeft(BinaryOperationHints hints) { |
| 523 BinaryOperationHints hints) { | |
| 524 // TODO(turbofan): Cache most important versions of this operator. | 465 // TODO(turbofan): Cache most important versions of this operator. |
| 525 BinaryOperationParameters parameters(language_mode, hints); | 466 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 526 return new (zone()) Operator1<BinaryOperationParameters>( //-- | 467 IrOpcode::kJSShiftLeft, Operator::kNoProperties, // opcode |
| 527 IrOpcode::kJSBitwiseOr, Operator::kNoProperties, // opcode | 468 "JSShiftLeft", // name |
| 528 "JSBitwiseOr", // name | 469 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 529 2, 1, 1, 1, 1, 2, // inputs/outputs | 470 hints); // parameter |
| 530 parameters); // parameter | 471 } |
| 472 |
| 473 const Operator* JSOperatorBuilder::ShiftRight(BinaryOperationHints hints) { |
| 474 // TODO(turbofan): Cache most important versions of this operator. |
| 475 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 476 IrOpcode::kJSShiftRight, Operator::kNoProperties, // opcode |
| 477 "JSShiftRight", // name |
| 478 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 479 hints); // parameter |
| 480 } |
| 481 |
| 482 const Operator* JSOperatorBuilder::ShiftRightLogical( |
| 483 BinaryOperationHints hints) { |
| 484 // TODO(turbofan): Cache most important versions of this operator. |
| 485 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 486 IrOpcode::kJSShiftRightLogical, Operator::kNoProperties, // opcode |
| 487 "JSShiftRightLogical", // name |
| 488 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 489 hints); // parameter |
| 490 } |
| 491 |
| 492 const Operator* JSOperatorBuilder::Add(BinaryOperationHints hints) { |
| 493 // TODO(turbofan): Cache most important versions of this operator. |
| 494 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 495 IrOpcode::kJSAdd, Operator::kNoProperties, // opcode |
| 496 "JSAdd", // name |
| 497 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 498 hints); // parameter |
| 499 } |
| 500 |
| 501 const Operator* JSOperatorBuilder::Subtract(BinaryOperationHints hints) { |
| 502 // TODO(turbofan): Cache most important versions of this operator. |
| 503 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 504 IrOpcode::kJSSubtract, Operator::kNoProperties, // opcode |
| 505 "JSSubtract", // name |
| 506 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 507 hints); // parameter |
| 508 } |
| 509 |
| 510 const Operator* JSOperatorBuilder::Multiply(BinaryOperationHints hints) { |
| 511 // TODO(turbofan): Cache most important versions of this operator. |
| 512 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 513 IrOpcode::kJSMultiply, Operator::kNoProperties, // opcode |
| 514 "JSMultiply", // name |
| 515 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 516 hints); // parameter |
| 517 } |
| 518 |
| 519 const Operator* JSOperatorBuilder::Divide(BinaryOperationHints hints) { |
| 520 // TODO(turbofan): Cache most important versions of this operator. |
| 521 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 522 IrOpcode::kJSDivide, Operator::kNoProperties, // opcode |
| 523 "JSDivide", // name |
| 524 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 525 hints); // parameter |
| 526 } |
| 527 |
| 528 const Operator* JSOperatorBuilder::Modulus(BinaryOperationHints hints) { |
| 529 // TODO(turbofan): Cache most important versions of this operator. |
| 530 return new (zone()) Operator1<BinaryOperationHints>( //-- |
| 531 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode |
| 532 "JSModulus", // name |
| 533 2, 1, 1, 1, 1, 2, // inputs/outputs |
| 534 hints); // parameter |
| 531 } | 535 } |
| 532 | 536 |
| 533 | 537 |
| 534 const Operator* JSOperatorBuilder::BitwiseXor(LanguageMode language_mode, | |
| 535 BinaryOperationHints hints) { | |
| 536 // TODO(turbofan): Cache most important versions of this operator. | |
| 537 BinaryOperationParameters parameters(language_mode, hints); | |
| 538 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 539 IrOpcode::kJSBitwiseXor, Operator::kNoProperties, // opcode | |
| 540 "JSBitwiseXor", // name | |
| 541 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 542 parameters); // parameter | |
| 543 } | |
| 544 | |
| 545 | |
| 546 const Operator* JSOperatorBuilder::BitwiseAnd(LanguageMode language_mode, | |
| 547 BinaryOperationHints hints) { | |
| 548 // TODO(turbofan): Cache most important versions of this operator. | |
| 549 BinaryOperationParameters parameters(language_mode, hints); | |
| 550 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 551 IrOpcode::kJSBitwiseAnd, Operator::kNoProperties, // opcode | |
| 552 "JSBitwiseAnd", // name | |
| 553 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 554 parameters); // parameter | |
| 555 } | |
| 556 | |
| 557 | |
| 558 const Operator* JSOperatorBuilder::ShiftLeft(LanguageMode language_mode, | |
| 559 BinaryOperationHints hints) { | |
| 560 // TODO(turbofan): Cache most important versions of this operator. | |
| 561 BinaryOperationParameters parameters(language_mode, hints); | |
| 562 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 563 IrOpcode::kJSShiftLeft, Operator::kNoProperties, // opcode | |
| 564 "JSShiftLeft", // name | |
| 565 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 566 parameters); // parameter | |
| 567 } | |
| 568 | |
| 569 | |
| 570 const Operator* JSOperatorBuilder::ShiftRight(LanguageMode language_mode, | |
| 571 BinaryOperationHints hints) { | |
| 572 // TODO(turbofan): Cache most important versions of this operator. | |
| 573 BinaryOperationParameters parameters(language_mode, hints); | |
| 574 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 575 IrOpcode::kJSShiftRight, Operator::kNoProperties, // opcode | |
| 576 "JSShiftRight", // name | |
| 577 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 578 parameters); // parameter | |
| 579 } | |
| 580 | |
| 581 | |
| 582 const Operator* JSOperatorBuilder::ShiftRightLogical( | |
| 583 LanguageMode language_mode, BinaryOperationHints hints) { | |
| 584 // TODO(turbofan): Cache most important versions of this operator. | |
| 585 BinaryOperationParameters parameters(language_mode, hints); | |
| 586 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 587 IrOpcode::kJSShiftRightLogical, Operator::kNoProperties, // opcode | |
| 588 "JSShiftRightLogical", // name | |
| 589 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 590 parameters); // parameter | |
| 591 } | |
| 592 | |
| 593 | |
| 594 const Operator* JSOperatorBuilder::Add(LanguageMode language_mode, | |
| 595 BinaryOperationHints hints) { | |
| 596 // TODO(turbofan): Cache most important versions of this operator. | |
| 597 BinaryOperationParameters parameters(language_mode, hints); | |
| 598 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 599 IrOpcode::kJSAdd, Operator::kNoProperties, // opcode | |
| 600 "JSAdd", // name | |
| 601 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 602 parameters); // parameter | |
| 603 } | |
| 604 | |
| 605 | |
| 606 const Operator* JSOperatorBuilder::Subtract(LanguageMode language_mode, | |
| 607 BinaryOperationHints hints) { | |
| 608 // TODO(turbofan): Cache most important versions of this operator. | |
| 609 BinaryOperationParameters parameters(language_mode, hints); | |
| 610 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 611 IrOpcode::kJSSubtract, Operator::kNoProperties, // opcode | |
| 612 "JSSubtract", // name | |
| 613 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 614 parameters); // parameter | |
| 615 } | |
| 616 | |
| 617 | |
| 618 const Operator* JSOperatorBuilder::Multiply(LanguageMode language_mode, | |
| 619 BinaryOperationHints hints) { | |
| 620 // TODO(turbofan): Cache most important versions of this operator. | |
| 621 BinaryOperationParameters parameters(language_mode, hints); | |
| 622 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 623 IrOpcode::kJSMultiply, Operator::kNoProperties, // opcode | |
| 624 "JSMultiply", // name | |
| 625 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 626 parameters); // parameter | |
| 627 } | |
| 628 | |
| 629 | |
| 630 const Operator* JSOperatorBuilder::Divide(LanguageMode language_mode, | |
| 631 BinaryOperationHints hints) { | |
| 632 // TODO(turbofan): Cache most important versions of this operator. | |
| 633 BinaryOperationParameters parameters(language_mode, hints); | |
| 634 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 635 IrOpcode::kJSDivide, Operator::kNoProperties, // opcode | |
| 636 "JSDivide", // name | |
| 637 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 638 parameters); // parameter | |
| 639 } | |
| 640 | |
| 641 | |
| 642 const Operator* JSOperatorBuilder::Modulus(LanguageMode language_mode, | |
| 643 BinaryOperationHints hints) { | |
| 644 // TODO(turbofan): Cache most important versions of this operator. | |
| 645 BinaryOperationParameters parameters(language_mode, hints); | |
| 646 return new (zone()) Operator1<BinaryOperationParameters>( //-- | |
| 647 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode | |
| 648 "JSModulus", // name | |
| 649 2, 1, 1, 1, 1, 2, // inputs/outputs | |
| 650 parameters); // parameter | |
| 651 } | |
| 652 | |
| 653 | |
| 654 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 538 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
| 655 // TODO(turbofan): Cache most important versions of this operator. | 539 // TODO(turbofan): Cache most important versions of this operator. |
| 656 return new (zone()) Operator1<ToBooleanHints>( //-- | 540 return new (zone()) Operator1<ToBooleanHints>( //-- |
| 657 IrOpcode::kJSToBoolean, Operator::kEliminatable, // opcode | 541 IrOpcode::kJSToBoolean, Operator::kEliminatable, // opcode |
| 658 "JSToBoolean", // name | 542 "JSToBoolean", // name |
| 659 1, 1, 0, 1, 1, 0, // inputs/outputs | 543 1, 1, 0, 1, 1, 0, // inputs/outputs |
| 660 hints); // parameter | 544 hints); // parameter |
| 661 } | 545 } |
| 662 | 546 |
| 663 | 547 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 811 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 928 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 812 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 929 "JSCreateScriptContext", // name | 813 "JSCreateScriptContext", // name |
| 930 1, 1, 1, 1, 1, 2, // counts | 814 1, 1, 1, 1, 1, 2, // counts |
| 931 scpope_info); // parameter | 815 scpope_info); // parameter |
| 932 } | 816 } |
| 933 | 817 |
| 934 } // namespace compiler | 818 } // namespace compiler |
| 935 } // namespace internal | 819 } // namespace internal |
| 936 } // namespace v8 | 820 } // namespace v8 |
| OLD | NEW |