Chromium Code Reviews| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 } | 303 } |
| 303 | 304 |
| 304 bool has_miss_handler() const { | 305 bool has_miss_handler() const { |
| 305 return has_miss_handler_; | 306 return has_miss_handler_; |
| 306 } | 307 } |
| 307 | 308 |
| 308 Register GetParameterRegister(int index) const { | 309 Register GetParameterRegister(int index) const { |
| 309 return register_params_[index]; | 310 return register_params_[index]; |
| 310 } | 311 } |
| 311 | 312 |
| 312 Representation GetRegisterParameterRepresentation(int index) const { | 313 Representation GetParameterRepresentation(int index) const { |
| 313 ASSERT(index < register_param_count_); | 314 ASSERT(index < register_param_count_); |
| 314 if (register_param_representations_.get() == NULL) { | 315 if (register_param_representations_.get() == NULL) { |
| 315 return Representation::Tagged(); | 316 return Representation::Tagged(); |
| 316 } | 317 } |
| 317 | 318 |
| 318 return register_param_representations_[index]; | 319 return register_param_representations_[index]; |
| 319 } | 320 } |
| 320 | 321 |
| 321 bool IsParameterCountRegister(int index) const { | 322 bool IsParameterCountRegister(int index) const { |
| 322 return GetParameterRegister(index).is(stack_parameter_count_); | 323 return GetParameterRegister(index).is(stack_parameter_count_); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 706 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 706 | 707 |
| 707 private: | 708 private: |
| 708 Major MajorKey() { return CreateAllocationSite; } | 709 Major MajorKey() { return CreateAllocationSite; } |
| 709 int NotMissMinorKey() { return 0; } | 710 int NotMissMinorKey() { return 0; } |
| 710 | 711 |
| 711 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 712 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
| 712 }; | 713 }; |
| 713 | 714 |
| 714 | 715 |
| 716 class GrowArrayElementsStub : public HydrogenCodeStub { | |
| 717 public: | |
| 718 explicit GrowArrayElementsStub(Isolate* isolate, bool is_js_array, | |
| 719 ElementsKind kind) | |
| 720 : HydrogenCodeStub(isolate) { | |
| 721 bit_field_ = ElementsKindBits::encode(kind) | | |
| 722 IsJsArrayBits::encode(is_js_array); | |
| 723 } | |
| 724 | |
| 725 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | |
| 726 | |
| 727 static void GenerateAheadOfTime(Isolate* isolate); | |
| 728 | |
| 729 enum RegisterInfo { | |
| 730 kObjectIndex, | |
| 731 kKeyIndex, | |
| 732 kCapacityIndex, | |
| 733 kRegisterArgumentCount | |
| 734 }; | |
| 735 static const Register ObjectRegister(); | |
| 736 static const Register KeyRegister(); | |
| 737 static const Register CapacityRegister(); | |
| 738 | |
| 739 virtual void InitializeInterfaceDescriptor( | |
| 740 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 741 | |
| 742 static void InstallDescriptors(Isolate* isolate) { | |
| 743 GrowArrayElementsStub stub(isolate, true, GetInitialFastElementsKind()); | |
| 744 stub.InitializeInterfaceDescriptor( | |
| 745 isolate->code_stub_interface_descriptor(CodeStub::GrowArrayElements)); | |
| 746 } | |
| 747 | |
| 748 ElementsKind elements_kind() const { | |
| 749 return ElementsKindBits::decode(bit_field_); | |
| 750 } | |
| 751 | |
| 752 bool is_js_array() const { return IsJsArrayBits::decode(bit_field_); } | |
| 753 | |
| 754 private: | |
| 755 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | |
| 756 class IsJsArrayBits: public BitField<bool, 16, 1> {}; | |
|
danno
2014/07/11 12:30:30
Any particular reason you start this field at bit
mvstanton
2014/07/21 09:41:17
Oops, thanks that is a bug because I removed a New
| |
| 757 | |
| 758 uint32_t bit_field_; | |
| 759 | |
| 760 Major MajorKey() { return GrowArrayElements; } | |
| 761 int NotMissMinorKey() { return bit_field_; } | |
| 762 | |
| 763 DISALLOW_COPY_AND_ASSIGN(GrowArrayElementsStub); | |
| 764 }; | |
| 765 | |
| 766 | |
| 715 class InstanceofStub: public PlatformCodeStub { | 767 class InstanceofStub: public PlatformCodeStub { |
| 716 public: | 768 public: |
| 717 enum Flags { | 769 enum Flags { |
| 718 kNoFlags = 0, | 770 kNoFlags = 0, |
| 719 kArgsInRegisters = 1 << 0, | 771 kArgsInRegisters = 1 << 0, |
| 720 kCallSiteInlineCheck = 1 << 1, | 772 kCallSiteInlineCheck = 1 << 1, |
| 721 kReturnTrueFalseObject = 1 << 2 | 773 kReturnTrueFalseObject = 1 << 2 |
| 722 }; | 774 }; |
| 723 | 775 |
| 724 InstanceofStub(Isolate* isolate, Flags flags) | 776 InstanceofStub(Isolate* isolate, Flags flags) |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2533 | 2585 |
| 2534 | 2586 |
| 2535 class CallDescriptors { | 2587 class CallDescriptors { |
| 2536 public: | 2588 public: |
| 2537 static void InitializeForIsolate(Isolate* isolate); | 2589 static void InitializeForIsolate(Isolate* isolate); |
| 2538 }; | 2590 }; |
| 2539 | 2591 |
| 2540 } } // namespace v8::internal | 2592 } } // namespace v8::internal |
| 2541 | 2593 |
| 2542 #endif // V8_CODE_STUBS_H_ | 2594 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |