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 26 matching lines...) Expand all Loading... |
37 V(Instanceof) \ | 37 V(Instanceof) \ |
38 V(ConvertToDouble) \ | 38 V(ConvertToDouble) \ |
39 V(WriteInt32ToHeapNumber) \ | 39 V(WriteInt32ToHeapNumber) \ |
40 V(StackCheck) \ | 40 V(StackCheck) \ |
41 V(Interrupt) \ | 41 V(Interrupt) \ |
42 V(FastNewClosure) \ | 42 V(FastNewClosure) \ |
43 V(FastNewContext) \ | 43 V(FastNewContext) \ |
44 V(FastCloneShallowArray) \ | 44 V(FastCloneShallowArray) \ |
45 V(FastCloneShallowObject) \ | 45 V(FastCloneShallowObject) \ |
46 V(CreateAllocationSite) \ | 46 V(CreateAllocationSite) \ |
| 47 V(GrowArrayElements) \ |
47 V(ToBoolean) \ | 48 V(ToBoolean) \ |
48 V(ToNumber) \ | 49 V(ToNumber) \ |
49 V(ArgumentsAccess) \ | 50 V(ArgumentsAccess) \ |
50 V(RegExpConstructResult) \ | 51 V(RegExpConstructResult) \ |
51 V(NumberToString) \ | 52 V(NumberToString) \ |
52 V(DoubleToI) \ | 53 V(DoubleToI) \ |
53 V(CEntry) \ | 54 V(CEntry) \ |
54 V(JSEntry) \ | 55 V(JSEntry) \ |
55 V(KeyedLoadElement) \ | 56 V(KeyedLoadElement) \ |
56 V(KeyedLoadGeneric) \ | 57 V(KeyedLoadGeneric) \ |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 721 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
721 | 722 |
722 private: | 723 private: |
723 Major MajorKey() const { return CreateAllocationSite; } | 724 Major MajorKey() const { return CreateAllocationSite; } |
724 int NotMissMinorKey() const { return 0; } | 725 int NotMissMinorKey() const { return 0; } |
725 | 726 |
726 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 727 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
727 }; | 728 }; |
728 | 729 |
729 | 730 |
| 731 class GrowArrayElementsStub : public HydrogenCodeStub { |
| 732 public: |
| 733 explicit GrowArrayElementsStub(Isolate* isolate, bool is_js_array, |
| 734 ElementsKind kind) |
| 735 : HydrogenCodeStub(isolate) { |
| 736 bit_field_ = ElementsKindBits::encode(kind) | |
| 737 IsJsArrayBits::encode(is_js_array); |
| 738 } |
| 739 |
| 740 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 741 |
| 742 static void GenerateAheadOfTime(Isolate* isolate); |
| 743 |
| 744 enum RegisterInfo { |
| 745 kObjectIndex, |
| 746 kKeyIndex, |
| 747 kCapacityIndex, |
| 748 kRegisterArgumentCount |
| 749 }; |
| 750 static const Register ObjectRegister(); |
| 751 static const Register KeyRegister(); |
| 752 static const Register CapacityRegister(); |
| 753 |
| 754 virtual void InitializeInterfaceDescriptor( |
| 755 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 756 |
| 757 static void InstallDescriptors(Isolate* isolate) { |
| 758 GrowArrayElementsStub stub(isolate, true, GetInitialFastElementsKind()); |
| 759 stub.InitializeInterfaceDescriptor( |
| 760 isolate->code_stub_interface_descriptor(CodeStub::GrowArrayElements)); |
| 761 } |
| 762 |
| 763 ElementsKind elements_kind() const { |
| 764 return ElementsKindBits::decode(bit_field_); |
| 765 } |
| 766 |
| 767 bool is_js_array() const { return IsJsArrayBits::decode(bit_field_); } |
| 768 |
| 769 private: |
| 770 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 771 class IsJsArrayBits: public BitField<bool, ElementsKindBits::kNext, 1> {}; |
| 772 |
| 773 uint32_t bit_field_; |
| 774 |
| 775 Major MajorKey() const { return GrowArrayElements; } |
| 776 int NotMissMinorKey() const { return bit_field_; } |
| 777 |
| 778 DISALLOW_COPY_AND_ASSIGN(GrowArrayElementsStub); |
| 779 }; |
| 780 |
| 781 |
730 class InstanceofStub: public PlatformCodeStub { | 782 class InstanceofStub: public PlatformCodeStub { |
731 public: | 783 public: |
732 enum Flags { | 784 enum Flags { |
733 kNoFlags = 0, | 785 kNoFlags = 0, |
734 kArgsInRegisters = 1 << 0, | 786 kArgsInRegisters = 1 << 0, |
735 kCallSiteInlineCheck = 1 << 1, | 787 kCallSiteInlineCheck = 1 << 1, |
736 kReturnTrueFalseObject = 1 << 2 | 788 kReturnTrueFalseObject = 1 << 2 |
737 }; | 789 }; |
738 | 790 |
739 InstanceofStub(Isolate* isolate, Flags flags) | 791 InstanceofStub(Isolate* isolate, Flags flags) |
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 | 2618 |
2567 | 2619 |
2568 class CallDescriptors { | 2620 class CallDescriptors { |
2569 public: | 2621 public: |
2570 static void InitializeForIsolate(Isolate* isolate); | 2622 static void InitializeForIsolate(Isolate* isolate); |
2571 }; | 2623 }; |
2572 | 2624 |
2573 } } // namespace v8::internal | 2625 } } // namespace v8::internal |
2574 | 2626 |
2575 #endif // V8_CODE_STUBS_H_ | 2627 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |