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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 | 370 |
371 | 371 |
372 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { | 372 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op) { |
373 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || | 373 DCHECK(op->opcode() == IrOpcode::kJSCreateLiteralArray || |
374 op->opcode() == IrOpcode::kJSCreateLiteralObject || | 374 op->opcode() == IrOpcode::kJSCreateLiteralObject || |
375 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); | 375 op->opcode() == IrOpcode::kJSCreateLiteralRegExp); |
376 return OpParameter<CreateLiteralParameters>(op); | 376 return OpParameter<CreateLiteralParameters>(op); |
377 } | 377 } |
378 | 378 |
379 #define CACHED_OP_LIST(V) \ | 379 #define CACHED_OP_LIST(V) \ |
380 V(Equal, Operator::kNoProperties, 2, 1) \ | 380 V(Equal, Operator::kNoProperties, 2, 1) \ |
381 V(NotEqual, Operator::kNoProperties, 2, 1) \ | 381 V(NotEqual, Operator::kNoProperties, 2, 1) \ |
382 V(StrictEqual, Operator::kPure, 2, 1) \ | 382 V(StrictEqual, Operator::kPure, 2, 1) \ |
383 V(StrictNotEqual, Operator::kPure, 2, 1) \ | 383 V(StrictNotEqual, Operator::kPure, 2, 1) \ |
384 V(LessThan, Operator::kNoProperties, 2, 1) \ | 384 V(LessThan, Operator::kNoProperties, 2, 1) \ |
385 V(GreaterThan, Operator::kNoProperties, 2, 1) \ | 385 V(GreaterThan, Operator::kNoProperties, 2, 1) \ |
386 V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \ | 386 V(LessThanOrEqual, Operator::kNoProperties, 2, 1) \ |
387 V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) \ | 387 V(GreaterThanOrEqual, Operator::kNoProperties, 2, 1) \ |
388 V(ToInteger, Operator::kNoProperties, 1, 1) \ | 388 V(ToInteger, Operator::kNoProperties, 1, 1) \ |
389 V(ToLength, Operator::kNoProperties, 1, 1) \ | 389 V(ToLength, Operator::kNoProperties, 1, 1) \ |
390 V(ToName, Operator::kNoProperties, 1, 1) \ | 390 V(ToName, Operator::kNoProperties, 1, 1) \ |
391 V(ToNumber, Operator::kNoProperties, 1, 1) \ | 391 V(ToNumber, Operator::kNoProperties, 1, 1) \ |
392 V(ToObject, Operator::kFoldable, 1, 1) \ | 392 V(ToObject, Operator::kFoldable, 1, 1) \ |
393 V(ToString, Operator::kNoProperties, 1, 1) \ | 393 V(ToString, Operator::kNoProperties, 1, 1) \ |
394 V(Create, Operator::kEliminatable, 2, 1) \ | 394 V(Create, Operator::kEliminatable, 2, 1) \ |
395 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ | 395 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ |
396 V(HasProperty, Operator::kNoProperties, 2, 1) \ | 396 V(HasProperty, Operator::kNoProperties, 2, 1) \ |
397 V(TypeOf, Operator::kPure, 1, 1) \ | 397 V(TypeOf, Operator::kPure, 1, 1) \ |
398 V(InstanceOf, Operator::kNoProperties, 2, 1) \ | 398 V(InstanceOf, Operator::kNoProperties, 2, 1) \ |
399 V(ForInDone, Operator::kPure, 2, 1) \ | 399 V(ForInDone, Operator::kPure, 2, 1) \ |
400 V(ForInNext, Operator::kNoProperties, 4, 1) \ | 400 V(ForInNext, Operator::kNoProperties, 4, 1) \ |
401 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ | 401 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ |
402 V(ForInStep, Operator::kPure, 1, 1) \ | 402 V(ForInStep, Operator::kPure, 1, 1) \ |
403 V(LoadMessage, Operator::kNoThrow, 0, 1) \ | 403 V(LoadMessage, Operator::kNoThrow, 0, 1) \ |
404 V(StoreMessage, Operator::kNoThrow, 1, 0) \ | 404 V(StoreMessage, Operator::kNoThrow, 1, 0) \ |
405 V(StackCheck, Operator::kNoProperties, 0, 0) \ | 405 V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ |
406 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ | 406 V(StackCheck, Operator::kNoProperties, 0, 0) \ |
| 407 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ |
407 V(CreateModuleContext, Operator::kNoProperties, 2, 1) | 408 V(CreateModuleContext, Operator::kNoProperties, 2, 1) |
408 | 409 |
409 struct JSOperatorGlobalCache final { | 410 struct JSOperatorGlobalCache final { |
410 #define CACHED(Name, properties, value_input_count, value_output_count) \ | 411 #define CACHED(Name, properties, value_input_count, value_output_count) \ |
411 struct Name##Operator final : public Operator { \ | 412 struct Name##Operator final : public Operator { \ |
412 Name##Operator() \ | 413 Name##Operator() \ |
413 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ | 414 : Operator(IrOpcode::kJS##Name, properties, "JS" #Name, \ |
414 value_input_count, Operator::ZeroIfPure(properties), \ | 415 value_input_count, Operator::ZeroIfPure(properties), \ |
415 Operator::ZeroIfEliminatable(properties), \ | 416 Operator::ZeroIfEliminatable(properties), \ |
416 value_output_count, Operator::ZeroIfPure(properties), \ | 417 value_output_count, Operator::ZeroIfPure(properties), \ |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 const Operator* JSOperatorBuilder::LoadProperty( | 619 const Operator* JSOperatorBuilder::LoadProperty( |
619 VectorSlotPair const& feedback) { | 620 VectorSlotPair const& feedback) { |
620 PropertyAccess access(SLOPPY, feedback); | 621 PropertyAccess access(SLOPPY, feedback); |
621 return new (zone()) Operator1<PropertyAccess>( // -- | 622 return new (zone()) Operator1<PropertyAccess>( // -- |
622 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode | 623 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode |
623 "JSLoadProperty", // name | 624 "JSLoadProperty", // name |
624 3, 1, 1, 1, 1, 2, // counts | 625 3, 1, 1, 1, 1, 2, // counts |
625 access); // parameter | 626 access); // parameter |
626 } | 627 } |
627 | 628 |
| 629 const Operator* JSOperatorBuilder::GeneratorStore(int register_count) { |
| 630 return new (zone()) Operator1<int>( // -- |
| 631 IrOpcode::kJSGeneratorStore, Operator::kNoThrow, // opcode |
| 632 "JSGeneratorStore", // name |
| 633 2 + register_count, 1, 1, 0, 1, 0, // counts |
| 634 register_count); // parameter |
| 635 } |
| 636 |
| 637 const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) { |
| 638 return new (zone()) Operator1<int>( // -- |
| 639 IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode |
| 640 "JSGeneratorRestoreRegister", // name |
| 641 1, 1, 1, 1, 1, 0, // counts |
| 642 index); // parameter |
| 643 } |
628 | 644 |
629 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, | 645 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, |
630 Handle<Name> name, | 646 Handle<Name> name, |
631 VectorSlotPair const& feedback) { | 647 VectorSlotPair const& feedback) { |
632 NamedAccess access(language_mode, name, feedback); | 648 NamedAccess access(language_mode, name, feedback); |
633 return new (zone()) Operator1<NamedAccess>( // -- | 649 return new (zone()) Operator1<NamedAccess>( // -- |
634 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode | 650 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode |
635 "JSStoreNamed", // name | 651 "JSStoreNamed", // name |
636 3, 1, 1, 0, 1, 2, // counts | 652 3, 1, 1, 0, 1, 2, // counts |
637 access); // parameter | 653 access); // parameter |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 824 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
809 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 825 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
810 "JSCreateScriptContext", // name | 826 "JSCreateScriptContext", // name |
811 1, 1, 1, 1, 1, 2, // counts | 827 1, 1, 1, 1, 1, 2, // counts |
812 scpope_info); // parameter | 828 scpope_info); // parameter |
813 } | 829 } |
814 | 830 |
815 } // namespace compiler | 831 } // namespace compiler |
816 } // namespace internal | 832 } // namespace internal |
817 } // namespace v8 | 833 } // namespace v8 |
OLD | NEW |