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

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

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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-escape-analysis.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace v8 { 43 namespace v8 {
44 namespace internal { 44 namespace internal {
45 45
46 // Forward declarations. 46 // Forward declarations.
47 class HBasicBlock; 47 class HBasicBlock;
48 class HEnvironment; 48 class HEnvironment;
49 class HInferRepresentationPhase; 49 class HInferRepresentationPhase;
50 class HInstruction; 50 class HInstruction;
51 class HLoopInformation; 51 class HLoopInformation;
52 class HStoreNamedField;
52 class HValue; 53 class HValue;
53 class LInstruction; 54 class LInstruction;
54 class LChunkBuilder; 55 class LChunkBuilder;
55 56
56
57 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \ 57 #define HYDROGEN_ABSTRACT_INSTRUCTION_LIST(V) \
58 V(ArithmeticBinaryOperation) \ 58 V(ArithmeticBinaryOperation) \
59 V(BinaryOperation) \ 59 V(BinaryOperation) \
60 V(BitwiseBinaryOperation) \ 60 V(BitwiseBinaryOperation) \
61 V(ControlInstruction) \ 61 V(ControlInstruction) \
62 V(Instruction) \ 62 V(Instruction) \
63 63
64 64
65 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ 65 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
66 V(AbnormalExit) \ 66 V(AbnormalExit) \
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 V(Random) \ 157 V(Random) \
158 V(RegExpLiteral) \ 158 V(RegExpLiteral) \
159 V(Return) \ 159 V(Return) \
160 V(Ror) \ 160 V(Ror) \
161 V(Sar) \ 161 V(Sar) \
162 V(SeqStringSetChar) \ 162 V(SeqStringSetChar) \
163 V(Shl) \ 163 V(Shl) \
164 V(Shr) \ 164 V(Shr) \
165 V(Simulate) \ 165 V(Simulate) \
166 V(StackCheck) \ 166 V(StackCheck) \
167 V(StoreCodeEntry) \
167 V(StoreContextSlot) \ 168 V(StoreContextSlot) \
168 V(StoreGlobalCell) \ 169 V(StoreGlobalCell) \
169 V(StoreGlobalGeneric) \ 170 V(StoreGlobalGeneric) \
170 V(StoreKeyed) \ 171 V(StoreKeyed) \
171 V(StoreKeyedGeneric) \ 172 V(StoreKeyedGeneric) \
172 V(StoreNamedField) \ 173 V(StoreNamedField) \
173 V(StoreNamedGeneric) \ 174 V(StoreNamedGeneric) \
174 V(StringAdd) \ 175 V(StringAdd) \
175 V(StringCharCodeAt) \ 176 V(StringCharCodeAt) \
176 V(StringCharFromCode) \ 177 V(StringCharFromCode) \
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 876
876 // This gives the instruction an opportunity to replace itself with an 877 // This gives the instruction an opportunity to replace itself with an
877 // instruction that does the same in some better way. To replace an 878 // instruction that does the same in some better way. To replace an
878 // instruction with a new one, first add the new instruction to the graph, 879 // instruction with a new one, first add the new instruction to the graph,
879 // then return it. Return NULL to have the instruction deleted. 880 // then return it. Return NULL to have the instruction deleted.
880 virtual HValue* Canonicalize() { return this; } 881 virtual HValue* Canonicalize() { return this; }
881 882
882 bool Equals(HValue* other); 883 bool Equals(HValue* other);
883 virtual intptr_t Hashcode(); 884 virtual intptr_t Hashcode();
884 885
885 // Compute unique ids upfront that is safe wrt GC and parallel recompilation. 886 // Compute unique ids upfront that is safe wrt GC and concurrent compilation.
886 virtual void FinalizeUniqueValueId() { } 887 virtual void FinalizeUniqueValueId() { }
887 888
888 // Printing support. 889 // Printing support.
889 virtual void PrintTo(StringStream* stream) = 0; 890 virtual void PrintTo(StringStream* stream) = 0;
890 void PrintNameTo(StringStream* stream); 891 void PrintNameTo(StringStream* stream);
891 void PrintTypeTo(StringStream* stream); 892 void PrintTypeTo(StringStream* stream);
892 void PrintRangeTo(StringStream* stream); 893 void PrintRangeTo(StringStream* stream);
893 void PrintChangesTo(StringStream* stream); 894 void PrintChangesTo(StringStream* stream);
894 895
895 const char* Mnemonic() const; 896 const char* Mnemonic() const;
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1365 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1365 1366
1366 Handle<Map> map() const { return map_; } 1367 Handle<Map> map() const { return map_; }
1367 1368
1368 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1369 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1369 return Representation::Tagged(); 1370 return Representation::Tagged();
1370 } 1371 }
1371 1372
1372 DECLARE_CONCRETE_INSTRUCTION(CompareMap) 1373 DECLARE_CONCRETE_INSTRUCTION(CompareMap)
1373 1374
1375 protected:
1376 virtual int RedefinedOperandIndex() { return 0; }
1377
1374 private: 1378 private:
1375 Handle<Map> map_; 1379 Handle<Map> map_;
1376 }; 1380 };
1377 1381
1378 1382
1379 class HContext V8_FINAL : public HTemplateInstruction<0> { 1383 class HContext V8_FINAL : public HTemplateInstruction<0> {
1380 public: 1384 public:
1381 static HContext* New(Zone* zone) { 1385 static HContext* New(Zone* zone) {
1382 return new(zone) HContext(); 1386 return new(zone) HContext();
1383 } 1387 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 } 1670 }
1667 1671
1668 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 1672 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
1669 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1673 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1670 return Representation::None(); 1674 return Representation::None();
1671 } 1675 }
1672 1676
1673 void MergeWith(ZoneList<HSimulate*>* list); 1677 void MergeWith(ZoneList<HSimulate*>* list);
1674 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; } 1678 bool is_candidate_for_removal() { return removable_ == REMOVABLE_SIMULATE; }
1675 1679
1680 // Replay effects of this instruction on the given environment.
1681 void ReplayEnvironment(HEnvironment* env);
1682
1676 DECLARE_CONCRETE_INSTRUCTION(Simulate) 1683 DECLARE_CONCRETE_INSTRUCTION(Simulate)
1677 1684
1678 #ifdef DEBUG 1685 #ifdef DEBUG
1679 virtual void Verify() V8_OVERRIDE; 1686 virtual void Verify() V8_OVERRIDE;
1680 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } 1687 void set_closure(Handle<JSFunction> closure) { closure_ = closure; }
1681 Handle<JSFunction> closure() const { return closure_; } 1688 Handle<JSFunction> closure() const { return closure_; }
1682 #endif 1689 #endif
1683 1690
1684 protected: 1691 protected:
1685 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE { 1692 virtual void InternalSetOperandAt(int index, HValue* value) V8_OVERRIDE {
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2568 return false; 2575 return false;
2569 } 2576 }
2570 for (int i = 0; i < map_unique_ids_.length(); i++) { 2577 for (int i = 0; i < map_unique_ids_.length(); i++) {
2571 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { 2578 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) {
2572 return false; 2579 return false;
2573 } 2580 }
2574 } 2581 }
2575 return true; 2582 return true;
2576 } 2583 }
2577 2584
2585 virtual int RedefinedOperandIndex() { return 0; }
2586
2578 private: 2587 private:
2579 void Add(Handle<Map> map, Zone* zone) { 2588 void Add(Handle<Map> map, Zone* zone) {
2580 map_set_.Add(map, zone); 2589 map_set_.Add(map, zone);
2581 if (!has_migration_target_ && map->is_migration_target()) { 2590 if (!has_migration_target_ && map->is_migration_target()) {
2582 has_migration_target_ = true; 2591 has_migration_target_ = true;
2583 SetGVNFlag(kChangesNewSpacePromotion); 2592 SetGVNFlag(kChangesNewSpacePromotion);
2584 } 2593 }
2585 } 2594 }
2586 2595
2587 // Clients should use one of the static New* methods above. 2596 // Clients should use one of the static New* methods above.
2588 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) 2597 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck)
2589 : HTemplateInstruction<2>(value->type()), 2598 : HTemplateInstruction<2>(value->type()),
2590 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) { 2599 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) {
2591 SetOperandAt(0, value); 2600 SetOperandAt(0, value);
2592 // Use the object value for the dependency if NULL is passed. 2601 // Use the object value for the dependency if NULL is passed.
2593 // TODO(titzer): do GVN flags already express this dependency? 2602 // TODO(titzer): do GVN flags already express this dependency?
2594 SetOperandAt(1, typecheck != NULL ? typecheck : value); 2603 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2595 set_representation(Representation::Tagged()); 2604 set_representation(Representation::Tagged());
2596 SetFlag(kUseGVN); 2605 SetFlag(kUseGVN);
2597 SetFlag(kTrackSideEffectDominators); 2606 SetFlag(kTrackSideEffectDominators);
2598 SetGVNFlag(kDependsOnMaps); 2607 SetGVNFlag(kDependsOnMaps);
2599 SetGVNFlag(kDependsOnElementsKind); 2608 SetGVNFlag(kDependsOnElementsKind);
2600 } 2609 }
2601 2610
2602 void omit(CompilationInfo* info) { 2611 void omit(CompilationInfo* info) {
2603 omit_ = true; 2612 omit_ = true;
2604 for (int i = 0; i < map_set_.length(); i++) { 2613 for (int i = 0; i < map_set_.length(); i++) {
2605 Handle<Map> map = map_set_.at(i); 2614 Handle<Map> map = map_set_.at(i);
2615 if (!map->CanTransition()) continue;
2606 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, 2616 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup,
2607 info); 2617 info);
2608 } 2618 }
2609 } 2619 }
2610 2620
2611 bool omit_; 2621 bool omit_;
2612 bool has_migration_target_; 2622 bool has_migration_target_;
2613 SmallMapList map_set_; 2623 SmallMapList map_set_;
2614 ZoneList<UniqueValueId> map_unique_ids_; 2624 ZoneList<UniqueValueId> map_unique_ids_;
2615 }; 2625 };
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 2702
2693 protected: 2703 protected:
2694 // TODO(ager): It could be nice to allow the ommision of instance 2704 // TODO(ager): It could be nice to allow the ommision of instance
2695 // type checks if we have already performed an instance type check 2705 // type checks if we have already performed an instance type check
2696 // with a larger range. 2706 // with a larger range.
2697 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2707 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2698 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2708 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2699 return check_ == b->check_; 2709 return check_ == b->check_;
2700 } 2710 }
2701 2711
2712 virtual int RedefinedOperandIndex() { return 0; }
2713
2702 private: 2714 private:
2703 enum Check { 2715 enum Check {
2704 IS_SPEC_OBJECT, 2716 IS_SPEC_OBJECT,
2705 IS_JS_ARRAY, 2717 IS_JS_ARRAY,
2706 IS_STRING, 2718 IS_STRING,
2707 IS_INTERNALIZED_STRING, 2719 IS_INTERNALIZED_STRING,
2708 LAST_INTERVAL_CHECK = IS_JS_ARRAY 2720 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2709 }; 2721 };
2710 2722
2711 const char* GetCheckName(); 2723 const char* GetCheckName();
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3193 HArgumentsObject(int count, Zone* zone) 3205 HArgumentsObject(int count, Zone* zone)
3194 : HDematerializedObject(count, zone) { 3206 : HDematerializedObject(count, zone) {
3195 set_representation(Representation::Tagged()); 3207 set_representation(Representation::Tagged());
3196 SetFlag(kIsArguments); 3208 SetFlag(kIsArguments);
3197 } 3209 }
3198 }; 3210 };
3199 3211
3200 3212
3201 class HCapturedObject V8_FINAL : public HDematerializedObject { 3213 class HCapturedObject V8_FINAL : public HDematerializedObject {
3202 public: 3214 public:
3203 HCapturedObject(int length, Zone* zone) 3215 HCapturedObject(int length, int id, Zone* zone)
3204 : HDematerializedObject(length, zone) { 3216 : HDematerializedObject(length, zone), capture_id_(id) {
3205 set_representation(Representation::Tagged()); 3217 set_representation(Representation::Tagged());
3206 values_.AddBlock(NULL, length, zone); // Resize list. 3218 values_.AddBlock(NULL, length, zone); // Resize list.
3207 } 3219 }
3208 3220
3209 // The values contain a list of all in-object properties inside the 3221 // The values contain a list of all in-object properties inside the
3210 // captured object and is index by field index. Properties in the 3222 // captured object and is index by field index. Properties in the
3211 // properties or elements backing store are not tracked here. 3223 // properties or elements backing store are not tracked here.
3212 const ZoneList<HValue*>* values() const { return &values_; } 3224 const ZoneList<HValue*>* values() const { return &values_; }
3213 int length() const { return values_.length(); } 3225 int length() const { return values_.length(); }
3226 int capture_id() const { return capture_id_; }
3227
3228 // Replay effects of this instruction on the given environment.
3229 void ReplayEnvironment(HEnvironment* env);
3214 3230
3215 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3231 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3232
3233 private:
3234 int capture_id_;
3216 }; 3235 };
3217 3236
3218 3237
3219 class HConstant V8_FINAL : public HTemplateInstruction<0> { 3238 class HConstant V8_FINAL : public HTemplateInstruction<0> {
3220 public: 3239 public:
3221 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3240 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3222 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3241 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3223 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3242 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3224 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3243 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3244 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Map>, UniqueValueId);
3225 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3245 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3226 3246
3247 static HConstant* CreateAndInsertAfter(Zone* zone,
3248 HValue* context,
3249 int32_t value,
3250 Representation representation,
3251 HInstruction* instruction) {
3252 HConstant* new_constant =
3253 HConstant::New(zone, context, value, representation);
3254 new_constant->InsertAfter(instruction);
3255 return new_constant;
3256 }
3257
3258 static HConstant* CreateAndInsertBefore(Zone* zone,
3259 HValue* context,
3260 int32_t value,
3261 Representation representation,
3262 HInstruction* instruction) {
3263 HConstant* new_constant =
3264 HConstant::New(zone, context, value, representation);
3265 new_constant->InsertBefore(instruction);
3266 return new_constant;
3267 }
3268
3227 Handle<Object> handle() { 3269 Handle<Object> handle() {
3228 if (handle_.is_null()) { 3270 if (handle_.is_null()) {
3229 Factory* factory = Isolate::Current()->factory(); 3271 Factory* factory = Isolate::Current()->factory();
3230 // Default arguments to is_not_in_new_space depend on this heap number 3272 // Default arguments to is_not_in_new_space depend on this heap number
3231 // to be tenured so that it's guaranteed not be be located in new space. 3273 // to be tenured so that it's guaranteed not be be located in new space.
3232 handle_ = factory->NewNumber(double_value_, TENURED); 3274 handle_ = factory->NewNumber(double_value_, TENURED);
3233 } 3275 }
3234 AllowDeferredHandleDereference smi_check; 3276 AllowDeferredHandleDereference smi_check;
3235 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3277 ASSERT(has_int32_value_ || !handle_->IsSmi());
3236 return handle_; 3278 return handle_;
3237 } 3279 }
3238 3280
3239 bool InstanceOf(Handle<Map> map) { 3281 bool HasMap(Handle<Map> map) {
3240 Handle<Object> constant_object = handle(); 3282 Handle<Object> constant_object = handle();
3241 return constant_object->IsJSObject() && 3283 return constant_object->IsHeapObject() &&
3242 Handle<JSObject>::cast(constant_object)->map() == *map; 3284 Handle<HeapObject>::cast(constant_object)->map() == *map;
3243 } 3285 }
3244 3286
3245 bool IsSpecialDouble() const { 3287 bool IsSpecialDouble() const {
3246 return has_double_value_ && 3288 return has_double_value_ &&
3247 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3289 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) ||
3248 FixedDoubleArray::is_the_hole_nan(double_value_) || 3290 FixedDoubleArray::is_the_hole_nan(double_value_) ||
3249 std::isnan(double_value_)); 3291 std::isnan(double_value_));
3250 } 3292 }
3251 3293
3252 bool NotInNewSpace() const { 3294 bool NotInNewSpace() const {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3419 bool is_not_in_new_space = true, 3461 bool is_not_in_new_space = true,
3420 Handle<Object> optional_handle = Handle<Object>::null()); 3462 Handle<Object> optional_handle = Handle<Object>::null());
3421 HConstant(Handle<Object> handle, 3463 HConstant(Handle<Object> handle,
3422 UniqueValueId unique_id, 3464 UniqueValueId unique_id,
3423 Representation r, 3465 Representation r,
3424 HType type, 3466 HType type,
3425 bool is_internalized_string, 3467 bool is_internalized_string,
3426 bool is_not_in_new_space, 3468 bool is_not_in_new_space,
3427 bool is_cell, 3469 bool is_cell,
3428 bool boolean_value); 3470 bool boolean_value);
3471 HConstant(Handle<Map> handle,
3472 UniqueValueId unique_id);
3429 explicit HConstant(ExternalReference reference); 3473 explicit HConstant(ExternalReference reference);
3430 3474
3431 void Initialize(Representation r); 3475 void Initialize(Representation r);
3432 3476
3433 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3477 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3434 3478
3435 // If this is a numerical constant, handle_ either points to to the 3479 // If this is a numerical constant, handle_ either points to to the
3436 // HeapObject the constant originated from or is null. If the 3480 // HeapObject the constant originated from or is null. If the
3437 // constant is non-numeric, handle_ always points to a valid 3481 // constant is non-numeric, handle_ always points to a valid
3438 // constant HeapObject. 3482 // constant HeapObject.
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
5086 } 5130 }
5087 5131
5088 void MakePrefillWithFiller() { 5132 void MakePrefillWithFiller() {
5089 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); 5133 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER);
5090 } 5134 }
5091 5135
5092 void MakeDoubleAligned() { 5136 void MakeDoubleAligned() {
5093 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5137 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5094 } 5138 }
5095 5139
5096 void UpdateSize(HValue* size) {
5097 SetOperandAt(1, size);
5098 }
5099
5100 virtual void HandleSideEffectDominator(GVNFlag side_effect, 5140 virtual void HandleSideEffectDominator(GVNFlag side_effect,
5101 HValue* dominator) V8_OVERRIDE; 5141 HValue* dominator) V8_OVERRIDE;
5102 5142
5103 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5143 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5104 5144
5105 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5145 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5106 5146
5107 private: 5147 private:
5108 enum Flags { 5148 enum Flags {
5109 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5149 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5110 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5150 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5111 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5151 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5112 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5152 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5113 PREFILL_WITH_FILLER = 1 << 4 5153 PREFILL_WITH_FILLER = 1 << 4
5114 }; 5154 };
5115 5155
5116 HAllocate(HValue* context, 5156 HAllocate(HValue* context,
5117 HValue* size, 5157 HValue* size,
5118 HType type, 5158 HType type,
5119 PretenureFlag pretenure_flag, 5159 PretenureFlag pretenure_flag,
5120 InstanceType instance_type) 5160 InstanceType instance_type)
5121 : HTemplateInstruction<2>(type) { 5161 : HTemplateInstruction<2>(type),
5162 dominating_allocate_(NULL),
5163 filler_free_space_size_(NULL) {
5122 SetOperandAt(0, context); 5164 SetOperandAt(0, context);
5123 SetOperandAt(1, size); 5165 SetOperandAt(1, size);
5124 set_representation(Representation::Tagged()); 5166 set_representation(Representation::Tagged());
5125 SetFlag(kTrackSideEffectDominators); 5167 SetFlag(kTrackSideEffectDominators);
5126 SetGVNFlag(kChangesNewSpacePromotion); 5168 SetGVNFlag(kChangesNewSpacePromotion);
5127 SetGVNFlag(kDependsOnNewSpacePromotion); 5169 SetGVNFlag(kDependsOnNewSpacePromotion);
5128 flags_ = pretenure_flag == TENURED 5170 flags_ = pretenure_flag == TENURED
5129 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE 5171 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE
5130 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) 5172 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE)
5131 : ALLOCATE_IN_NEW_SPACE; 5173 : ALLOCATE_IN_NEW_SPACE;
5132 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { 5174 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) {
5133 flags_ = static_cast<HAllocate::Flags>(flags_ | 5175 flags_ = static_cast<HAllocate::Flags>(flags_ |
5134 ALLOCATE_DOUBLE_ALIGNED); 5176 ALLOCATE_DOUBLE_ALIGNED);
5135 } 5177 }
5136 } 5178 }
5137 5179
5180 void UpdateSize(HValue* size) {
5181 SetOperandAt(1, size);
5182 }
5183
5184 HAllocate* GetFoldableDominator(HAllocate* dominator);
5185
5186 void UpdateFreeSpaceFiller(int32_t filler_size);
5187
5188 void CreateFreeSpaceFiller(int32_t filler_size);
5189
5190 bool IsFoldable(HAllocate* allocate) {
5191 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5192 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) ||
5193 (IsOldPointerSpaceAllocation() &&
5194 allocate->IsOldPointerSpaceAllocation());
5195 }
5196
5138 Flags flags_; 5197 Flags flags_;
5139 Handle<Map> known_initial_map_; 5198 Handle<Map> known_initial_map_;
5199 HAllocate* dominating_allocate_;
5200 HStoreNamedField* filler_free_space_size_;
5140 }; 5201 };
5141 5202
5142 5203
5143 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<1> { 5204 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> {
5205 public:
5206 static HStoreCodeEntry* New(Zone* zone,
5207 HValue* context,
5208 HValue* function,
5209 HValue* code) {
5210 return new(zone) HStoreCodeEntry(function, code);
5211 }
5212
5213 virtual Representation RequiredInputRepresentation(int index) {
5214 return Representation::Tagged();
5215 }
5216
5217 HValue* function() { return OperandAt(0); }
5218 HValue* code_object() { return OperandAt(1); }
5219
5220 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry)
5221
5222 private:
5223 HStoreCodeEntry(HValue* function, HValue* code) {
5224 SetOperandAt(0, function);
5225 SetOperandAt(1, code);
5226 }
5227 };
5228
5229
5230 class HInnerAllocatedObject V8_FINAL: public HTemplateInstruction<1> {
5144 public: 5231 public:
5145 static HInnerAllocatedObject* New(Zone* zone, 5232 static HInnerAllocatedObject* New(Zone* zone,
5146 HValue* context, 5233 HValue* context,
5147 HValue* value, 5234 HValue* value,
5148 int offset, 5235 int offset,
5149 HType type = HType::Tagged()) { 5236 HType type = HType::Tagged()) {
5150 return new(zone) HInnerAllocatedObject(value, offset, type); 5237 return new(zone) HInnerAllocatedObject(value, offset, type);
5151 } 5238 }
5152 5239
5153 HValue* base_object() { return OperandAt(0); } 5240 HValue* base_object() { return OperandAt(0); }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
5442 5529
5443 static HObjectAccess ForHeapNumberValue() { 5530 static HObjectAccess ForHeapNumberValue() {
5444 return HObjectAccess( 5531 return HObjectAccess(
5445 kDouble, HeapNumber::kValueOffset, Representation::Double()); 5532 kDouble, HeapNumber::kValueOffset, Representation::Double());
5446 } 5533 }
5447 5534
5448 static HObjectAccess ForElementsPointer() { 5535 static HObjectAccess ForElementsPointer() {
5449 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset); 5536 return HObjectAccess(kElementsPointer, JSObject::kElementsOffset);
5450 } 5537 }
5451 5538
5539 static HObjectAccess ForLiteralsPointer() {
5540 return HObjectAccess(kInobject, JSFunction::kLiteralsOffset);
5541 }
5542
5543 static HObjectAccess ForNextFunctionLinkPointer() {
5544 return HObjectAccess(kInobject, JSFunction::kNextFunctionLinkOffset);
5545 }
5546
5452 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { 5547 static HObjectAccess ForArrayLength(ElementsKind elements_kind) {
5453 return HObjectAccess( 5548 return HObjectAccess(
5454 kArrayLengths, 5549 kArrayLengths,
5455 JSArray::kLengthOffset, 5550 JSArray::kLengthOffset,
5456 IsFastElementsKind(elements_kind) && 5551 IsFastElementsKind(elements_kind) &&
5457 FLAG_track_fields 5552 FLAG_track_fields
5458 ? Representation::Smi() : Representation::Tagged()); 5553 ? Representation::Smi() : Representation::Tagged());
5459 } 5554 }
5460 5555
5461 static HObjectAccess ForAllocationSiteTransitionInfo() { 5556 static HObjectAccess ForAllocationSiteTransitionInfo() {
(...skipping 24 matching lines...) Expand all
5486 } 5581 }
5487 5582
5488 static HObjectAccess ForPropertiesPointer() { 5583 static HObjectAccess ForPropertiesPointer() {
5489 return HObjectAccess(kInobject, JSObject::kPropertiesOffset); 5584 return HObjectAccess(kInobject, JSObject::kPropertiesOffset);
5490 } 5585 }
5491 5586
5492 static HObjectAccess ForPrototypeOrInitialMap() { 5587 static HObjectAccess ForPrototypeOrInitialMap() {
5493 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset); 5588 return HObjectAccess(kInobject, JSFunction::kPrototypeOrInitialMapOffset);
5494 } 5589 }
5495 5590
5591 static HObjectAccess ForSharedFunctionInfoPointer() {
5592 return HObjectAccess(kInobject, JSFunction::kSharedFunctionInfoOffset);
5593 }
5594
5595 static HObjectAccess ForCodeEntryPointer() {
5596 return HObjectAccess(kInobject, JSFunction::kCodeEntryOffset);
5597 }
5598
5599 static HObjectAccess ForCodeOffset() {
5600 return HObjectAccess(kInobject, SharedFunctionInfo::kCodeOffset);
5601 }
5602
5603 static HObjectAccess ForFirstCodeSlot() {
5604 return HObjectAccess(kInobject, SharedFunctionInfo::kFirstCodeSlot);
5605 }
5606
5607 static HObjectAccess ForFirstContextSlot() {
5608 return HObjectAccess(kInobject, SharedFunctionInfo::kFirstContextSlot);
5609 }
5610
5611 static HObjectAccess ForOptimizedCodeMap() {
5612 return HObjectAccess(kInobject,
5613 SharedFunctionInfo::kOptimizedCodeMapOffset);
5614 }
5615
5616 static HObjectAccess ForFunctionContextPointer() {
5617 return HObjectAccess(kInobject, JSFunction::kContextOffset);
5618 }
5619
5496 static HObjectAccess ForMap() { 5620 static HObjectAccess ForMap() {
5497 return HObjectAccess(kMaps, JSObject::kMapOffset); 5621 return HObjectAccess(kMaps, JSObject::kMapOffset);
5498 } 5622 }
5499 5623
5500 static HObjectAccess ForPropertyCellValue() { 5624 static HObjectAccess ForPropertyCellValue() {
5501 return HObjectAccess(kInobject, PropertyCell::kValueOffset); 5625 return HObjectAccess(kInobject, PropertyCell::kValueOffset);
5502 } 5626 }
5503 5627
5504 static HObjectAccess ForCellValue() { 5628 static HObjectAccess ForCellValue() {
5505 return HObjectAccess(kInobject, Cell::kValueOffset); 5629 return HObjectAccess(kInobject, Cell::kValueOffset);
(...skipping 10 matching lines...) Expand all
5516 // Create an access to an offset in a fixed array header. 5640 // Create an access to an offset in a fixed array header.
5517 static HObjectAccess ForFixedArrayHeader(int offset); 5641 static HObjectAccess ForFixedArrayHeader(int offset);
5518 5642
5519 // Create an access to an in-object property in a JSObject. 5643 // Create an access to an in-object property in a JSObject.
5520 static HObjectAccess ForJSObjectOffset(int offset, 5644 static HObjectAccess ForJSObjectOffset(int offset,
5521 Representation representation = Representation::Tagged()); 5645 Representation representation = Representation::Tagged());
5522 5646
5523 // Create an access to an in-object property in a JSArray. 5647 // Create an access to an in-object property in a JSArray.
5524 static HObjectAccess ForJSArrayOffset(int offset); 5648 static HObjectAccess ForJSArrayOffset(int offset);
5525 5649
5650 static HObjectAccess ForContextSlot(int index);
5651
5526 // Create an access to the backing store of an object. 5652 // Create an access to the backing store of an object.
5527 static HObjectAccess ForBackingStoreOffset(int offset, 5653 static HObjectAccess ForBackingStoreOffset(int offset,
5528 Representation representation = Representation::Tagged()); 5654 Representation representation = Representation::Tagged());
5529 5655
5530 // Create an access to a resolved field (in-object or backing store). 5656 // Create an access to a resolved field (in-object or backing store).
5531 static HObjectAccess ForField(Handle<Map> map, 5657 static HObjectAccess ForField(Handle<Map> map,
5532 LookupResult *lookup, Handle<String> name = Handle<String>::null()); 5658 LookupResult *lookup, Handle<String> name = Handle<String>::null());
5533 5659
5534 // Create an access for the payload of a Cell or JSGlobalPropertyCell. 5660 // Create an access for the payload of a Cell or JSGlobalPropertyCell.
5535 static HObjectAccess ForCellPayload(Isolate* isolate); 5661 static HObjectAccess ForCellPayload(Isolate* isolate);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
5578 5704
5579 friend class HLoadNamedField; 5705 friend class HLoadNamedField;
5580 friend class HStoreNamedField; 5706 friend class HStoreNamedField;
5581 5707
5582 inline Portion portion() const { 5708 inline Portion portion() const {
5583 return PortionField::decode(value_); 5709 return PortionField::decode(value_);
5584 } 5710 }
5585 }; 5711 };
5586 5712
5587 5713
5588 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 5714 class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
5589 public: 5715 public:
5590 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); 5716 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess);
5591 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess,
5592 HValue*);
5593 5717
5594 HValue* object() { return OperandAt(0); } 5718 HValue* object() { return OperandAt(0); }
5595 HValue* typecheck() { 5719 bool HasTypeCheck() { return object()->IsCheckMaps(); }
5596 ASSERT(HasTypeCheck());
5597 return OperandAt(1);
5598 }
5599
5600 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
5601 void ClearTypeCheck() { SetOperandAt(1, object()); }
5602 HObjectAccess access() const { return access_; } 5720 HObjectAccess access() const { return access_; }
5603 Representation field_representation() const { 5721 Representation field_representation() const {
5604 return access_.representation(); 5722 return access_.representation();
5605 } 5723 }
5606 5724
5607 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 5725 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
5608 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5726 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5609 if (index == 0 && access().IsExternalMemory()) { 5727 if (index == 0 && access().IsExternalMemory()) {
5610 // object must be external in case of external memory access 5728 // object must be external in case of external memory access
5611 return Representation::External(); 5729 return Representation::External();
5612 } 5730 }
5613 return Representation::Tagged(); 5731 return Representation::Tagged();
5614 } 5732 }
5615 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5733 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
5616 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5734 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5617 5735
5618 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 5736 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
5619 5737
5620 protected: 5738 protected:
5621 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5739 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5622 HLoadNamedField* b = HLoadNamedField::cast(other); 5740 HLoadNamedField* b = HLoadNamedField::cast(other);
5623 return access_.Equals(b->access_); 5741 return access_.Equals(b->access_);
5624 } 5742 }
5625 5743
5626 private: 5744 private:
5627 HLoadNamedField(HValue* object, 5745 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) {
5628 HObjectAccess access,
5629 HValue* typecheck = NULL)
5630 : access_(access) {
5631 ASSERT(object != NULL); 5746 ASSERT(object != NULL);
5632 SetOperandAt(0, object); 5747 SetOperandAt(0, object);
5633 SetOperandAt(1, typecheck != NULL ? typecheck : object);
5634 5748
5635 Representation representation = access.representation(); 5749 Representation representation = access.representation();
5636 if (representation.IsSmi()) { 5750 if (representation.IsSmi()) {
5637 set_type(HType::Smi()); 5751 set_type(HType::Smi());
5638 set_representation(representation); 5752 set_representation(representation);
5639 } else if (representation.IsDouble() || 5753 } else if (representation.IsDouble() ||
5640 representation.IsExternal() || 5754 representation.IsExternal() ||
5641 representation.IsInteger32()) { 5755 representation.IsInteger32()) {
5642 set_representation(representation); 5756 set_representation(representation);
5643 } else if (FLAG_track_heap_object_fields && 5757 } else if (FLAG_track_heap_object_fields &&
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
5988 6102
5989 bool NeedsWriteBarrierForMap() { 6103 bool NeedsWriteBarrierForMap() {
5990 if (IsSkipWriteBarrier()) return false; 6104 if (IsSkipWriteBarrier()) return false;
5991 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); 6105 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator());
5992 } 6106 }
5993 6107
5994 Representation field_representation() const { 6108 Representation field_representation() const {
5995 return access_.representation(); 6109 return access_.representation();
5996 } 6110 }
5997 6111
6112 void UpdateValue(HValue* value) {
6113 SetOperandAt(1, value);
6114 }
6115
5998 private: 6116 private:
5999 HStoreNamedField(HValue* obj, 6117 HStoreNamedField(HValue* obj,
6000 HObjectAccess access, 6118 HObjectAccess access,
6001 HValue* val) 6119 HValue* val)
6002 : access_(access), 6120 : access_(access),
6003 new_space_dominator_(NULL), 6121 new_space_dominator_(NULL),
6004 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6122 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6005 has_transition_(false) { 6123 has_transition_(false) {
6006 SetOperandAt(0, obj); 6124 SetOperandAt(0, obj);
6007 SetOperandAt(1, val); 6125 SetOperandAt(1, val);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
6796 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6914 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6797 }; 6915 };
6798 6916
6799 6917
6800 #undef DECLARE_INSTRUCTION 6918 #undef DECLARE_INSTRUCTION
6801 #undef DECLARE_CONCRETE_INSTRUCTION 6919 #undef DECLARE_CONCRETE_INSTRUCTION
6802 6920
6803 } } // namespace v8::internal 6921 } } // namespace v8::internal
6804 6922
6805 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6923 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698