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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::kNoThrow, 2, 1) \ | 382 V(StrictEqual, Operator::kPure, 2, 1) \ |
383 V(StrictNotEqual, Operator::kNoThrow, 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::kNoProperties, 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(Yield, Operator::kNoProperties, 1, 1) \ | 394 V(Yield, Operator::kNoProperties, 1, 1) \ |
395 V(Create, Operator::kEliminatable, 2, 1) \ | 395 V(Create, Operator::kEliminatable, 2, 1) \ |
396 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ | 396 V(CreateIterResultObject, Operator::kEliminatable, 2, 1) \ |
397 V(HasProperty, Operator::kNoProperties, 2, 1) \ | 397 V(HasProperty, Operator::kNoProperties, 2, 1) \ |
398 V(TypeOf, Operator::kEliminatable, 1, 1) \ | 398 V(TypeOf, Operator::kPure, 1, 1) \ |
399 V(InstanceOf, Operator::kNoProperties, 2, 1) \ | 399 V(InstanceOf, Operator::kNoProperties, 2, 1) \ |
400 V(ForInDone, Operator::kPure, 2, 1) \ | 400 V(ForInDone, Operator::kPure, 2, 1) \ |
401 V(ForInNext, Operator::kNoProperties, 4, 1) \ | 401 V(ForInNext, Operator::kNoProperties, 4, 1) \ |
402 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ | 402 V(ForInPrepare, Operator::kNoProperties, 1, 3) \ |
403 V(ForInStep, Operator::kPure, 1, 1) \ | 403 V(ForInStep, Operator::kPure, 1, 1) \ |
404 V(LoadMessage, Operator::kNoThrow, 0, 1) \ | 404 V(LoadMessage, Operator::kNoThrow, 0, 1) \ |
405 V(StoreMessage, Operator::kNoThrow, 1, 0) \ | 405 V(StoreMessage, Operator::kNoThrow, 1, 0) \ |
406 V(StackCheck, Operator::kNoProperties, 0, 0) \ | 406 V(StackCheck, Operator::kNoProperties, 0, 0) \ |
407 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ | 407 V(CreateWithContext, Operator::kNoProperties, 2, 1) \ |
408 V(CreateModuleContext, Operator::kNoProperties, 2, 1) | 408 V(CreateModuleContext, Operator::kNoProperties, 2, 1) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 return new (zone()) Operator1<BinaryOperationHints>( //-- | 534 return new (zone()) Operator1<BinaryOperationHints>( //-- |
535 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode | 535 IrOpcode::kJSModulus, Operator::kNoProperties, // opcode |
536 "JSModulus", // name | 536 "JSModulus", // name |
537 2, 1, 1, 1, 1, 2, // inputs/outputs | 537 2, 1, 1, 1, 1, 2, // inputs/outputs |
538 hints); // parameter | 538 hints); // parameter |
539 } | 539 } |
540 | 540 |
541 | 541 |
542 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { | 542 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { |
543 // TODO(turbofan): Cache most important versions of this operator. | 543 // TODO(turbofan): Cache most important versions of this operator. |
544 return new (zone()) Operator1<ToBooleanHints>( //-- | 544 return new (zone()) Operator1<ToBooleanHints>( //-- |
545 IrOpcode::kJSToBoolean, Operator::kEliminatable, // opcode | 545 IrOpcode::kJSToBoolean, Operator::kPure, // opcode |
546 "JSToBoolean", // name | 546 "JSToBoolean", // name |
547 1, 1, 0, 1, 1, 0, // inputs/outputs | 547 1, 0, 0, 1, 0, 0, // inputs/outputs |
548 hints); // parameter | 548 hints); // parameter |
549 } | 549 } |
550 | 550 |
551 const Operator* JSOperatorBuilder::CallFunction( | 551 const Operator* JSOperatorBuilder::CallFunction( |
552 size_t arity, VectorSlotPair const& feedback, | 552 size_t arity, VectorSlotPair const& feedback, |
553 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { | 553 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { |
554 CallFunctionParameters parameters(arity, feedback, tail_call_mode, | 554 CallFunctionParameters parameters(arity, feedback, tail_call_mode, |
555 convert_mode); | 555 convert_mode); |
556 return new (zone()) Operator1<CallFunctionParameters>( // -- | 556 return new (zone()) Operator1<CallFunctionParameters>( // -- |
557 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode | 557 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode |
558 "JSCallFunction", // name | 558 "JSCallFunction", // name |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 809 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
810 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 810 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
811 "JSCreateScriptContext", // name | 811 "JSCreateScriptContext", // name |
812 1, 1, 1, 1, 1, 2, // counts | 812 1, 1, 1, 1, 1, 2, // counts |
813 scpope_info); // parameter | 813 scpope_info); // parameter |
814 } | 814 } |
815 | 815 |
816 } // namespace compiler | 816 } // namespace compiler |
817 } // namespace internal | 817 } // namespace internal |
818 } // namespace v8 | 818 } // namespace v8 |
OLD | NEW |