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

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, 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 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 4855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4980 4979
4981 4980
4982 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, 4981 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object,
4983 HValue* new_space_dominator) { 4982 HValue* new_space_dominator) {
4984 if (object->IsInnerAllocatedObject()) { 4983 if (object->IsInnerAllocatedObject()) {
4985 return ReceiverObjectNeedsWriteBarrier( 4984 return ReceiverObjectNeedsWriteBarrier(
4986 HInnerAllocatedObject::cast(object)->base_object(), 4985 HInnerAllocatedObject::cast(object)->base_object(),
4987 new_space_dominator); 4986 new_space_dominator);
4988 } 4987 }
4989 if (object != new_space_dominator) return true; 4988 if (object != new_space_dominator) return true;
4990 if (object->IsFastLiteral()) return false;
4991 if (object->IsAllocateObject()) return false; 4989 if (object->IsAllocateObject()) return false;
4992 if (object->IsAllocate()) { 4990 if (object->IsAllocate()) {
4993 return !HAllocate::cast(object)->GuaranteedInNewSpace(); 4991 return !HAllocate::cast(object)->GuaranteedInNewSpace();
4994 } 4992 }
4995 return true; 4993 return true;
4996 } 4994 }
4997 4995
4998 4996
4999 class HStoreGlobalCell: public HUnaryOperation { 4997 class HStoreGlobalCell: public HUnaryOperation {
5000 public: 4998 public:
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
5970 5968
5971 private: 5969 private:
5972 virtual bool IsDeletable() const { return true; } 5970 virtual bool IsDeletable() const { return true; }
5973 5971
5974 int literal_index_; 5972 int literal_index_;
5975 int depth_; 5973 int depth_;
5976 AllocationSiteMode allocation_site_mode_; 5974 AllocationSiteMode allocation_site_mode_;
5977 }; 5975 };
5978 5976
5979 5977
5980 class HFastLiteral: public HMaterializedLiteral<1> {
5981 public:
5982 HFastLiteral(HValue* context,
5983 Handle<JSObject> boilerplate,
5984 int total_size,
5985 int literal_index,
5986 int depth,
5987 AllocationSiteMode mode)
5988 : HMaterializedLiteral<1>(literal_index, depth, mode),
5989 boilerplate_(boilerplate),
5990 total_size_(total_size) {
5991 SetOperandAt(0, context);
5992 SetGVNFlag(kChangesNewSpacePromotion);
5993 }
5994
5995 // Maximum depth and total number of elements and properties for literal
5996 // graphs to be considered for fast deep-copying.
5997 static const int kMaxLiteralDepth = 3;
5998 static const int kMaxLiteralProperties = 8;
5999
6000 HValue* context() { return OperandAt(0); }
6001 Handle<JSObject> boilerplate() const { return boilerplate_; }
6002 int total_size() const { return total_size_; }
6003 virtual Representation RequiredInputRepresentation(int index) {
6004 return Representation::Tagged();
6005 }
6006 virtual Handle<Map> GetMonomorphicJSObjectMap() {
6007 return Handle<Map>(boilerplate()->map());
6008 }
6009 virtual HType CalculateInferredType();
6010
6011 DECLARE_CONCRETE_INSTRUCTION(FastLiteral)
6012
6013 private:
6014 Handle<JSObject> boilerplate_;
6015 int total_size_;
6016 };
6017
6018
6019 class HArrayLiteral: public HMaterializedLiteral<1> { 5978 class HArrayLiteral: public HMaterializedLiteral<1> {
6020 public: 5979 public:
6021 HArrayLiteral(HValue* context, 5980 HArrayLiteral(HValue* context,
6022 Handle<HeapObject> boilerplate_object, 5981 Handle<HeapObject> boilerplate_object,
6023 int length, 5982 int length,
6024 int literal_index, 5983 int literal_index,
6025 int depth, 5984 int depth,
6026 AllocationSiteMode mode) 5985 AllocationSiteMode mode)
6027 : HMaterializedLiteral<1>(literal_index, depth, mode), 5986 : HMaterializedLiteral<1>(literal_index, depth, mode),
6028 length_(length), 5987 length_(length),
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
6196 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) 6155 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento)
6197 }; 6156 };
6198 6157
6199 6158
6200 class HToFastProperties: public HUnaryOperation { 6159 class HToFastProperties: public HUnaryOperation {
6201 public: 6160 public:
6202 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 6161 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
6203 // This instruction is not marked as having side effects, but 6162 // This instruction is not marked as having side effects, but
6204 // changes the map of the input operand. Use it only when creating 6163 // changes the map of the input operand. Use it only when creating
6205 // object literals. 6164 // object literals.
6206 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral()); 6165 ASSERT(value->IsObjectLiteral());
6207 set_representation(Representation::Tagged()); 6166 set_representation(Representation::Tagged());
6208 } 6167 }
6209 6168
6210 virtual Representation RequiredInputRepresentation(int index) { 6169 virtual Representation RequiredInputRepresentation(int index) {
6211 return Representation::Tagged(); 6170 return Representation::Tagged();
6212 } 6171 }
6213 6172
6214 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 6173 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
6215 6174
6216 private: 6175 private:
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
6460 virtual bool IsDeletable() const { return true; } 6419 virtual bool IsDeletable() const { return true; }
6461 }; 6420 };
6462 6421
6463 6422
6464 #undef DECLARE_INSTRUCTION 6423 #undef DECLARE_INSTRUCTION
6465 #undef DECLARE_CONCRETE_INSTRUCTION 6424 #undef DECLARE_CONCRETE_INSTRUCTION
6466 6425
6467 } } // namespace v8::internal 6426 } } // namespace v8::internal
6468 6427
6469 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6428 #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