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

Side by Side Diff: src/hydrogen-instructions.h

Issue 12880017: Build fast literals in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 V(CompareConstantEqAndBranch) \ 104 V(CompareConstantEqAndBranch) \
105 V(Constant) \ 105 V(Constant) \
106 V(Context) \ 106 V(Context) \
107 V(DeclareGlobals) \ 107 V(DeclareGlobals) \
108 V(DeleteProperty) \ 108 V(DeleteProperty) \
109 V(Deoptimize) \ 109 V(Deoptimize) \
110 V(Div) \ 110 V(Div) \
111 V(DummyUse) \ 111 V(DummyUse) \
112 V(ElementsKind) \ 112 V(ElementsKind) \
113 V(EnterInlined) \ 113 V(EnterInlined) \
114 V(FastLiteral) \
115 V(FixedArrayBaseLength) \ 114 V(FixedArrayBaseLength) \
116 V(ForceRepresentation) \ 115 V(ForceRepresentation) \
117 V(FunctionLiteral) \ 116 V(FunctionLiteral) \
118 V(GetCachedArrayIndex) \ 117 V(GetCachedArrayIndex) \
119 V(GlobalObject) \ 118 V(GlobalObject) \
120 V(GlobalReceiver) \ 119 V(GlobalReceiver) \
121 V(Goto) \ 120 V(Goto) \
122 V(HasCachedArrayIndexAndBranch) \ 121 V(HasCachedArrayIndexAndBranch) \
123 V(HasInstanceTypeAndBranch) \ 122 V(HasInstanceTypeAndBranch) \
124 V(InductionVariableAnnotation) \ 123 V(InductionVariableAnnotation) \
(...skipping 4823 matching lines...) Expand 10 before | Expand all | Expand 10 after
4948 4947
4949 4948
4950 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, 4949 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
4951 HValue* new_space_dominator) { 4950 HValue* new_space_dominator) {
4952 if (object->IsInnerAllocatedObject()) { 4951 if (object->IsInnerAllocatedObject()) {
4953 return ReceiverObjectNeedsWriteBarrier( 4952 return ReceiverObjectNeedsWriteBarrier(
4954 HInnerAllocatedObject::cast(object)->base_object(), 4953 HInnerAllocatedObject::cast(object)->base_object(),
4955 new_space_dominator); 4954 new_space_dominator);
4956 } 4955 }
4957 if (object != new_space_dominator) return true; 4956 if (object != new_space_dominator) return true;
4958 if (object->IsFastLiteral()) return false;
4959 if (object->IsAllocateObject()) return false; 4957 if (object->IsAllocateObject()) return false;
4960 if (object->IsAllocate()) { 4958 if (object->IsAllocate()) {
4961 return !HAllocate::cast(object)->GuaranteedInNewSpace(); 4959 return !HAllocate::cast(object)->GuaranteedInNewSpace();
4962 } 4960 }
4963 return true; 4961 return true;
4964 } 4962 }
4965 4963
4966 4964
4967 class HStoreGlobalCell: public HUnaryOperation { 4965 class HStoreGlobalCell: public HUnaryOperation {
4968 public: 4966 public:
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
5959 5957
5960 private: 5958 private:
5961 virtual bool IsDeletable() const { return true; } 5959 virtual bool IsDeletable() const { return true; }
5962 5960
5963 int literal_index_; 5961 int literal_index_;
5964 int depth_; 5962 int depth_;
5965 AllocationSiteMode allocation_site_mode_; 5963 AllocationSiteMode allocation_site_mode_;
5966 }; 5964 };
5967 5965
5968 5966
5969 class HFastLiteral: public HMaterializedLiteral<1> {
5970 public:
5971 HFastLiteral(HValue* context,
5972 Handle<JSObject> boilerplate,
5973 int total_size,
5974 int literal_index,
5975 int depth,
5976 AllocationSiteMode mode)
5977 : HMaterializedLiteral<1>(literal_index, depth, mode),
5978 boilerplate_(boilerplate),
5979 total_size_(total_size) {
5980 SetOperandAt(0, context);
5981 SetGVNFlag(kChangesNewSpacePromotion);
5982 }
5983
5984 // Maximum depth and total number of elements and properties for literal
5985 // graphs to be considered for fast deep-copying.
5986 static const int kMaxLiteralDepth = 3;
5987 static const int kMaxLiteralProperties = 8;
5988
5989 HValue* context() { return OperandAt(0); }
5990 Handle<JSObject> boilerplate() const { return boilerplate_; }
5991 int total_size() const { return total_size_; }
5992 virtual Representation RequiredInputRepresentation(int index) {
5993 return Representation::Tagged();
5994 }
5995 virtual Handle<Map> GetMonomorphicJSObjectMap() {
5996 return Handle<Map>(boilerplate()->map());
5997 }
5998 virtual HType CalculateInferredType();
5999
6000 DECLARE_CONCRETE_INSTRUCTION(FastLiteral)
6001
6002 private:
6003 Handle<JSObject> boilerplate_;
6004 int total_size_;
6005 };
6006
6007
6008 class HArrayLiteral: public HMaterializedLiteral<1> { 5967 class HArrayLiteral: public HMaterializedLiteral<1> {
6009 public: 5968 public:
6010 HArrayLiteral(HValue* context, 5969 HArrayLiteral(HValue* context,
6011 Handle<HeapObject> boilerplate_object, 5970 Handle<HeapObject> boilerplate_object,
6012 int length, 5971 int length,
6013 int literal_index, 5972 int literal_index,
6014 int depth, 5973 int depth,
6015 AllocationSiteMode mode) 5974 AllocationSiteMode mode)
6016 : HMaterializedLiteral<1>(literal_index, depth, mode), 5975 : HMaterializedLiteral<1>(literal_index, depth, mode),
6017 length_(length), 5976 length_(length),
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
6185 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) 6144 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento)
6186 }; 6145 };
6187 6146
6188 6147
6189 class HToFastProperties: public HUnaryOperation { 6148 class HToFastProperties: public HUnaryOperation {
6190 public: 6149 public:
6191 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 6150 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
6192 // This instruction is not marked as having side effects, but 6151 // This instruction is not marked as having side effects, but
6193 // changes the map of the input operand. Use it only when creating 6152 // changes the map of the input operand. Use it only when creating
6194 // object literals. 6153 // object literals.
6195 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); 6154 ASSERT(value->IsObjectLiteral());
6196 set_representation(Representation::Tagged()); 6155 set_representation(Representation::Tagged());
6197 } 6156 }
6198 6157
6199 virtual Representation RequiredInputRepresentation(int index) { 6158 virtual Representation RequiredInputRepresentation(int index) {
6200 return Representation::Tagged(); 6159 return Representation::Tagged();
6201 } 6160 }
6202 6161
6203 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 6162 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
6204 6163
6205 private: 6164 private:
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6449 virtual bool IsDeletable() const { return true; } 6408 virtual bool IsDeletable() const { return true; }
6450 }; 6409 };
6451 6410
6452 6411
6453 #undef DECLARE_INSTRUCTION 6412 #undef DECLARE_INSTRUCTION
6454 #undef DECLARE_CONCRETE_INSTRUCTION 6413 #undef DECLARE_CONCRETE_INSTRUCTION
6455 6414
6456 } } // namespace v8::internal 6415 } } // namespace v8::internal
6457 6416
6458 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6417 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698