OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 static const int kNumber = 0; | 585 static const int kNumber = 0; |
586 | 586 |
587 private: | 587 private: |
588 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } | 588 virtual Major MajorKey() const V8_OVERRIDE { return NumberToString; } |
589 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 589 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
590 }; | 590 }; |
591 | 591 |
592 | 592 |
593 class FastNewClosureStub : public HydrogenCodeStub { | 593 class FastNewClosureStub : public HydrogenCodeStub { |
594 public: | 594 public: |
595 FastNewClosureStub(Isolate* isolate, | 595 FastNewClosureStub(Isolate* isolate, StrictMode strict_mode, |
596 StrictMode strict_mode, | 596 FunctionKind kind) |
597 bool is_generator) | |
598 : HydrogenCodeStub(isolate), | 597 : HydrogenCodeStub(isolate), |
599 strict_mode_(strict_mode), | 598 strict_mode_(strict_mode), |
600 is_generator_(is_generator) { } | 599 is_generator_(kind == FunctionKind::kGeneratorFunction), |
| 600 is_concise_method_(kind == FunctionKind::kConciseMethod) {} |
601 | 601 |
602 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 602 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
603 | 603 |
604 virtual void InitializeInterfaceDescriptor( | 604 virtual void InitializeInterfaceDescriptor( |
605 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 605 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
606 | 606 |
607 static void InstallDescriptors(Isolate* isolate); | 607 static void InstallDescriptors(Isolate* isolate); |
608 | 608 |
609 StrictMode strict_mode() const { return strict_mode_; } | 609 StrictMode strict_mode() const { return strict_mode_; } |
610 bool is_generator() const { return is_generator_; } | 610 bool is_generator() const { return is_generator_; } |
| 611 bool is_concise_method() const { return is_concise_method_; } |
| 612 FunctionKind kind() const { |
| 613 // TODO(arv): Update to handle concise generator methods. |
| 614 // if (is_arrow()) return FunctionKind::kArrowFunction; |
| 615 if (is_generator()) return FunctionKind::kGeneratorFunction; |
| 616 if (is_concise_method()) return FunctionKind::kConciseMethod; |
| 617 return FunctionKind::kNormalFunction; |
| 618 } |
611 | 619 |
612 private: | 620 private: |
613 class StrictModeBits: public BitField<bool, 0, 1> {}; | 621 class StrictModeBits : public BitField<bool, 0, 1> {}; |
614 class IsGeneratorBits: public BitField<bool, 1, 1> {}; | 622 class IsGeneratorBits : public BitField<bool, 1, 1> {}; |
| 623 class IsMethodBits : public BitField<bool, 2, 1> {}; |
615 | 624 |
616 Major MajorKey() const { return FastNewClosure; } | 625 Major MajorKey() const { return FastNewClosure; } |
617 int NotMissMinorKey() const { | 626 int NotMissMinorKey() const { |
618 return StrictModeBits::encode(strict_mode_ == STRICT) | | 627 return StrictModeBits::encode(strict_mode_ == STRICT) | |
619 IsGeneratorBits::encode(is_generator_); | 628 IsGeneratorBits::encode(is_generator_) | |
| 629 IsMethodBits::encode(is_concise_method_); |
620 } | 630 } |
621 | 631 |
622 StrictMode strict_mode_; | 632 StrictMode strict_mode_; |
| 633 // TODO(arv): Maybe store these as bits? |
623 bool is_generator_; | 634 bool is_generator_; |
| 635 bool is_concise_method_; |
624 }; | 636 }; |
625 | 637 |
626 | 638 |
627 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 639 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
628 public: | 640 public: |
629 static const int kMaximumSlots = 64; | 641 static const int kMaximumSlots = 64; |
630 | 642 |
631 FastNewContextStub(Isolate* isolate, int slots) | 643 FastNewContextStub(Isolate* isolate, int slots) |
632 : HydrogenCodeStub(isolate), slots_(slots) { | 644 : HydrogenCodeStub(isolate), slots_(slots) { |
633 DCHECK(slots_ > 0 && slots_ <= kMaximumSlots); | 645 DCHECK(slots_ > 0 && slots_ <= kMaximumSlots); |
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 | 2539 |
2528 | 2540 |
2529 class CallDescriptors { | 2541 class CallDescriptors { |
2530 public: | 2542 public: |
2531 static void InitializeForIsolate(Isolate* isolate); | 2543 static void InitializeForIsolate(Isolate* isolate); |
2532 }; | 2544 }; |
2533 | 2545 |
2534 } } // namespace v8::internal | 2546 } } // namespace v8::internal |
2535 | 2547 |
2536 #endif // V8_CODE_STUBS_H_ | 2548 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |