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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 12378039: Inline ByteArray setters like setUint8 in the optimizer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 27 matching lines...) Expand all
38 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \ 38 V(_ImmutableArray, get:length, ImmutableArrayLength, 433698233) \
39 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \ 39 V(_ByteArrayBase, get:length, ByteArrayBaseLength, 1098081765) \
40 V(_ByteArrayBase, _getInt8, ByteArrayBaseGetInt8, 261365835) \ 40 V(_ByteArrayBase, _getInt8, ByteArrayBaseGetInt8, 261365835) \
41 V(_ByteArrayBase, _getUint8, ByteArrayBaseGetUint8, 261365835) \ 41 V(_ByteArrayBase, _getUint8, ByteArrayBaseGetUint8, 261365835) \
42 V(_ByteArrayBase, _getInt16, ByteArrayBaseGetInt16, 261365835) \ 42 V(_ByteArrayBase, _getInt16, ByteArrayBaseGetInt16, 261365835) \
43 V(_ByteArrayBase, _getUint16, ByteArrayBaseGetUint16, 261365835) \ 43 V(_ByteArrayBase, _getUint16, ByteArrayBaseGetUint16, 261365835) \
44 V(_ByteArrayBase, _getInt32, ByteArrayBaseGetInt32, 261365835) \ 44 V(_ByteArrayBase, _getInt32, ByteArrayBaseGetInt32, 261365835) \
45 V(_ByteArrayBase, _getUint32, ByteArrayBaseGetUint32, 261365835) \ 45 V(_ByteArrayBase, _getUint32, ByteArrayBaseGetUint32, 261365835) \
46 V(_ByteArrayBase, _getFloat32, ByteArrayBaseGetFloat32, 434247298) \ 46 V(_ByteArrayBase, _getFloat32, ByteArrayBaseGetFloat32, 434247298) \
47 V(_ByteArrayBase, _getFloat64, ByteArrayBaseGetFloat64, 434247298) \ 47 V(_ByteArrayBase, _getFloat64, ByteArrayBaseGetFloat64, 434247298) \
48 V(_ByteArrayBase, _setInt8, ByteArrayBaseSetInt8, 501962848) \
49 V(_ByteArrayBase, _setUint8, ByteArrayBaseSetUint8, 501962848) \
50 V(_ByteArrayBase, _setInt16, ByteArrayBaseSetInt16, 501962848) \
51 V(_ByteArrayBase, _setUint16, ByteArrayBaseSetUint16, 501962848) \
52 V(_ByteArrayBase, _setInt32, ByteArrayBaseSetInt32, 501962848) \
53 V(_ByteArrayBase, _setUint32, ByteArrayBaseSetUint32, 501962848) \
54 V(_ByteArrayBase, _setFloat32, ByteArrayBaseSetFloat32, 864506525) \
55 V(_ByteArrayBase, _setFloat64, ByteArrayBaseSetFloat64, 864506525) \
48 V(_Float32Array, _getIndexed, Float32ArrayGetIndexed, 734006846) \ 56 V(_Float32Array, _getIndexed, Float32ArrayGetIndexed, 734006846) \
49 V(_Float64Array, _getIndexed, Float64ArrayGetIndexed, 498074772) \ 57 V(_Float64Array, _getIndexed, Float64ArrayGetIndexed, 498074772) \
50 V(_Int8Array, _getIndexed, Int8ArrayGetIndexed, 712069760) \ 58 V(_Int8Array, _getIndexed, Int8ArrayGetIndexed, 712069760) \
51 V(_Uint8Array, _getIndexed, Uint8ArrayGetIndexed, 535849990) \ 59 V(_Uint8Array, _getIndexed, Uint8ArrayGetIndexed, 535849990) \
52 V(_Uint8ClampedArray, _getIndexed, Uint8ClampedArrayGetIndexed, 873344956) \ 60 V(_Uint8ClampedArray, _getIndexed, Uint8ClampedArrayGetIndexed, 873344956) \
53 V(_ExternalUint8Array, _getIndexed, ExternalUint8ArrayGetIndexed, 402720239) \ 61 V(_ExternalUint8Array, _getIndexed, ExternalUint8ArrayGetIndexed, 402720239) \
54 V(_ExternalUint8ClampedArray, _getIndexed, \ 62 V(_ExternalUint8ClampedArray, _getIndexed, \
55 ExternalUint8ClampedArrayGetIndexed, 682839007) \ 63 ExternalUint8ClampedArrayGetIndexed, 682839007) \
56 V(_Int16Array, _getIndexed, Int16ArrayGetIndexed, 313999108) \ 64 V(_Int16Array, _getIndexed, Int16ArrayGetIndexed, 313999108) \
57 V(_Uint16Array, _getIndexed, Uint16ArrayGetIndexed, 539701175) \ 65 V(_Uint16Array, _getIndexed, Uint16ArrayGetIndexed, 539701175) \
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 friend class CheckClassInstr; 732 friend class CheckClassInstr;
725 friend class CheckSmiInstr; 733 friend class CheckSmiInstr;
726 friend class CheckArrayBoundInstr; 734 friend class CheckArrayBoundInstr;
727 friend class CheckEitherNonSmiInstr; 735 friend class CheckEitherNonSmiInstr;
728 friend class LICM; 736 friend class LICM;
729 friend class DoubleToSmiInstr; 737 friend class DoubleToSmiInstr;
730 friend class DoubleToDoubleInstr; 738 friend class DoubleToDoubleInstr;
731 friend class InvokeMathCFunctionInstr; 739 friend class InvokeMathCFunctionInstr;
732 friend class FlowGraphOptimizer; 740 friend class FlowGraphOptimizer;
733 friend class LoadIndexedInstr; 741 friend class LoadIndexedInstr;
742 friend class StoreIndexedInstr;
734 743
735 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; 744 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
736 745
737 intptr_t deopt_id_; 746 intptr_t deopt_id_;
738 intptr_t lifetime_position_; // Position used by register allocator. 747 intptr_t lifetime_position_; // Position used by register allocator.
739 Instruction* previous_; 748 Instruction* previous_;
740 Instruction* next_; 749 Instruction* next_;
741 Environment* env_; 750 Environment* env_;
742 intptr_t expr_id_; 751 intptr_t expr_id_;
743 752
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); 2911 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr);
2903 }; 2912 };
2904 2913
2905 2914
2906 class StoreIndexedInstr : public TemplateDefinition<3> { 2915 class StoreIndexedInstr : public TemplateDefinition<3> {
2907 public: 2916 public:
2908 StoreIndexedInstr(Value* array, 2917 StoreIndexedInstr(Value* array,
2909 Value* index, 2918 Value* index,
2910 Value* value, 2919 Value* value,
2911 StoreBarrierType emit_store_barrier, 2920 StoreBarrierType emit_store_barrier,
2921 intptr_t index_scale,
2912 intptr_t class_id, 2922 intptr_t class_id,
2913 intptr_t deopt_id) 2923 intptr_t deopt_id)
2914 : emit_store_barrier_(emit_store_barrier), 2924 : emit_store_barrier_(emit_store_barrier),
2915 class_id_(class_id), 2925 index_scale_(index_scale),
2916 deopt_id_(deopt_id) { 2926 class_id_(class_id) {
2917 SetInputAt(0, array); 2927 SetInputAt(0, array);
2918 SetInputAt(1, index); 2928 SetInputAt(1, index);
2919 SetInputAt(2, value); 2929 SetInputAt(2, value);
2930 deopt_id_ = deopt_id;
2920 } 2931 }
2921 2932
2922 DECLARE_INSTRUCTION(StoreIndexed) 2933 DECLARE_INSTRUCTION(StoreIndexed)
2923 2934
2924 Value* array() const { return inputs_[0]; } 2935 Value* array() const { return inputs_[0]; }
2925 Value* index() const { return inputs_[1]; } 2936 Value* index() const { return inputs_[1]; }
2926 Value* value() const { return inputs_[2]; } 2937 Value* value() const { return inputs_[2]; }
2938 intptr_t index_scale() const { return index_scale_; }
2927 intptr_t class_id() const { return class_id_; } 2939 intptr_t class_id() const { return class_id_; }
2928 2940
2929 bool ShouldEmitStoreBarrier() const { 2941 bool ShouldEmitStoreBarrier() const {
2930 return value()->NeedsStoreBuffer() 2942 return value()->NeedsStoreBuffer()
2931 && (emit_store_barrier_ == kEmitStoreBarrier); 2943 && (emit_store_barrier_ == kEmitStoreBarrier);
2932 } 2944 }
2933 2945
2934 virtual bool CanDeoptimize() const { return false; } 2946 virtual bool CanDeoptimize() const { return false; }
2935 2947
2936 virtual bool HasSideEffect() const { return true; } 2948 virtual bool HasSideEffect() const { return true; }
2937 2949
2938 virtual Representation RequiredInputRepresentation(intptr_t idx) const; 2950 virtual Representation RequiredInputRepresentation(intptr_t idx) const;
2939 2951
2940 virtual intptr_t DeoptimizationTarget() const { 2952 virtual intptr_t DeoptimizationTarget() const {
2941 // Direct access since this instruction cannot deoptimize, and the deopt-id 2953 // Direct access since this instruction cannot deoptimize, and the deopt-id
2942 // was inherited from another instruction that could deoptimize. 2954 // was inherited from another instruction that could deoptimize.
2943 return deopt_id_; 2955 return deopt_id_;
2944 } 2956 }
2945 2957
2946 private: 2958 private:
2947 const StoreBarrierType emit_store_barrier_; 2959 const StoreBarrierType emit_store_barrier_;
2960 const intptr_t index_scale_;
2948 const intptr_t class_id_; 2961 const intptr_t class_id_;
2949 const intptr_t deopt_id_;
2950 2962
2951 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 2963 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
2952 }; 2964 };
2953 2965
2954 2966
2955 // Note overrideable, built-in: value? false : true. 2967 // Note overrideable, built-in: value? false : true.
2956 class BooleanNegateInstr : public TemplateDefinition<1> { 2968 class BooleanNegateInstr : public TemplateDefinition<1> {
2957 public: 2969 public:
2958 explicit BooleanNegateInstr(Value* value) { 2970 explicit BooleanNegateInstr(Value* value) {
2959 SetInputAt(0, value); 2971 SetInputAt(0, value);
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 ForwardInstructionIterator* current_iterator_; 4514 ForwardInstructionIterator* current_iterator_;
4503 4515
4504 private: 4516 private:
4505 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4517 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4506 }; 4518 };
4507 4519
4508 4520
4509 } // namespace dart 4521 } // namespace dart
4510 4522
4511 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4523 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698