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

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

Issue 12491023: Remove (H|L)JSArrayLength instructions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 V(InstanceOf) \ 127 V(InstanceOf) \
128 V(InstanceOfKnownGlobal) \ 128 V(InstanceOfKnownGlobal) \
129 V(InstanceSize) \ 129 V(InstanceSize) \
130 V(InvokeFunction) \ 130 V(InvokeFunction) \
131 V(IsConstructCallAndBranch) \ 131 V(IsConstructCallAndBranch) \
132 V(IsNilAndBranch) \ 132 V(IsNilAndBranch) \
133 V(IsObjectAndBranch) \ 133 V(IsObjectAndBranch) \
134 V(IsStringAndBranch) \ 134 V(IsStringAndBranch) \
135 V(IsSmiAndBranch) \ 135 V(IsSmiAndBranch) \
136 V(IsUndetectableAndBranch) \ 136 V(IsUndetectableAndBranch) \
137 V(JSArrayLength) \
138 V(LeaveInlined) \ 137 V(LeaveInlined) \
139 V(LoadContextSlot) \ 138 V(LoadContextSlot) \
140 V(LoadElements) \ 139 V(LoadElements) \
141 V(LoadExternalArrayPointer) \ 140 V(LoadExternalArrayPointer) \
142 V(LoadFunctionPrototype) \ 141 V(LoadFunctionPrototype) \
143 V(LoadGlobalCell) \ 142 V(LoadGlobalCell) \
144 V(LoadGlobalGeneric) \ 143 V(LoadGlobalGeneric) \
145 V(LoadKeyed) \ 144 V(LoadKeyed) \
146 V(LoadKeyedGeneric) \ 145 V(LoadKeyedGeneric) \
147 V(LoadNamedField) \ 146 V(LoadNamedField) \
(...skipping 2237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 } 2384 }
2386 2385
2387 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) 2386 DECLARE_CONCRETE_INSTRUCTION(CallRuntime)
2388 2387
2389 private: 2388 private:
2390 const Runtime::Function* c_function_; 2389 const Runtime::Function* c_function_;
2391 Handle<String> name_; 2390 Handle<String> name_;
2392 }; 2391 };
2393 2392
2394 2393
2395 class HJSArrayLength: public HTemplateInstruction<2> {
2396 public:
2397 HJSArrayLength(HValue* value, HValue* typecheck,
2398 HType type = HType::Tagged()) {
2399 set_type(type);
2400 // The length of an array is stored as a tagged value in the array
2401 // object. It is guaranteed to be 32 bit integer, but it can be
2402 // represented as either a smi or heap number.
2403 SetOperandAt(0, value);
2404 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2405 set_representation(Representation::Tagged());
2406 SetFlag(kUseGVN);
2407 SetGVNFlag(kDependsOnArrayLengths);
2408 SetGVNFlag(kDependsOnMaps);
2409 }
2410
2411 virtual Representation RequiredInputRepresentation(int index) {
2412 return Representation::Tagged();
2413 }
2414
2415 virtual void PrintDataTo(StringStream* stream);
2416
2417 HValue* value() { return OperandAt(0); }
2418 HValue* typecheck() {
2419 ASSERT(HasTypeCheck());
2420 return OperandAt(1);
2421 }
2422 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
2423
2424 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
2425
2426 protected:
2427 virtual bool DataEquals(HValue* other_raw) { return true; }
2428
2429 private:
2430 virtual bool IsDeletable() const { return true; }
2431 };
2432
2433
2434 class HFixedArrayBaseLength: public HUnaryOperation { 2394 class HFixedArrayBaseLength: public HUnaryOperation {
2435 public: 2395 public:
2436 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { 2396 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) {
2437 set_type(HType::Smi()); 2397 set_type(HType::Smi());
2438 set_representation(Representation::Tagged()); 2398 set_representation(Representation::Tagged());
2439 SetFlag(kUseGVN); 2399 SetFlag(kUseGVN);
2440 SetGVNFlag(kDependsOnArrayLengths); 2400 SetGVNFlag(kDependsOnArrayLengths);
2441 } 2401 }
2442 2402
2443 virtual Representation RequiredInputRepresentation(int index) { 2403 virtual Representation RequiredInputRepresentation(int index) {
(...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after
5177 virtual void PrintDataTo(StringStream* stream); 5137 virtual void PrintDataTo(StringStream* stream);
5178 5138
5179 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 5139 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
5180 5140
5181 private: 5141 private:
5182 int slot_index_; 5142 int slot_index_;
5183 Mode mode_; 5143 Mode mode_;
5184 }; 5144 };
5185 5145
5186 5146
5187 class HLoadNamedField: public HUnaryOperation { 5147 class HLoadNamedField: public HTemplateInstruction<2> {
5188 public: 5148 public:
5189 HLoadNamedField(HValue* object, bool is_in_object, int offset) 5149 HLoadNamedField(HValue* object, bool is_in_object, int offset,
5190 : HUnaryOperation(object), 5150 HValue* typecheck = NULL)
5191 is_in_object_(is_in_object), 5151 : is_in_object_(is_in_object),
5192 offset_(offset) { 5152 offset_(offset) {
5153 ASSERT(object != NULL);
5154 SetOperandAt(0, object);
5155 SetOperandAt(1, typecheck != NULL ? typecheck : object);
5156
5193 set_representation(Representation::Tagged()); 5157 set_representation(Representation::Tagged());
5194 SetFlag(kUseGVN); 5158 SetFlag(kUseGVN);
5195 SetGVNFlag(kDependsOnMaps); 5159 SetGVNFlag(kDependsOnMaps);
5196 if (is_in_object) { 5160 if (is_in_object) {
5197 SetGVNFlag(kDependsOnInobjectFields); 5161 SetGVNFlag(kDependsOnInobjectFields);
5198 } else { 5162 } else {
5199 SetGVNFlag(kDependsOnBackingStoreFields); 5163 SetGVNFlag(kDependsOnBackingStoreFields);
5200 } 5164 }
5201 } 5165 }
5202 5166
5167 static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object,
5168 HValue* typecheck,
5169 HType type = HType::Tagged()) {
5170 HLoadNamedField* result = new(zone) HLoadNamedField(
5171 object, true, JSArray::kLengthOffset, typecheck);
5172 result->set_type(type);
5173 result->SetGVNFlag(kDependsOnArrayLengths);
5174 result->ClearGVNFlag(kDependsOnInobjectFields);
5175 return result;
5176 }
5177
5203 HValue* object() { return OperandAt(0); } 5178 HValue* object() { return OperandAt(0); }
5179 HValue* typecheck() {
5180 ASSERT(HasTypeCheck());
5181 return OperandAt(1);
5182 }
5183
5184 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
5204 bool is_in_object() const { return is_in_object_; } 5185 bool is_in_object() const { return is_in_object_; }
5205 int offset() const { return offset_; } 5186 int offset() const { return offset_; }
5206 5187
5207 virtual Representation RequiredInputRepresentation(int index) { 5188 virtual Representation RequiredInputRepresentation(int index) {
5208 return Representation::Tagged(); 5189 return Representation::Tagged();
5209 } 5190 }
5210 virtual void PrintDataTo(StringStream* stream); 5191 virtual void PrintDataTo(StringStream* stream);
5211 5192
5212 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 5193 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
5213 5194
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
6460 virtual bool IsDeletable() const { return true; } 6441 virtual bool IsDeletable() const { return true; }
6461 }; 6442 };
6462 6443
6463 6444
6464 #undef DECLARE_INSTRUCTION 6445 #undef DECLARE_INSTRUCTION
6465 #undef DECLARE_CONCRETE_INSTRUCTION 6446 #undef DECLARE_CONCRETE_INSTRUCTION
6466 6447
6467 } } // namespace v8::internal 6448 } } // namespace v8::internal
6468 6449
6469 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6450 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698