Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: src/ia32/lithium-ia32.h

Issue 6215002: Introduce two more template parameter for Lithium instructions for input and ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 class LInstruction: public ZoneObject { 289 class LInstruction: public ZoneObject {
290 public: 290 public:
291 LInstruction() 291 LInstruction()
292 : hydrogen_value_(NULL) { } 292 : hydrogen_value_(NULL) { }
293 virtual ~LInstruction() { } 293 virtual ~LInstruction() { }
294 294
295 virtual void CompileToNative(LCodeGen* generator) = 0; 295 virtual void CompileToNative(LCodeGen* generator) = 0;
296 virtual const char* Mnemonic() const = 0; 296 virtual const char* Mnemonic() const = 0;
297 virtual void PrintTo(StringStream* stream); 297 virtual void PrintTo(StringStream* stream);
298 virtual void PrintDataTo(StringStream* stream) { } 298 virtual void PrintDataTo(StringStream* stream) = 0;
299 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
299 300
300 // Declare virtual type testers. 301 // Declare virtual type testers.
301 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 302 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
302 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 303 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
303 #undef DECLARE_DO 304 #undef DECLARE_DO
304 virtual bool IsControl() const { return false; } 305 virtual bool IsControl() const { return false; }
305 306
306 void set_environment(LEnvironment* env) { environment_.set(env); } 307 void set_environment(LEnvironment* env) { environment_.set(env); }
307 LEnvironment* environment() const { return environment_.get(); } 308 LEnvironment* environment() const { return environment_.get(); }
308 bool HasEnvironment() const { return environment_.is_set(); } 309 bool HasEnvironment() const { return environment_.is_set(); }
(...skipping 18 matching lines...) Expand all
327 } 328 }
328 329
329 private: 330 private:
330 SetOncePointer<LEnvironment> environment_; 331 SetOncePointer<LEnvironment> environment_;
331 SetOncePointer<LPointerMap> pointer_map_; 332 SetOncePointer<LPointerMap> pointer_map_;
332 HValue* hydrogen_value_; 333 HValue* hydrogen_value_;
333 SetOncePointer<LEnvironment> deoptimization_environment_; 334 SetOncePointer<LEnvironment> deoptimization_environment_;
334 }; 335 };
335 336
336 337
337 template <int Result> 338 template<typename T, int N>
338 class LTemplateInstruction: public LInstruction { }; 339 class OperandContainer {
339 340 public:
340 341 OperandContainer() {
341 template<> 342 for (int i = 0; i < N; i++) elems_[i] = NULL;
342 class LTemplateInstruction<0>: public LInstruction { 343 }
343 virtual bool HasResult() const { return false; } 344 int length() const { return N; }
345 T at(int i) const { return elems_[i]; }
346 void set_at(int i, T value) { elems_[i] = value; }
347 private:
348 T elems_[N];
344 }; 349 };
345 350
346 351
347 template<> 352 template<typename T>
348 class LTemplateInstruction<1>: public LInstruction { 353 class OperandContainer<T, 0> {
349 public: 354 public:
350 static LTemplateInstruction<1>* cast(LInstruction* instr) { 355 int length() const { return 0; }
351 ASSERT(instr->HasResult()); 356 T at(int i) const {
352 return reinterpret_cast<LTemplateInstruction<1>*>(instr); 357 UNREACHABLE();
358 return NULL;
353 } 359 }
354 void set_result(LOperand* operand) { result_.set(operand); } 360 void set_at(int i, T value) {
355 LOperand* result() const { return result_.get(); } 361 UNREACHABLE();
356 virtual bool HasResult() const { return result_.is_set(); } 362 }
357 private:
358 SetOncePointer<LOperand> result_;
359 }; 363 };
360 364
361 365
362 class LGap: public LTemplateInstruction<0> { 366 template<int R, int I, int T>
367 class LTemplateInstruction: public LInstruction {
368 public:
369 // Allow 0 or 1 output operands.
370 STATIC_ASSERT(R == 0 || R == 1);
371 virtual bool HasResult() const { return R != 0; }
372 void set_result(LOperand* operand) { outputs_.set_at(0, operand); }
373 LOperand* result() const { return outputs_.at(0); }
374
375 int InputCount() const { return inputs_.length(); }
376 LOperand* InputAt(int i) const { return inputs_.at(i); }
377 void SetInputAt(int i, LOperand* operand) { inputs_.set_at(i, operand); }
378
379 int TempCount() const { return temps_.length(); }
380 LOperand* TempAt(int i) const { return temps_.at(i); }
381
382 virtual void PrintDataTo(StringStream* stream);
383 virtual void PrintOutputOperandTo(StringStream* stream);
384
385 private:
386 OperandContainer<LOperand*, R> outputs_;
387 OperandContainer<LOperand*, I> inputs_;
388 OperandContainer<LOperand*, T> temps_;
389 };
390
391
392 class LGap: public LTemplateInstruction<0, 0, 0> {
363 public: 393 public:
364 explicit LGap(HBasicBlock* block) 394 explicit LGap(HBasicBlock* block)
365 : block_(block) { 395 : block_(block) {
366 parallel_moves_[BEFORE] = NULL; 396 parallel_moves_[BEFORE] = NULL;
367 parallel_moves_[START] = NULL; 397 parallel_moves_[START] = NULL;
368 parallel_moves_[END] = NULL; 398 parallel_moves_[END] = NULL;
369 parallel_moves_[AFTER] = NULL; 399 parallel_moves_[AFTER] = NULL;
370 } 400 }
371 401
372 DECLARE_CONCRETE_INSTRUCTION(Gap, "gap") 402 DECLARE_CONCRETE_INSTRUCTION(Gap, "gap")
(...skipping 20 matching lines...) Expand all
393 LParallelMove* GetParallelMove(InnerPosition pos) { 423 LParallelMove* GetParallelMove(InnerPosition pos) {
394 return parallel_moves_[pos]; 424 return parallel_moves_[pos];
395 } 425 }
396 426
397 private: 427 private:
398 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; 428 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
399 HBasicBlock* block_; 429 HBasicBlock* block_;
400 }; 430 };
401 431
402 432
403 class LGoto: public LTemplateInstruction<0> { 433 class LGoto: public LTemplateInstruction<0, 0, 0> {
404 public: 434 public:
405 LGoto(int block_id, bool include_stack_check = false) 435 LGoto(int block_id, bool include_stack_check = false)
406 : block_id_(block_id), include_stack_check_(include_stack_check) { } 436 : block_id_(block_id), include_stack_check_(include_stack_check) { }
407 437
408 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 438 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
409 virtual void PrintDataTo(StringStream* stream); 439 virtual void PrintDataTo(StringStream* stream);
410 virtual bool IsControl() const { return true; } 440 virtual bool IsControl() const { return true; }
411 441
412 int block_id() const { return block_id_; } 442 int block_id() const { return block_id_; }
413 bool include_stack_check() const { return include_stack_check_; } 443 bool include_stack_check() const { return include_stack_check_; }
414 444
415 private: 445 private:
416 int block_id_; 446 int block_id_;
417 bool include_stack_check_; 447 bool include_stack_check_;
418 }; 448 };
419 449
420 450
421 class LLazyBailout: public LTemplateInstruction<0> { 451 class LLazyBailout: public LTemplateInstruction<0, 0, 0> {
422 public: 452 public:
423 LLazyBailout() : gap_instructions_size_(0) { } 453 LLazyBailout() : gap_instructions_size_(0) { }
424 454
425 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout") 455 DECLARE_CONCRETE_INSTRUCTION(LazyBailout, "lazy-bailout")
426 456
427 void set_gap_instructions_size(int gap_instructions_size) { 457 void set_gap_instructions_size(int gap_instructions_size) {
428 gap_instructions_size_ = gap_instructions_size; 458 gap_instructions_size_ = gap_instructions_size;
429 } 459 }
430 int gap_instructions_size() { return gap_instructions_size_; } 460 int gap_instructions_size() { return gap_instructions_size_; }
431 461
432 private: 462 private:
433 int gap_instructions_size_; 463 int gap_instructions_size_;
434 }; 464 };
435 465
436 466
437 class LDeoptimize: public LTemplateInstruction<0> { 467 class LDeoptimize: public LTemplateInstruction<0, 0, 0> {
438 public: 468 public:
439 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 469 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
440 }; 470 };
441 471
442 472
443 class LLabel: public LGap { 473 class LLabel: public LGap {
444 public: 474 public:
445 explicit LLabel(HBasicBlock* block) 475 explicit LLabel(HBasicBlock* block)
446 : LGap(block), replacement_(NULL) { } 476 : LGap(block), replacement_(NULL) { }
447 477
448 DECLARE_CONCRETE_INSTRUCTION(Label, "label") 478 DECLARE_CONCRETE_INSTRUCTION(Label, "label")
449 479
450 virtual void PrintDataTo(StringStream* stream); 480 virtual void PrintDataTo(StringStream* stream);
451 481
452 int block_id() const { return block()->block_id(); } 482 int block_id() const { return block()->block_id(); }
453 bool is_loop_header() const { return block()->IsLoopHeader(); } 483 bool is_loop_header() const { return block()->IsLoopHeader(); }
454 Label* label() { return &label_; } 484 Label* label() { return &label_; }
455 LLabel* replacement() const { return replacement_; } 485 LLabel* replacement() const { return replacement_; }
456 void set_replacement(LLabel* label) { replacement_ = label; } 486 void set_replacement(LLabel* label) { replacement_ = label; }
457 bool HasReplacement() const { return replacement_ != NULL; } 487 bool HasReplacement() const { return replacement_ != NULL; }
458 488
459 private: 489 private:
460 Label label_; 490 Label label_;
461 LLabel* replacement_; 491 LLabel* replacement_;
462 }; 492 };
463 493
464 494
465 class LParameter: public LTemplateInstruction<1> { 495 class LParameter: public LTemplateInstruction<1, 0, 0> {
466 public: 496 public:
467 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") 497 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
468 }; 498 };
469 499
470 500
471 class LCallStub: public LTemplateInstruction<1> { 501 class LCallStub: public LTemplateInstruction<1, 0, 0> {
472 public: 502 public:
473 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub") 503 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call-stub")
474 DECLARE_HYDROGEN_ACCESSOR(CallStub) 504 DECLARE_HYDROGEN_ACCESSOR(CallStub)
475 505
476 TranscendentalCache::Type transcendental_type() { 506 TranscendentalCache::Type transcendental_type() {
477 return hydrogen()->transcendental_type(); 507 return hydrogen()->transcendental_type();
478 } 508 }
479 }; 509 };
480 510
481 511
482 class LUnknownOSRValue: public LTemplateInstruction<1> { 512 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
483 public: 513 public:
484 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") 514 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
485 }; 515 };
486 516
487 517
488 template<int R> 518 template<int R>
489 class LUnaryOperation: public LTemplateInstruction<R> { 519 class LUnaryOperation: public LTemplateInstruction<R, 1, 0> {
490 public: 520 public:
491 explicit LUnaryOperation(LOperand* input) : input_(input) { } 521 explicit LUnaryOperation<R>(LOperand* input) {
522 this->SetInputAt(0, input);
523 }
524
525 LOperand* input() const { return this->InputAt(0); }
492 526
493 DECLARE_INSTRUCTION(UnaryOperation) 527 DECLARE_INSTRUCTION(UnaryOperation)
494
495 LOperand* input() const { return input_; }
496
497 virtual void PrintDataTo(StringStream* stream);
498
499 private:
500 LOperand* input_;
501 }; 528 };
502 529
503 530
504 class LBinaryOperation: public LTemplateInstruction<1> { 531 template<int R>
532 class LBinaryOperation: public LTemplateInstruction<R, 2, 0> {
505 public: 533 public:
506 LBinaryOperation(LOperand* left, LOperand* right) 534 LBinaryOperation(LOperand* left, LOperand* right) {
507 : left_(left), right_(right) { } 535 this->SetInputAt(0, left);
536 this->SetInputAt(1, right);
537 }
508 538
509 DECLARE_INSTRUCTION(BinaryOperation) 539 DECLARE_INSTRUCTION(BinaryOperation)
510 540
511 LOperand* left() const { return left_; } 541 LOperand* left() const { return this->InputAt(0); }
512 LOperand* right() const { return right_; } 542 LOperand* right() const { return this->InputAt(1); }
513 virtual void PrintDataTo(StringStream* stream);
514
515 private:
516 LOperand* left_;
517 LOperand* right_;
518 }; 543 };
519 544
520 545
521 class LApplyArguments: public LBinaryOperation { 546 class LApplyArguments: public LTemplateInstruction<1, 4, 0> {
522 public: 547 public:
523 LApplyArguments(LOperand* function, 548 LApplyArguments(LOperand* function,
524 LOperand* receiver, 549 LOperand* receiver,
525 LOperand* length, 550 LOperand* length,
526 LOperand* elements) 551 LOperand* elements) {
527 : LBinaryOperation(function, receiver), 552 this->SetInputAt(0, function);
528 length_(length), 553 this->SetInputAt(1, receiver);
529 elements_(elements) { } 554 this->SetInputAt(2, length);
555 this->SetInputAt(3, elements);
556 }
530 557
531 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments") 558 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply-arguments")
532 559
533 LOperand* function() const { return left(); } 560 LOperand* function() const { return InputAt(0); }
534 LOperand* receiver() const { return right(); } 561 LOperand* receiver() const { return InputAt(1); }
535 LOperand* length() const { return length_; } 562 LOperand* length() const { return InputAt(2); }
536 LOperand* elements() const { return elements_; } 563 LOperand* elements() const { return InputAt(3); }
537
538 private:
539 LOperand* length_;
540 LOperand* elements_;
541 }; 564 };
542 565
543 566
544 class LAccessArgumentsAt: public LTemplateInstruction<1> { 567 class LAccessArgumentsAt: public LTemplateInstruction<1, 3, 0> {
545 public: 568 public:
546 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) 569 LAccessArgumentsAt(LOperand* arguments, LOperand* length, LOperand* index) {
547 : arguments_(arguments), length_(length), index_(index) { } 570 this->SetInputAt(0, arguments);
571 this->SetInputAt(1, length);
572 this->SetInputAt(2, index);
573 }
548 574
549 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at") 575 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access-arguments-at")
550 576
551 LOperand* arguments() const { return arguments_; } 577 LOperand* arguments() const { return this->InputAt(0); }
552 LOperand* length() const { return length_; } 578 LOperand* length() const { return this->InputAt(1); }
553 LOperand* index() const { return index_; } 579 LOperand* index() const { return this->InputAt(2); }
554 580
555 virtual void PrintDataTo(StringStream* stream); 581 virtual void PrintDataTo(StringStream* stream);
556
557 private:
558 LOperand* arguments_;
559 LOperand* length_;
560 LOperand* index_;
561 }; 582 };
562 583
563 584
564 class LArgumentsLength: public LUnaryOperation<1> { 585 class LArgumentsLength: public LUnaryOperation<1> {
565 public: 586 public:
566 explicit LArgumentsLength(LOperand* elements) 587 explicit LArgumentsLength(LOperand* elements)
567 : LUnaryOperation<1>(elements) {} 588 : LUnaryOperation<1>(elements) {}
568 589
569 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length") 590 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments-length")
570 }; 591 };
571 592
572 593
573 class LArgumentsElements: public LTemplateInstruction<1> { 594 class LArgumentsElements: public LTemplateInstruction<1, 0, 0> {
574 public: 595 public:
575 LArgumentsElements() { } 596 LArgumentsElements() { }
576 597
577 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements") 598 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments-elements")
578 }; 599 };
579 600
580 601
581 class LModI: public LBinaryOperation { 602 class LModI: public LBinaryOperation<1> {
582 public: 603 public:
583 LModI(LOperand* left, LOperand* right) : LBinaryOperation(left, right) { } 604 LModI(LOperand* left, LOperand* right) : LBinaryOperation<1>(left, right) { }
584 605
585 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i") 606 DECLARE_CONCRETE_INSTRUCTION(ModI, "mod-i")
586 DECLARE_HYDROGEN_ACCESSOR(Mod) 607 DECLARE_HYDROGEN_ACCESSOR(Mod)
587 }; 608 };
588 609
589 610
590 class LDivI: public LBinaryOperation { 611 class LDivI: public LBinaryOperation<1> {
591 public: 612 public:
592 LDivI(LOperand* left, LOperand* right) 613 LDivI(LOperand* left, LOperand* right)
593 : LBinaryOperation(left, right) { } 614 : LBinaryOperation<1>(left, right) { }
594 615
595 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i") 616 DECLARE_CONCRETE_INSTRUCTION(DivI, "div-i")
596 DECLARE_HYDROGEN_ACCESSOR(Div) 617 DECLARE_HYDROGEN_ACCESSOR(Div)
597 }; 618 };
598 619
599 620
600 class LMulI: public LBinaryOperation { 621 class LMulI: public LBinaryOperation<1> {
601 public: 622 public:
602 LMulI(LOperand* left, LOperand* right, LOperand* temp) 623 LMulI(LOperand* left, LOperand* right, LOperand* temp)
603 : LBinaryOperation(left, right), temp_(temp) { } 624 : LBinaryOperation<1>(left, right), temp_(temp) { }
604 625
605 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i") 626 DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
606 DECLARE_HYDROGEN_ACCESSOR(Mul) 627 DECLARE_HYDROGEN_ACCESSOR(Mul)
607 628
608 LOperand* temp() const { return temp_; } 629 LOperand* temp() const { return temp_; }
609 630
610 private: 631 private:
611 LOperand* temp_; 632 LOperand* temp_;
612 }; 633 };
613 634
614 635
615 class LCmpID: public LBinaryOperation { 636 class LCmpID: public LBinaryOperation<1> {
616 public: 637 public:
617 LCmpID(Token::Value op, LOperand* left, LOperand* right, bool is_double) 638 LCmpID(Token::Value op, LOperand* left, LOperand* right, bool is_double)
618 : LBinaryOperation(left, right), op_(op), is_double_(is_double) { } 639 : LBinaryOperation<1>(left, right), op_(op), is_double_(is_double) { }
619 640
620 Token::Value op() const { return op_; } 641 Token::Value op() const { return op_; }
621 bool is_double() const { return is_double_; } 642 bool is_double() const { return is_double_; }
622 643
623 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id") 644 DECLARE_CONCRETE_INSTRUCTION(CmpID, "cmp-id")
624 645
625 private: 646 private:
626 Token::Value op_; 647 Token::Value op_;
627 bool is_double_; 648 bool is_double_;
628 }; 649 };
(...skipping 30 matching lines...) Expand all
659 : LUnaryOperation<1>(value) { } 680 : LUnaryOperation<1>(value) { }
660 681
661 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation") 682 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary-math-operation")
662 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation) 683 DECLARE_HYDROGEN_ACCESSOR(UnaryMathOperation)
663 684
664 virtual void PrintDataTo(StringStream* stream); 685 virtual void PrintDataTo(StringStream* stream);
665 BuiltinFunctionId op() const { return hydrogen()->op(); } 686 BuiltinFunctionId op() const { return hydrogen()->op(); }
666 }; 687 };
667 688
668 689
669 class LCmpJSObjectEq: public LBinaryOperation { 690 class LCmpJSObjectEq: public LBinaryOperation<1> {
670 public: 691 public:
671 LCmpJSObjectEq(LOperand* left, LOperand* right) 692 LCmpJSObjectEq(LOperand* left, LOperand* right)
672 : LBinaryOperation(left, right) {} 693 : LBinaryOperation<1>(left, right) {}
673 694
674 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq") 695 DECLARE_CONCRETE_INSTRUCTION(CmpJSObjectEq, "cmp-jsobject-eq")
675 }; 696 };
676 697
677 698
678 class LCmpJSObjectEqAndBranch: public LCmpJSObjectEq { 699 class LCmpJSObjectEqAndBranch: public LCmpJSObjectEq {
679 public: 700 public:
680 LCmpJSObjectEqAndBranch(LOperand* left, 701 LCmpJSObjectEqAndBranch(LOperand* left,
681 LOperand* right, 702 LOperand* right,
682 int true_block_id, 703 int true_block_id,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 int false_block_id() const { return false_block_id_; } 944 int false_block_id() const { return false_block_id_; }
924 LOperand* temporary2() { return temporary2_; } 945 LOperand* temporary2() { return temporary2_; }
925 946
926 private: 947 private:
927 LOperand* temporary2_; 948 LOperand* temporary2_;
928 int true_block_id_; 949 int true_block_id_;
929 int false_block_id_; 950 int false_block_id_;
930 }; 951 };
931 952
932 953
933 class LCmpT: public LBinaryOperation { 954 class LCmpT: public LBinaryOperation<1> {
934 public: 955 public:
935 LCmpT(LOperand* left, LOperand* right) : LBinaryOperation(left, right) {} 956 LCmpT(LOperand* left, LOperand* right) : LBinaryOperation<1>(left, right) {}
936 957
937 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") 958 DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t")
938 DECLARE_HYDROGEN_ACCESSOR(Compare) 959 DECLARE_HYDROGEN_ACCESSOR(Compare)
939 960
940 Token::Value op() const { return hydrogen()->token(); } 961 Token::Value op() const { return hydrogen()->token(); }
941 }; 962 };
942 963
943 964
944 class LCmpTAndBranch: public LCmpT { 965 class LCmpTAndBranch: public LCmpT {
945 public: 966 public:
946 LCmpTAndBranch(LOperand* left, 967 LCmpTAndBranch(LOperand* left,
947 LOperand* right, 968 LOperand* right,
948 int true_block_id, 969 int true_block_id,
949 int false_block_id) 970 int false_block_id)
950 : LCmpT(left, right), 971 : LCmpT(left, right),
951 true_block_id_(true_block_id), 972 true_block_id_(true_block_id),
952 false_block_id_(false_block_id) { } 973 false_block_id_(false_block_id) { }
953 974
954 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch") 975 DECLARE_CONCRETE_INSTRUCTION(CmpTAndBranch, "cmp-t-and-branch")
955 976
956 int true_block_id() const { return true_block_id_; } 977 int true_block_id() const { return true_block_id_; }
957 int false_block_id() const { return false_block_id_; } 978 int false_block_id() const { return false_block_id_; }
958 979
959 private: 980 private:
960 int true_block_id_; 981 int true_block_id_;
961 int false_block_id_; 982 int false_block_id_;
962 }; 983 };
963 984
964 985
965 class LInstanceOf: public LBinaryOperation { 986 class LInstanceOf: public LBinaryOperation<1> {
966 public: 987 public:
967 LInstanceOf(LOperand* left, LOperand* right) 988 LInstanceOf(LOperand* left, LOperand* right)
968 : LBinaryOperation(left, right) { } 989 : LBinaryOperation<1>(left, right) { }
969 990
970 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of") 991 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance-of")
971 }; 992 };
972 993
973 994
974 class LInstanceOfAndBranch: public LInstanceOf { 995 class LInstanceOfAndBranch: public LInstanceOf {
975 public: 996 public:
976 LInstanceOfAndBranch(LOperand* left, 997 LInstanceOfAndBranch(LOperand* left,
977 LOperand* right, 998 LOperand* right,
978 int true_block_id, 999 int true_block_id,
(...skipping 23 matching lines...) Expand all
1002 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal) 1023 DECLARE_HYDROGEN_ACCESSOR(InstanceOfKnownGlobal)
1003 1024
1004 Handle<JSFunction> function() const { return hydrogen()->function(); } 1025 Handle<JSFunction> function() const { return hydrogen()->function(); }
1005 LOperand* temp() const { return temp_; } 1026 LOperand* temp() const { return temp_; }
1006 1027
1007 private: 1028 private:
1008 LOperand* temp_; 1029 LOperand* temp_;
1009 }; 1030 };
1010 1031
1011 1032
1012 class LBoundsCheck: public LBinaryOperation { 1033 class LBoundsCheck: public LBinaryOperation<0> {
1013 public: 1034 public:
1014 LBoundsCheck(LOperand* index, LOperand* length) 1035 LBoundsCheck(LOperand* index, LOperand* length)
1015 : LBinaryOperation(index, length) { } 1036 : LBinaryOperation<0>(index, length) { }
1016 1037
1017 LOperand* index() const { return left(); } 1038 LOperand* index() const { return left(); }
1018 LOperand* length() const { return right(); } 1039 LOperand* length() const { return right(); }
1019 1040
1020 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check") 1041 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds-check")
1021 }; 1042 };
1022 1043
1023 1044
1024 class LBitI: public LBinaryOperation { 1045 class LBitI: public LBinaryOperation<1> {
1025 public: 1046 public:
1026 LBitI(Token::Value op, LOperand* left, LOperand* right) 1047 LBitI(Token::Value op, LOperand* left, LOperand* right)
1027 : LBinaryOperation(left, right), op_(op) { } 1048 : LBinaryOperation<1>(left, right), op_(op) { }
1028 1049
1029 Token::Value op() const { return op_; } 1050 Token::Value op() const { return op_; }
1030 1051
1031 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i") 1052 DECLARE_CONCRETE_INSTRUCTION(BitI, "bit-i")
1032 1053
1033 private: 1054 private:
1034 Token::Value op_; 1055 Token::Value op_;
1035 }; 1056 };
1036 1057
1037 1058
1038 class LShiftI: public LBinaryOperation { 1059 class LShiftI: public LBinaryOperation<1> {
1039 public: 1060 public:
1040 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt) 1061 LShiftI(Token::Value op, LOperand* left, LOperand* right, bool can_deopt)
1041 : LBinaryOperation(left, right), op_(op), can_deopt_(can_deopt) { } 1062 : LBinaryOperation<1>(left, right), op_(op), can_deopt_(can_deopt) { }
1042 1063
1043 Token::Value op() const { return op_; } 1064 Token::Value op() const { return op_; }
1044 1065
1045 bool can_deopt() const { return can_deopt_; } 1066 bool can_deopt() const { return can_deopt_; }
1046 1067
1047 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i") 1068 DECLARE_CONCRETE_INSTRUCTION(ShiftI, "shift-i")
1048 1069
1049 private: 1070 private:
1050 Token::Value op_; 1071 Token::Value op_;
1051 bool can_deopt_; 1072 bool can_deopt_;
1052 }; 1073 };
1053 1074
1054 1075
1055 class LSubI: public LBinaryOperation { 1076 class LSubI: public LBinaryOperation<1> {
1056 public: 1077 public:
1057 LSubI(LOperand* left, LOperand* right) 1078 LSubI(LOperand* left, LOperand* right)
1058 : LBinaryOperation(left, right) { } 1079 : LBinaryOperation<1>(left, right) { }
1059 1080
1060 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") 1081 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
1061 DECLARE_HYDROGEN_ACCESSOR(Sub) 1082 DECLARE_HYDROGEN_ACCESSOR(Sub)
1062 }; 1083 };
1063 1084
1064 1085
1065 class LConstant: public LTemplateInstruction<1> { 1086 class LConstant: public LTemplateInstruction<1, 0, 0> {
1066 DECLARE_INSTRUCTION(Constant) 1087 DECLARE_INSTRUCTION(Constant)
1067 }; 1088 };
1068 1089
1069 1090
1070 class LConstantI: public LConstant { 1091 class LConstantI: public LConstant {
1071 public: 1092 public:
1072 explicit LConstantI(int32_t value) : value_(value) { } 1093 explicit LConstantI(int32_t value) : value_(value) { }
1073 int32_t value() const { return value_; } 1094 int32_t value() const { return value_; }
1074 1095
1075 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") 1096 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 class LThrow: public LUnaryOperation<1> { 1201 class LThrow: public LUnaryOperation<1> {
1181 public: 1202 public:
1182 explicit LThrow(LOperand* value) : LUnaryOperation<1>(value) { } 1203 explicit LThrow(LOperand* value) : LUnaryOperation<1>(value) { }
1183 1204
1184 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 1205 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
1185 }; 1206 };
1186 1207
1187 1208
1188 class LBitNotI: public LUnaryOperation<1> { 1209 class LBitNotI: public LUnaryOperation<1> {
1189 public: 1210 public:
1190 explicit LBitNotI(LOperand* use) : LUnaryOperation<1>(use) { } 1211 explicit LBitNotI(LOperand* input) : LUnaryOperation<1>(input) { }
1191 1212
1192 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i") 1213 DECLARE_CONCRETE_INSTRUCTION(BitNotI, "bit-not-i")
1193 }; 1214 };
1194 1215
1195 1216
1196 class LAddI: public LBinaryOperation { 1217 class LAddI: public LBinaryOperation<1> {
1197 public: 1218 public:
1198 LAddI(LOperand* left, LOperand* right) 1219 LAddI(LOperand* left, LOperand* right)
1199 : LBinaryOperation(left, right) { } 1220 : LBinaryOperation<1>(left, right) { }
1200 1221
1201 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i") 1222 DECLARE_CONCRETE_INSTRUCTION(AddI, "add-i")
1202 DECLARE_HYDROGEN_ACCESSOR(Add) 1223 DECLARE_HYDROGEN_ACCESSOR(Add)
1203 }; 1224 };
1204 1225
1205 1226
1206 class LPower: public LBinaryOperation { 1227 class LPower: public LBinaryOperation<1> {
1207 public: 1228 public:
1208 LPower(LOperand* left, LOperand* right) 1229 LPower(LOperand* left, LOperand* right)
1209 : LBinaryOperation(left, right) { } 1230 : LBinaryOperation<1>(left, right) { }
1210 1231
1211 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 1232 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
1212 DECLARE_HYDROGEN_ACCESSOR(Power) 1233 DECLARE_HYDROGEN_ACCESSOR(Power)
1213 }; 1234 };
1214 1235
1215 1236
1216 class LArithmeticD: public LBinaryOperation { 1237 class LArithmeticD: public LBinaryOperation<1> {
1217 public: 1238 public:
1218 LArithmeticD(Token::Value op, LOperand* left, LOperand* right) 1239 LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
1219 : LBinaryOperation(left, right), op_(op) { } 1240 : LBinaryOperation<1>(left, right), op_(op) { }
1220 1241
1221 Token::Value op() const { return op_; } 1242 Token::Value op() const { return op_; }
1222 1243
1223 virtual void CompileToNative(LCodeGen* generator); 1244 virtual void CompileToNative(LCodeGen* generator);
1224 virtual const char* Mnemonic() const; 1245 virtual const char* Mnemonic() const;
1225 1246
1226 private: 1247 private:
1227 Token::Value op_; 1248 Token::Value op_;
1228 }; 1249 };
1229 1250
1230 1251
1231 class LArithmeticT: public LBinaryOperation { 1252 class LArithmeticT: public LBinaryOperation<1> {
1232 public: 1253 public:
1233 LArithmeticT(Token::Value op, LOperand* left, LOperand* right) 1254 LArithmeticT(Token::Value op, LOperand* left, LOperand* right)
1234 : LBinaryOperation(left, right), op_(op) { } 1255 : LBinaryOperation<1>(left, right), op_(op) { }
1235 1256
1236 virtual void CompileToNative(LCodeGen* generator); 1257 virtual void CompileToNative(LCodeGen* generator);
1237 virtual const char* Mnemonic() const; 1258 virtual const char* Mnemonic() const;
1238 1259
1239 Token::Value op() const { return op_; } 1260 Token::Value op() const { return op_; }
1240 1261
1241 private: 1262 private:
1242 Token::Value op_; 1263 Token::Value op_;
1243 }; 1264 };
1244 1265
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 1310
1290 1311
1291 class LLoadElements: public LUnaryOperation<1> { 1312 class LLoadElements: public LUnaryOperation<1> {
1292 public: 1313 public:
1293 explicit LLoadElements(LOperand* obj) : LUnaryOperation<1>(obj) { } 1314 explicit LLoadElements(LOperand* obj) : LUnaryOperation<1>(obj) { }
1294 1315
1295 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1316 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1296 }; 1317 };
1297 1318
1298 1319
1299 class LLoadKeyedFastElement: public LBinaryOperation { 1320 class LLoadKeyedFastElement: public LBinaryOperation<1> {
1300 public: 1321 public:
1301 LLoadKeyedFastElement(LOperand* elements, LOperand* key) 1322 LLoadKeyedFastElement(LOperand* elements, LOperand* key)
1302 : LBinaryOperation(elements, key) { } 1323 : LBinaryOperation<1>(elements, key) { }
1303 1324
1304 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element") 1325 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, "load-keyed-fast-element")
1305 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement) 1326 DECLARE_HYDROGEN_ACCESSOR(LoadKeyedFastElement)
1306 1327
1307 LOperand* elements() const { return left(); } 1328 LOperand* elements() const { return left(); }
1308 LOperand* key() const { return right(); } 1329 LOperand* key() const { return right(); }
1309 }; 1330 };
1310 1331
1311 1332
1312 class LLoadKeyedGeneric: public LBinaryOperation { 1333 class LLoadKeyedGeneric: public LBinaryOperation<1> {
1313 public: 1334 public:
1314 LLoadKeyedGeneric(LOperand* obj, LOperand* key) 1335 LLoadKeyedGeneric(LOperand* obj, LOperand* key)
1315 : LBinaryOperation(obj, key) { } 1336 : LBinaryOperation<1>(obj, key) { }
1316 1337
1317 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic") 1338 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load-keyed-generic")
1318 1339
1319 LOperand* object() const { return left(); } 1340 LOperand* object() const { return left(); }
1320 LOperand* key() const { return right(); } 1341 LOperand* key() const { return right(); }
1321 }; 1342 };
1322 1343
1323 1344
1324 class LLoadGlobal: public LTemplateInstruction<1> { 1345 class LLoadGlobal: public LTemplateInstruction<1, 0, 0> {
1325 public: 1346 public:
1326 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global") 1347 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load-global")
1327 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal) 1348 DECLARE_HYDROGEN_ACCESSOR(LoadGlobal)
1328 }; 1349 };
1329 1350
1330 1351
1331 class LStoreGlobal: public LUnaryOperation<0> { 1352 class LStoreGlobal: public LUnaryOperation<0> {
1332 public: 1353 public:
1333 explicit LStoreGlobal(LOperand* value) : LUnaryOperation<0>(value) {} 1354 explicit LStoreGlobal(LOperand* value) : LUnaryOperation<0>(value) {}
1334 1355
1335 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") 1356 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
1336 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) 1357 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
1337 }; 1358 };
1338 1359
1339 1360
1340 class LPushArgument: public LUnaryOperation<0> { 1361 class LPushArgument: public LUnaryOperation<0> {
1341 public: 1362 public:
1342 explicit LPushArgument(LOperand* argument) : LUnaryOperation<0>(argument) {} 1363 explicit LPushArgument(LOperand* argument) : LUnaryOperation<0>(argument) {}
1343 1364
1344 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") 1365 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1345 }; 1366 };
1346 1367
1347 1368
1348 class LGlobalObject: public LTemplateInstruction<1> { 1369 class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
1349 public: 1370 public:
1350 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") 1371 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1351 }; 1372 };
1352 1373
1353 1374
1354 class LGlobalReceiver: public LTemplateInstruction<1> { 1375 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> {
1355 public: 1376 public:
1356 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1377 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1357 }; 1378 };
1358 1379
1359 1380
1360 class LCallConstantFunction: public LTemplateInstruction<1> { 1381 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1361 public: 1382 public:
1362 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1383 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1363 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1384 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1364 1385
1365 virtual void PrintDataTo(StringStream* stream); 1386 virtual void PrintDataTo(StringStream* stream);
1366 1387
1367 Handle<JSFunction> function() const { return hydrogen()->function(); } 1388 Handle<JSFunction> function() { return hydrogen()->function(); }
1368 int arity() const { return hydrogen()->argument_count() - 1; } 1389 int arity() const { return hydrogen()->argument_count() - 1; }
1369 }; 1390 };
1370 1391
1371 1392
1372 class LCallKeyed: public LTemplateInstruction<1> { 1393 class LCallKeyed: public LTemplateInstruction<1, 0, 0> {
1373 public: 1394 public:
1374 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed") 1395 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call-keyed")
1375 DECLARE_HYDROGEN_ACCESSOR(CallKeyed) 1396 DECLARE_HYDROGEN_ACCESSOR(CallKeyed)
1376 1397
1377 virtual void PrintDataTo(StringStream* stream); 1398 virtual void PrintDataTo(StringStream* stream);
1378 1399
1379 int arity() const { return hydrogen()->argument_count() - 1; } 1400 int arity() const { return hydrogen()->argument_count() - 1; }
1380 }; 1401 };
1381 1402
1382 1403
1383 class LCallNamed: public LTemplateInstruction<1> { 1404 class LCallNamed: public LTemplateInstruction<1, 0, 0> {
1384 public: 1405 public:
1385 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named") 1406 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call-named")
1386 DECLARE_HYDROGEN_ACCESSOR(CallNamed) 1407 DECLARE_HYDROGEN_ACCESSOR(CallNamed)
1387 1408
1388 virtual void PrintDataTo(StringStream* stream); 1409 virtual void PrintDataTo(StringStream* stream);
1389 1410
1390 Handle<String> name() const { return hydrogen()->name(); } 1411 Handle<String> name() const { return hydrogen()->name(); }
1391 int arity() const { return hydrogen()->argument_count() - 1; } 1412 int arity() const { return hydrogen()->argument_count() - 1; }
1392 }; 1413 };
1393 1414
1394 1415
1395 class LCallFunction: public LTemplateInstruction<1> { 1416 class LCallFunction: public LTemplateInstruction<1, 0, 0> {
1396 public: 1417 public:
1397 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function") 1418 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call-function")
1398 DECLARE_HYDROGEN_ACCESSOR(CallFunction) 1419 DECLARE_HYDROGEN_ACCESSOR(CallFunction)
1399 1420
1400 int arity() const { return hydrogen()->argument_count() - 2; } 1421 int arity() const { return hydrogen()->argument_count() - 2; }
1401 }; 1422 };
1402 1423
1403 1424
1404 class LCallGlobal: public LTemplateInstruction<1> { 1425 class LCallGlobal: public LTemplateInstruction<1, 0, 0> {
1405 public: 1426 public:
1406 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global") 1427 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call-global")
1407 DECLARE_HYDROGEN_ACCESSOR(CallGlobal) 1428 DECLARE_HYDROGEN_ACCESSOR(CallGlobal)
1408 1429
1409 virtual void PrintDataTo(StringStream* stream); 1430 virtual void PrintDataTo(StringStream* stream);
1410 1431
1411 Handle<String> name() const {return hydrogen()->name(); } 1432 Handle<String> name() const {return hydrogen()->name(); }
1412 int arity() const { return hydrogen()->argument_count() - 1; } 1433 int arity() const { return hydrogen()->argument_count() - 1; }
1413 }; 1434 };
1414 1435
1415 1436
1416 class LCallKnownGlobal: public LTemplateInstruction<1> { 1437 class LCallKnownGlobal: public LTemplateInstruction<1, 0, 0> {
1417 public: 1438 public:
1418 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global") 1439 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call-known-global")
1419 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal) 1440 DECLARE_HYDROGEN_ACCESSOR(CallKnownGlobal)
1420 1441
1421 virtual void PrintDataTo(StringStream* stream); 1442 virtual void PrintDataTo(StringStream* stream);
1422 1443
1423 Handle<JSFunction> target() const { return hydrogen()->target(); } 1444 Handle<JSFunction> target() const { return hydrogen()->target(); }
1424 int arity() const { return hydrogen()->argument_count() - 1; } 1445 int arity() const { return hydrogen()->argument_count() - 1; }
1425 }; 1446 };
1426 1447
1427 1448
1428 class LCallNew: public LUnaryOperation<1> { 1449 class LCallNew: public LUnaryOperation<1> {
1429 public: 1450 public:
1430 explicit LCallNew(LOperand* constructor) : LUnaryOperation<1>(constructor) { } 1451 explicit LCallNew(LOperand* constructor) : LUnaryOperation<1>(constructor) { }
1431 1452
1432 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new") 1453 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call-new")
1433 DECLARE_HYDROGEN_ACCESSOR(CallNew) 1454 DECLARE_HYDROGEN_ACCESSOR(CallNew)
1434 1455
1435 virtual void PrintDataTo(StringStream* stream); 1456 virtual void PrintDataTo(StringStream* stream);
1436 1457
1437 int arity() const { return hydrogen()->argument_count() - 1; } 1458 int arity() const { return hydrogen()->argument_count() - 1; }
1438 }; 1459 };
1439 1460
1440 1461
1441 class LCallRuntime: public LTemplateInstruction<1> { 1462 class LCallRuntime: public LTemplateInstruction<1, 0, 0> {
1442 public: 1463 public:
1443 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime") 1464 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call-runtime")
1444 DECLARE_HYDROGEN_ACCESSOR(CallRuntime) 1465 DECLARE_HYDROGEN_ACCESSOR(CallRuntime)
1445 1466
1446 Runtime::Function* function() const { return hydrogen()->function(); } 1467 Runtime::Function* function() const { return hydrogen()->function(); }
1447 int arity() const { return hydrogen()->argument_count(); } 1468 int arity() const { return hydrogen()->argument_count(); }
1448 }; 1469 };
1449 1470
1450 1471
1451 class LInteger32ToDouble: public LUnaryOperation<1> { 1472 class LInteger32ToDouble: public LUnaryOperation<1> {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 1556
1536 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag") 1557 DECLARE_CONCRETE_INSTRUCTION(SmiUntag, "smi-untag")
1537 1558
1538 bool needs_check() const { return needs_check_; } 1559 bool needs_check() const { return needs_check_; }
1539 1560
1540 private: 1561 private:
1541 bool needs_check_; 1562 bool needs_check_;
1542 }; 1563 };
1543 1564
1544 1565
1545 class LStoreNamed: public LTemplateInstruction<0> { 1566 class LStoreNamed: public LTemplateInstruction<0, 2, 0> {
1546 public: 1567 public:
1547 LStoreNamed(LOperand* obj, LOperand* val) : object_(obj), value_(val) { } 1568 LStoreNamed(LOperand* obj, LOperand* val) {
1569 this->SetInputAt(0, obj);
1570 this->SetInputAt(1, val);
1571 }
1548 1572
1549 DECLARE_INSTRUCTION(StoreNamed) 1573 DECLARE_INSTRUCTION(StoreNamed)
1550 DECLARE_HYDROGEN_ACCESSOR(StoreNamed) 1574 DECLARE_HYDROGEN_ACCESSOR(StoreNamed)
1551 1575
1552 virtual void PrintDataTo(StringStream* stream); 1576 virtual void PrintDataTo(StringStream* stream);
1553 1577
1554 LOperand* object() const { return object_; } 1578 LOperand* object() const { return this->InputAt(0); }
1579 LOperand* value() const { return this->InputAt(1); }
1555 Handle<Object> name() const { return hydrogen()->name(); } 1580 Handle<Object> name() const { return hydrogen()->name(); }
1556 LOperand* value() const { return value_; }
1557
1558 private:
1559 LOperand* object_;
1560 LOperand* value_;
1561 }; 1581 };
1562 1582
1563 1583
1564 class LStoreNamedField: public LStoreNamed { 1584 class LStoreNamedField: public LStoreNamed {
1565 public: 1585 public:
1566 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp) 1586 LStoreNamedField(LOperand* obj, LOperand* val, LOperand* temp)
1567 : LStoreNamed(obj, val), temp_(temp) { } 1587 : LStoreNamed(obj, val), temp_(temp) { }
1568 1588
1569 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field") 1589 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store-named-field")
1570 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField) 1590 DECLARE_HYDROGEN_ACCESSOR(StoreNamedField)
1571 1591
1572 bool is_in_object() { return hydrogen()->is_in_object(); } 1592 bool is_in_object() { return hydrogen()->is_in_object(); }
1573 int offset() { return hydrogen()->offset(); } 1593 int offset() { return hydrogen()->offset(); }
1574 LOperand* temp() { return temp_; }
1575 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } 1594 bool needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
1576 Handle<Map> transition() const { return hydrogen()->transition(); } 1595 Handle<Map> transition() const { return hydrogen()->transition(); }
1577 1596
1597 LOperand* temp() { return temp_; }
1598
1578 private: 1599 private:
1579 LOperand* temp_; 1600 LOperand* temp_;
1580 }; 1601 };
1581 1602
1582 1603
1583 class LStoreNamedGeneric: public LStoreNamed { 1604 class LStoreNamedGeneric: public LStoreNamed {
1584 public: 1605 public:
1585 LStoreNamedGeneric(LOperand* obj, LOperand* val) 1606 LStoreNamedGeneric(LOperand* obj, LOperand* val)
1586 : LStoreNamed(obj, val) { } 1607 : LStoreNamed(obj, val) { }
1587 1608
1588 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic") 1609 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store-named-generic")
1589 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric) 1610 DECLARE_HYDROGEN_ACCESSOR(StoreNamedGeneric)
1590 }; 1611 };
1591 1612
1592 1613
1593 class LStoreKeyed: public LTemplateInstruction<0> { 1614 class LStoreKeyed: public LTemplateInstruction<0, 3, 0> {
1594 public: 1615 public:
1595 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) 1616 LStoreKeyed(LOperand* obj, LOperand* key, LOperand* val) {
1596 : object_(obj), key_(key), value_(val) { } 1617 this->SetInputAt(0, obj);
1618 this->SetInputAt(1, key);
1619 this->SetInputAt(2, val);
1620 }
1597 1621
1598 DECLARE_INSTRUCTION(StoreKeyed) 1622 DECLARE_INSTRUCTION(StoreKeyed)
1599 1623
1600 virtual void PrintDataTo(StringStream* stream); 1624 virtual void PrintDataTo(StringStream* stream);
1601 1625
1602 LOperand* object() const { return object_; } 1626 LOperand* object() const { return this->InputAt(0); }
1603 LOperand* key() const { return key_; } 1627 LOperand* key() const { return this->InputAt(1); }
1604 LOperand* value() const { return value_; } 1628 LOperand* value() const { return this->InputAt(2); }
1605
1606 private:
1607 LOperand* object_;
1608 LOperand* key_;
1609 LOperand* value_;
1610 }; 1629 };
1611 1630
1612 1631
1613 class LStoreKeyedFastElement: public LStoreKeyed { 1632 class LStoreKeyedFastElement: public LStoreKeyed {
1614 public: 1633 public:
1615 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val) 1634 LStoreKeyedFastElement(LOperand* obj, LOperand* key, LOperand* val)
1616 : LStoreKeyed(obj, key, val) {} 1635 : LStoreKeyed(obj, key, val) {}
1617 1636
1618 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 1637 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
1619 "store-keyed-fast-element") 1638 "store-keyed-fast-element")
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 1675
1657 class LCheckMap: public LUnaryOperation<0> { 1676 class LCheckMap: public LUnaryOperation<0> {
1658 public: 1677 public:
1659 explicit LCheckMap(LOperand* use) : LUnaryOperation<0>(use) { } 1678 explicit LCheckMap(LOperand* use) : LUnaryOperation<0>(use) { }
1660 1679
1661 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map") 1680 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check-map")
1662 DECLARE_HYDROGEN_ACCESSOR(CheckMap) 1681 DECLARE_HYDROGEN_ACCESSOR(CheckMap)
1663 }; 1682 };
1664 1683
1665 1684
1666 class LCheckPrototypeMaps: public LTemplateInstruction<0> { 1685 class LCheckPrototypeMaps: public LTemplateInstruction<0, 0, 0> {
1667 public: 1686 public:
1668 explicit LCheckPrototypeMaps(LOperand* temp) : temp_(temp) { } 1687 explicit LCheckPrototypeMaps(LOperand* temp) : temp_(temp) { }
1669 1688
1670 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps") 1689 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check-prototype-maps")
1671 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps) 1690 DECLARE_HYDROGEN_ACCESSOR(CheckPrototypeMaps)
1672 1691
1673 Handle<JSObject> holder() const { return hydrogen()->holder(); } 1692 Handle<JSObject> holder() const { return hydrogen()->holder(); }
1674 Handle<Map> receiver_map() const { return hydrogen()->receiver_map(); } 1693 Handle<Map> receiver_map() const { return hydrogen()->receiver_map(); }
1694
1675 LOperand* temp() const { return temp_; } 1695 LOperand* temp() const { return temp_; }
1676 1696
1677 private: 1697 private:
1678 LOperand* temp_; 1698 LOperand* temp_;
1679 }; 1699 };
1680 1700
1681 1701
1682 class LCheckSmi: public LUnaryOperation<0> { 1702 class LCheckSmi: public LUnaryOperation<0> {
1683 public: 1703 public:
1684 LCheckSmi(LOperand* use, Condition condition) 1704 LCheckSmi(LOperand* use, Condition condition)
1685 : LUnaryOperation<0>(use), condition_(condition) { } 1705 : LUnaryOperation<0>(use), condition_(condition) { }
1686 1706
1687 Condition condition() const { return condition_; } 1707 Condition condition() const { return condition_; }
1688 1708
1689 virtual void CompileToNative(LCodeGen* generator); 1709 virtual void CompileToNative(LCodeGen* generator);
1690 virtual const char* Mnemonic() const { 1710 virtual const char* Mnemonic() const {
1691 return (condition_ == zero) ? "check-non-smi" : "check-smi"; 1711 return (condition_ == zero) ? "check-non-smi" : "check-smi";
1692 } 1712 }
1693 1713
1694 private: 1714 private:
1695 Condition condition_; 1715 Condition condition_;
1696 }; 1716 };
1697 1717
1698 1718
1699 class LMaterializedLiteral: public LTemplateInstruction<1> { 1719 class LMaterializedLiteral: public LTemplateInstruction<1, 0, 0> {
1700 public: 1720 public:
1701 DECLARE_INSTRUCTION(MaterializedLiteral) 1721 DECLARE_INSTRUCTION(MaterializedLiteral)
1702 }; 1722 };
1703 1723
1704 1724
1705 class LArrayLiteral: public LMaterializedLiteral { 1725 class LArrayLiteral: public LMaterializedLiteral {
1706 public: 1726 public:
1707 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal") 1727 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array-literal")
1708 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral) 1728 DECLARE_HYDROGEN_ACCESSOR(ArrayLiteral)
1709 }; 1729 };
1710 1730
1711 1731
1712 class LObjectLiteral: public LMaterializedLiteral { 1732 class LObjectLiteral: public LMaterializedLiteral {
1713 public: 1733 public:
1714 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal") 1734 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object-literal")
1715 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral) 1735 DECLARE_HYDROGEN_ACCESSOR(ObjectLiteral)
1716 }; 1736 };
1717 1737
1718 1738
1719 class LRegExpLiteral: public LMaterializedLiteral { 1739 class LRegExpLiteral: public LMaterializedLiteral {
1720 public: 1740 public:
1721 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal") 1741 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp-literal")
1722 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral) 1742 DECLARE_HYDROGEN_ACCESSOR(RegExpLiteral)
1723 }; 1743 };
1724 1744
1725 1745
1726 class LFunctionLiteral: public LTemplateInstruction<1> { 1746 class LFunctionLiteral: public LTemplateInstruction<1, 0, 0> {
1727 public: 1747 public:
1728 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal") 1748 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function-literal")
1729 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral) 1749 DECLARE_HYDROGEN_ACCESSOR(FunctionLiteral)
1730 1750
1731 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); } 1751 Handle<SharedFunctionInfo> shared_info() { return hydrogen()->shared_info(); }
1732 }; 1752 };
1733 1753
1734 1754
1735 class LTypeof: public LUnaryOperation<1> { 1755 class LTypeof: public LUnaryOperation<1> {
1736 public: 1756 public:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 1788
1769 int true_block_id() const { return true_block_id_; } 1789 int true_block_id() const { return true_block_id_; }
1770 int false_block_id() const { return false_block_id_; } 1790 int false_block_id() const { return false_block_id_; }
1771 1791
1772 private: 1792 private:
1773 int true_block_id_; 1793 int true_block_id_;
1774 int false_block_id_; 1794 int false_block_id_;
1775 }; 1795 };
1776 1796
1777 1797
1778 class LDeleteProperty: public LBinaryOperation { 1798 class LDeleteProperty: public LBinaryOperation<1> {
1779 public: 1799 public:
1780 LDeleteProperty(LOperand* obj, LOperand* key) : LBinaryOperation(obj, key) {} 1800 LDeleteProperty(LOperand* obj, LOperand* key)
1801 : LBinaryOperation<1>(obj, key) { }
1781 1802
1782 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property") 1803 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete-property")
1783 1804
1784 LOperand* object() const { return left(); } 1805 LOperand* object() const { return left(); }
1785 LOperand* key() const { return right(); } 1806 LOperand* key() const { return right(); }
1786 }; 1807 };
1787 1808
1788 1809
1789 class LOsrEntry: public LTemplateInstruction<0> { 1810 class LOsrEntry: public LTemplateInstruction<0, 0, 0> {
1790 public: 1811 public:
1791 LOsrEntry(); 1812 LOsrEntry();
1792 1813
1793 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry") 1814 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr-entry")
1794 1815
1795 LOperand** SpilledRegisterArray() { return register_spills_; } 1816 LOperand** SpilledRegisterArray() { return register_spills_; }
1796 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; } 1817 LOperand** SpilledDoubleRegisterArray() { return double_register_spills_; }
1797 1818
1798 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand); 1819 void MarkSpilledRegister(int allocation_index, LOperand* spill_operand);
1799 void MarkSpilledDoubleRegister(int allocation_index, 1820 void MarkSpilledDoubleRegister(int allocation_index,
1800 LOperand* spill_operand); 1821 LOperand* spill_operand);
1801 1822
1802 private: 1823 private:
1803 // Arrays of spill slot operands for registers with an assigned spill 1824 // Arrays of spill slot operands for registers with an assigned spill
1804 // slot, i.e., that must also be restored to the spill slot on OSR entry. 1825 // slot, i.e., that must also be restored to the spill slot on OSR entry.
1805 // NULL if the register has no assigned spill slot. Indexed by allocation 1826 // NULL if the register has no assigned spill slot. Indexed by allocation
1806 // index. 1827 // index.
1807 LOperand* register_spills_[Register::kNumAllocatableRegisters]; 1828 LOperand* register_spills_[Register::kNumAllocatableRegisters];
1808 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters]; 1829 LOperand* double_register_spills_[DoubleRegister::kNumAllocatableRegisters];
1809 }; 1830 };
1810 1831
1811 1832
1812 class LStackCheck: public LTemplateInstruction<0> { 1833 class LStackCheck: public LTemplateInstruction<0, 0, 0> {
1813 public: 1834 public:
1814 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check") 1835 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack-check")
1815 }; 1836 };
1816 1837
1817 1838
1818 class LPointerMap: public ZoneObject { 1839 class LPointerMap: public ZoneObject {
1819 public: 1840 public:
1820 explicit LPointerMap(int position) 1841 explicit LPointerMap(int position)
1821 : pointer_operands_(8), position_(position), lithium_position_(-1) { } 1842 : pointer_operands_(8), position_(position), lithium_position_(-1) { }
1822 1843
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 } 1986 }
1966 1987
1967 const ZoneList<Handle<JSFunction> >* inlined_closures() const { 1988 const ZoneList<Handle<JSFunction> >* inlined_closures() const {
1968 return &inlined_closures_; 1989 return &inlined_closures_;
1969 } 1990 }
1970 1991
1971 void AddInlinedClosure(Handle<JSFunction> closure) { 1992 void AddInlinedClosure(Handle<JSFunction> closure) {
1972 inlined_closures_.Add(closure); 1993 inlined_closures_.Add(closure);
1973 } 1994 }
1974 1995
1975 void Verify() const;
1976
1977 private: 1996 private:
1978 int spill_slot_count_; 1997 int spill_slot_count_;
1979 HGraph* const graph_; 1998 HGraph* const graph_;
1980 ZoneList<LInstruction*> instructions_; 1999 ZoneList<LInstruction*> instructions_;
1981 ZoneList<LPointerMap*> pointer_maps_; 2000 ZoneList<LPointerMap*> pointer_maps_;
1982 ZoneList<Handle<JSFunction> > inlined_closures_; 2001 ZoneList<Handle<JSFunction> > inlined_closures_;
1983 }; 2002 };
1984 2003
1985 2004
1986 class LChunkBuilder BASE_EMBEDDED { 2005 class LChunkBuilder BASE_EMBEDDED {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 LOperand* UseTempRegister(HValue* value); 2068 LOperand* UseTempRegister(HValue* value);
2050 LOperand* Use(HValue* value); 2069 LOperand* Use(HValue* value);
2051 LOperand* UseAtStart(HValue* value); 2070 LOperand* UseAtStart(HValue* value);
2052 LOperand* UseOrConstant(HValue* value); 2071 LOperand* UseOrConstant(HValue* value);
2053 LOperand* UseOrConstantAtStart(HValue* value); 2072 LOperand* UseOrConstantAtStart(HValue* value);
2054 LOperand* UseRegisterOrConstant(HValue* value); 2073 LOperand* UseRegisterOrConstant(HValue* value);
2055 LOperand* UseRegisterOrConstantAtStart(HValue* value); 2074 LOperand* UseRegisterOrConstantAtStart(HValue* value);
2056 2075
2057 // Methods for setting up define-use relationships. 2076 // Methods for setting up define-use relationships.
2058 // Return the same instruction that they are passed. 2077 // Return the same instruction that they are passed.
2059 LInstruction* Define(LTemplateInstruction<1>* instr, LUnallocated* result); 2078 template<int I, int T>
2060 LInstruction* Define(LTemplateInstruction<1>* instr); 2079 LInstruction* Define(LTemplateInstruction<1, I, T>* instr,
2061 LInstruction* DefineAsRegister(LTemplateInstruction<1>* instr); 2080 LUnallocated* result);
2062 LInstruction* DefineAsSpilled(LTemplateInstruction<1>* instr, int index); 2081 template<int I, int T>
2063 LInstruction* DefineSameAsFirst(LTemplateInstruction<1>* instr); 2082 LInstruction* Define(LTemplateInstruction<1, I, T>* instr);
2064 LInstruction* DefineFixed(LTemplateInstruction<1>* instr, Register reg); 2083 template<int I, int T>
2065 LInstruction* DefineFixedDouble(LTemplateInstruction<1>* instr, 2084 LInstruction* DefineAsRegister(LTemplateInstruction<1, I, T>* instr);
2066 XMMRegister reg); 2085 template<int I, int T>
2086 LInstruction* DefineAsSpilled(LTemplateInstruction<1, I, T>* instr,
2087 int index);
2088 template<int I, int T>
2089 LInstruction* DefineSameAsFirst(LTemplateInstruction<1, I, T>* instr);
2090 template<int I, int T>
2091 LInstruction* DefineFixed(LTemplateInstruction<1, I, T>* instr,
2092 Register reg);
2093 template<int I, int T>
2094 LInstruction* DefineFixedDouble(LTemplateInstruction<1, I, T>* instr,
2095 XMMRegister reg);
2067 LInstruction* AssignEnvironment(LInstruction* instr); 2096 LInstruction* AssignEnvironment(LInstruction* instr);
2068 LInstruction* AssignPointerMap(LInstruction* instr); 2097 LInstruction* AssignPointerMap(LInstruction* instr);
2069 2098
2070 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY }; 2099 enum CanDeoptimize { CAN_DEOPTIMIZE_EAGERLY, CANNOT_DEOPTIMIZE_EAGERLY };
2071 2100
2072 // By default we assume that instruction sequences generated for calls 2101 // By default we assume that instruction sequences generated for calls
2073 // cannot deoptimize eagerly and we do not attach environment to this 2102 // cannot deoptimize eagerly and we do not attach environment to this
2074 // instruction. 2103 // instruction.
2075 LInstruction* MarkAsCall( 2104 LInstruction* MarkAsCall(
2076 LInstruction* instr, 2105 LInstruction* instr,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2114 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2143 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2115 }; 2144 };
2116 2145
2117 #undef DECLARE_HYDROGEN_ACCESSOR 2146 #undef DECLARE_HYDROGEN_ACCESSOR
2118 #undef DECLARE_INSTRUCTION 2147 #undef DECLARE_INSTRUCTION
2119 #undef DECLARE_CONCRETE_INSTRUCTION 2148 #undef DECLARE_CONCRETE_INSTRUCTION
2120 2149
2121 } } // namespace v8::internal 2150 } } // namespace v8::internal
2122 2151
2123 #endif // V8_IA32_LITHIUM_IA32_H_ 2152 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698