Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { |
| 34 return !(lhs == rhs); | 34 return !(lhs == rhs); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 size_t hash_value(VectorSlotPair const& p) { | 38 size_t hash_value(VectorSlotPair const& p) { |
| 39 return base::hash_combine(p.slot(), p.vector().location()); | 39 return base::hash_combine(p.slot(), p.vector().location()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 size_t hash_value(ConvertReceiverMode const& mode) { | |
| 44 return base::hash_value(static_cast<int>(mode)); | |
| 45 } | |
| 46 | |
| 47 | |
| 48 std::ostream& operator<<(std::ostream& os, ConvertReceiverMode const& mode) { | |
| 49 switch (mode) { | |
| 50 case ConvertReceiverMode::kNullOrUndefined: | |
| 51 return os << "NULL_OR_UNDEFINED"; | |
| 52 case ConvertReceiverMode::kNotNullOrUndefined: | |
| 53 return os << "NOT_NULL_OR_UNDEFINED"; | |
| 54 case ConvertReceiverMode::kAny: | |
| 55 return os << "ANY"; | |
| 56 } | |
|
Benedikt Meurer
2015/10/27 11:24:42
Nit: UNREACHABLE(); return os;
Michael Starzinger
2015/10/27 11:35:55
Done.
| |
| 57 } | |
| 58 | |
| 59 | |
| 43 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 60 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { |
| 44 os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); | 61 os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); |
| 45 if (p.AllowTailCalls()) { | 62 if (p.AllowTailCalls()) { |
| 46 os << ", ALLOW_TAIL_CALLS"; | 63 os << ", ALLOW_TAIL_CALLS"; |
| 47 } | 64 } |
| 48 return os; | 65 return os; |
| 49 } | 66 } |
| 50 | 67 |
| 51 | 68 |
| 52 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 69 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 default: \ | 506 default: \ |
| 490 break; /* %*!%^$#@ */ \ | 507 break; /* %*!%^$#@ */ \ |
| 491 } \ | 508 } \ |
| 492 UNREACHABLE(); \ | 509 UNREACHABLE(); \ |
| 493 return nullptr; \ | 510 return nullptr; \ |
| 494 } | 511 } |
| 495 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | 512 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) |
| 496 #undef CACHED_WITH_LANGUAGE_MODE | 513 #undef CACHED_WITH_LANGUAGE_MODE |
| 497 | 514 |
| 498 | 515 |
| 499 const Operator* JSOperatorBuilder::CallFunction(size_t arity, | 516 const Operator* JSOperatorBuilder::CallFunction( |
| 500 CallFunctionFlags flags, | 517 size_t arity, CallFunctionFlags flags, LanguageMode language_mode, |
| 501 LanguageMode language_mode, | 518 VectorSlotPair const& feedback, ConvertReceiverMode convert_mode, |
| 502 VectorSlotPair const& feedback, | 519 TailCallMode tail_call_mode) { |
| 503 TailCallMode tail_call_mode) { | |
| 504 CallFunctionParameters parameters(arity, flags, language_mode, feedback, | 520 CallFunctionParameters parameters(arity, flags, language_mode, feedback, |
| 505 tail_call_mode); | 521 tail_call_mode, convert_mode); |
| 506 return new (zone()) Operator1<CallFunctionParameters>( // -- | 522 return new (zone()) Operator1<CallFunctionParameters>( // -- |
| 507 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 523 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
| 508 "JSCallFunction", // name | 524 "JSCallFunction", // name |
| 509 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs | 525 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs |
| 510 parameters); // parameter | 526 parameters); // parameter |
| 511 } | 527 } |
| 512 | 528 |
| 513 | 529 |
| 514 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 530 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, |
| 515 size_t arity) { | 531 size_t arity) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 526 | 542 |
| 527 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { | 543 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { |
| 528 return new (zone()) Operator1<int>( // -- | 544 return new (zone()) Operator1<int>( // -- |
| 529 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 545 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
| 530 "JSCallConstruct", // name | 546 "JSCallConstruct", // name |
| 531 arguments, 1, 1, 1, 1, 2, // counts | 547 arguments, 1, 1, 1, 1, 2, // counts |
| 532 arguments); // parameter | 548 arguments); // parameter |
| 533 } | 549 } |
| 534 | 550 |
| 535 | 551 |
| 552 const Operator* JSOperatorBuilder::ConvertReceiver( | |
| 553 ConvertReceiverMode convert_mode) { | |
| 554 return new (zone()) Operator1<ConvertReceiverMode>( // -- | |
| 555 IrOpcode::kJSConvertReceiver, Operator::kNoThrow, // opcode | |
| 556 "JSConvertReceiver", // name | |
| 557 1, 1, 1, 1, 1, 0, // counts | |
| 558 convert_mode); // parameter | |
| 559 } | |
| 560 | |
| 561 | |
| 536 const Operator* JSOperatorBuilder::LoadNamed(LanguageMode language_mode, | 562 const Operator* JSOperatorBuilder::LoadNamed(LanguageMode language_mode, |
| 537 Handle<Name> name, | 563 Handle<Name> name, |
| 538 const VectorSlotPair& feedback) { | 564 const VectorSlotPair& feedback) { |
| 539 NamedAccess access(language_mode, name, feedback); | 565 NamedAccess access(language_mode, name, feedback); |
| 540 return new (zone()) Operator1<NamedAccess>( // -- | 566 return new (zone()) Operator1<NamedAccess>( // -- |
| 541 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 567 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
| 542 "JSLoadNamed", // name | 568 "JSLoadNamed", // name |
| 543 2, 1, 1, 1, 1, 2, // counts | 569 2, 1, 1, 1, 1, 2, // counts |
| 544 access); // parameter | 570 access); // parameter |
| 545 } | 571 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 Handle<ScopeInfo>::hash>( // -- | 764 Handle<ScopeInfo>::hash>( // -- |
| 739 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 765 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 740 "JSCreateScriptContext", // name | 766 "JSCreateScriptContext", // name |
| 741 1, 1, 1, 1, 1, 2, // counts | 767 1, 1, 1, 1, 1, 2, // counts |
| 742 scpope_info); // parameter | 768 scpope_info); // parameter |
| 743 } | 769 } |
| 744 | 770 |
| 745 } // namespace compiler | 771 } // namespace compiler |
| 746 } // namespace internal | 772 } // namespace internal |
| 747 } // namespace v8 | 773 } // namespace v8 |
| OLD | NEW |