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

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

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 V(StoreNamedGeneric) \ 164 V(StoreNamedGeneric) \
165 V(StringAdd) \ 165 V(StringAdd) \
166 V(StringCharCodeAt) \ 166 V(StringCharCodeAt) \
167 V(StringCharFromCode) \ 167 V(StringCharFromCode) \
168 V(StringLength) \ 168 V(StringLength) \
169 V(Sub) \ 169 V(Sub) \
170 V(ThisFunction) \ 170 V(ThisFunction) \
171 V(Throw) \ 171 V(Throw) \
172 V(ToFastProperties) \ 172 V(ToFastProperties) \
173 V(ToInt32) \ 173 V(ToInt32) \
174 V(TransitionElementsKind) \
174 V(Typeof) \ 175 V(Typeof) \
175 V(TypeofIsAndBranch) \ 176 V(TypeofIsAndBranch) \
176 V(UnaryMathOperation) \ 177 V(UnaryMathOperation) \
177 V(UnknownOSRValue) \ 178 V(UnknownOSRValue) \
178 V(UseConst) \ 179 V(UseConst) \
179 V(ValueOf) 180 V(ValueOf)
180 181
181 #define GVN_FLAG_LIST(V) \ 182 #define GVN_FLAG_LIST(V) \
182 V(Calls) \ 183 V(Calls) \
183 V(InobjectFields) \ 184 V(InobjectFields) \
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 391
391 bool IsJSObject() { 392 bool IsJSObject() {
392 ASSERT(type_ != kUninitialized); 393 ASSERT(type_ != kUninitialized);
393 return ((type_ & kJSObject) == kJSObject); 394 return ((type_ & kJSObject) == kJSObject);
394 } 395 }
395 396
396 bool IsUninitialized() { 397 bool IsUninitialized() {
397 return type_ == kUninitialized; 398 return type_ == kUninitialized;
398 } 399 }
399 400
401 bool IsHeapObject() {
402 ASSERT(type_ != kUninitialized);
403 return IsHeapNumber() || IsString() || IsNonPrimitive();
404 }
405
400 static HType TypeFromValue(Handle<Object> value); 406 static HType TypeFromValue(Handle<Object> value);
401 407
402 const char* ToString(); 408 const char* ToString();
403 const char* ToShortString(); 409 const char* ToShortString();
404 410
405 private: 411 private:
406 enum Type { 412 enum Type {
407 kTagged = 0x1, // 0000 0000 0000 0001 413 kTagged = 0x1, // 0000 0000 0000 0001
408 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101 414 kTaggedPrimitive = 0x5, // 0000 0000 0000 0101
409 kTaggedNumber = 0xd, // 0000 0000 0000 1101 415 kTaggedNumber = 0xd, // 0000 0000 0000 1101
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 class HChange: public HUnaryOperation { 1100 class HChange: public HUnaryOperation {
1095 public: 1101 public:
1096 HChange(HValue* value, 1102 HChange(HValue* value,
1097 Representation to, 1103 Representation to,
1098 bool is_truncating, 1104 bool is_truncating,
1099 bool deoptimize_on_undefined) 1105 bool deoptimize_on_undefined)
1100 : HUnaryOperation(value) { 1106 : HUnaryOperation(value) {
1101 ASSERT(!value->representation().IsNone() && !to.IsNone()); 1107 ASSERT(!value->representation().IsNone() && !to.IsNone());
1102 ASSERT(!value->representation().Equals(to)); 1108 ASSERT(!value->representation().Equals(to));
1103 set_representation(to); 1109 set_representation(to);
1110 set_type(HType::TaggedNumber());
1104 SetFlag(kUseGVN); 1111 SetFlag(kUseGVN);
1105 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); 1112 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined);
1106 if (is_truncating) SetFlag(kTruncatingToInt32); 1113 if (is_truncating) SetFlag(kTruncatingToInt32);
1107 } 1114 }
1108 1115
1109 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 1116 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
1117 virtual HType CalculateInferredType();
1110 1118
1111 Representation from() { return value()->representation(); } 1119 Representation from() { return value()->representation(); }
1112 Representation to() { return representation(); } 1120 Representation to() { return representation(); }
1113 bool deoptimize_on_undefined() const { 1121 bool deoptimize_on_undefined() const {
1114 return CheckFlag(kDeoptimizeOnUndefined); 1122 return CheckFlag(kDeoptimizeOnUndefined);
1115 } 1123 }
1116 virtual Representation RequiredInputRepresentation(int index) { 1124 virtual Representation RequiredInputRepresentation(int index) {
1117 return from(); 1125 return from();
1118 } 1126 }
1119 1127
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 } 1341 }
1334 1342
1335 HValue* argument() { return OperandAt(0); } 1343 HValue* argument() { return OperandAt(0); }
1336 1344
1337 DECLARE_CONCRETE_INSTRUCTION(PushArgument) 1345 DECLARE_CONCRETE_INSTRUCTION(PushArgument)
1338 }; 1346 };
1339 1347
1340 1348
1341 class HThisFunction: public HTemplateInstruction<0> { 1349 class HThisFunction: public HTemplateInstruction<0> {
1342 public: 1350 public:
1343 HThisFunction() { 1351 explicit HThisFunction(Handle<JSFunction> closure) : closure_(closure) {
1344 set_representation(Representation::Tagged()); 1352 set_representation(Representation::Tagged());
1345 SetFlag(kUseGVN); 1353 SetFlag(kUseGVN);
1346 } 1354 }
1347 1355
1348 virtual Representation RequiredInputRepresentation(int index) { 1356 virtual Representation RequiredInputRepresentation(int index) {
1349 return Representation::None(); 1357 return Representation::None();
1350 } 1358 }
1351 1359
1360 Handle<JSFunction> closure() const { return closure_; }
1361
1352 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) 1362 DECLARE_CONCRETE_INSTRUCTION(ThisFunction)
1353 1363
1354 protected: 1364 protected:
1355 virtual bool DataEquals(HValue* other) { return true; } 1365 virtual bool DataEquals(HValue* other) {
1366 HThisFunction* b = HThisFunction::cast(other);
1367 return *closure() == *b->closure();
1368 }
1369
1370 private:
1371 Handle<JSFunction> closure_;
1356 }; 1372 };
1357 1373
1358 1374
1359 class HContext: public HTemplateInstruction<0> { 1375 class HContext: public HTemplateInstruction<0> {
1360 public: 1376 public:
1361 HContext() { 1377 HContext() {
1362 set_representation(Representation::Tagged()); 1378 set_representation(Representation::Tagged());
1363 SetFlag(kUseGVN); 1379 SetFlag(kUseGVN);
1364 } 1380 }
1365 1381
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 2289
2274 virtual bool IsConvertibleToInteger() const { 2290 virtual bool IsConvertibleToInteger() const {
2275 if (handle_->IsSmi()) return true; 2291 if (handle_->IsSmi()) return true;
2276 if (handle_->IsHeapNumber() && 2292 if (handle_->IsHeapNumber() &&
2277 (HeapNumber::cast(*handle_)->value() == 2293 (HeapNumber::cast(*handle_)->value() ==
2278 static_cast<double>(NumberToInt32(*handle_)))) return true; 2294 static_cast<double>(NumberToInt32(*handle_)))) return true;
2279 return false; 2295 return false;
2280 } 2296 }
2281 2297
2282 virtual bool EmitAtUses() { return !representation().IsDouble(); } 2298 virtual bool EmitAtUses() { return !representation().IsDouble(); }
2299 virtual HValue* Canonicalize();
2283 virtual void PrintDataTo(StringStream* stream); 2300 virtual void PrintDataTo(StringStream* stream);
2284 virtual HType CalculateInferredType(); 2301 virtual HType CalculateInferredType();
2285 bool IsInteger() const { return handle_->IsSmi(); } 2302 bool IsInteger() const { return handle_->IsSmi(); }
2286 HConstant* CopyToRepresentation(Representation r) const; 2303 HConstant* CopyToRepresentation(Representation r) const;
2287 HConstant* CopyToTruncatedInt32() const; 2304 HConstant* CopyToTruncatedInt32() const;
2288 bool HasInteger32Value() const { return has_int32_value_; } 2305 bool HasInteger32Value() const { return has_int32_value_; }
2289 int32_t Integer32Value() const { 2306 int32_t Integer32Value() const {
2290 ASSERT(HasInteger32Value()); 2307 ASSERT(HasInteger32Value());
2291 return int32_value_; 2308 return int32_value_;
2292 } 2309 }
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 } 3270 }
3254 3271
3255 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 3272 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
3256 3273
3257 private: 3274 private:
3258 Handle<Object> name_; 3275 Handle<Object> name_;
3259 bool for_typeof_; 3276 bool for_typeof_;
3260 }; 3277 };
3261 3278
3262 3279
3280 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
3281 return !value->type().IsBoolean()
3282 && !value->type().IsSmi()
3283 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable());
3284 }
3285
3286
3263 class HStoreGlobalCell: public HUnaryOperation { 3287 class HStoreGlobalCell: public HUnaryOperation {
3264 public: 3288 public:
3265 HStoreGlobalCell(HValue* value, 3289 HStoreGlobalCell(HValue* value,
3266 Handle<JSGlobalPropertyCell> cell, 3290 Handle<JSGlobalPropertyCell> cell,
3267 PropertyDetails details) 3291 PropertyDetails details)
3268 : HUnaryOperation(value), 3292 : HUnaryOperation(value),
3269 cell_(cell), 3293 cell_(cell),
3270 details_(details) { 3294 details_(details) {
3271 SetFlag(kChangesGlobalVars); 3295 SetFlag(kChangesGlobalVars);
3272 } 3296 }
3273 3297
3274 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 3298 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
3275 bool RequiresHoleCheck() { 3299 bool RequiresHoleCheck() {
3276 return !details_.IsDontDelete() || details_.IsReadOnly(); 3300 return !details_.IsDontDelete() || details_.IsReadOnly();
3277 } 3301 }
3302 bool NeedsWriteBarrier() {
3303 return StoringValueNeedsWriteBarrier(value());
3304 }
3278 3305
3279 virtual Representation RequiredInputRepresentation(int index) { 3306 virtual Representation RequiredInputRepresentation(int index) {
3280 return Representation::Tagged(); 3307 return Representation::Tagged();
3281 } 3308 }
3282 virtual void PrintDataTo(StringStream* stream); 3309 virtual void PrintDataTo(StringStream* stream);
3283 3310
3284 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 3311 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
3285 3312
3286 private: 3313 private:
3287 Handle<JSGlobalPropertyCell> cell_; 3314 Handle<JSGlobalPropertyCell> cell_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 virtual bool DataEquals(HValue* other) { 3375 virtual bool DataEquals(HValue* other) {
3349 HLoadContextSlot* b = HLoadContextSlot::cast(other); 3376 HLoadContextSlot* b = HLoadContextSlot::cast(other);
3350 return (slot_index() == b->slot_index()); 3377 return (slot_index() == b->slot_index());
3351 } 3378 }
3352 3379
3353 private: 3380 private:
3354 int slot_index_; 3381 int slot_index_;
3355 }; 3382 };
3356 3383
3357 3384
3358 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
3359 return !value->type().IsBoolean()
3360 && !value->type().IsSmi()
3361 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable());
3362 }
3363
3364
3365 class HStoreContextSlot: public HTemplateInstruction<2> { 3385 class HStoreContextSlot: public HTemplateInstruction<2> {
3366 public: 3386 public:
3367 HStoreContextSlot(HValue* context, int slot_index, HValue* value) 3387 HStoreContextSlot(HValue* context, int slot_index, HValue* value)
3368 : slot_index_(slot_index) { 3388 : slot_index_(slot_index) {
3369 SetOperandAt(0, context); 3389 SetOperandAt(0, context);
3370 SetOperandAt(1, value); 3390 SetOperandAt(1, value);
3371 SetFlag(kChangesContextSlots); 3391 SetFlag(kChangesContextSlots);
3372 } 3392 }
3373 3393
3374 HValue* context() { return OperandAt(0); } 3394 HValue* context() { return OperandAt(0); }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3693 Handle<Map> transition_; 3713 Handle<Map> transition_;
3694 }; 3714 };
3695 3715
3696 3716
3697 class HStoreNamedGeneric: public HTemplateInstruction<3> { 3717 class HStoreNamedGeneric: public HTemplateInstruction<3> {
3698 public: 3718 public:
3699 HStoreNamedGeneric(HValue* context, 3719 HStoreNamedGeneric(HValue* context,
3700 HValue* object, 3720 HValue* object,
3701 Handle<String> name, 3721 Handle<String> name,
3702 HValue* value, 3722 HValue* value,
3703 bool strict_mode) 3723 StrictModeFlag strict_mode_flag)
3704 : name_(name), 3724 : name_(name),
3705 strict_mode_(strict_mode) { 3725 strict_mode_flag_(strict_mode_flag) {
3706 SetOperandAt(0, object); 3726 SetOperandAt(0, object);
3707 SetOperandAt(1, value); 3727 SetOperandAt(1, value);
3708 SetOperandAt(2, context); 3728 SetOperandAt(2, context);
3709 SetAllSideEffects(); 3729 SetAllSideEffects();
3710 } 3730 }
3711 3731
3712 HValue* object() { return OperandAt(0); } 3732 HValue* object() { return OperandAt(0); }
3713 HValue* value() { return OperandAt(1); } 3733 HValue* value() { return OperandAt(1); }
3714 HValue* context() { return OperandAt(2); } 3734 HValue* context() { return OperandAt(2); }
3715 Handle<String> name() { return name_; } 3735 Handle<String> name() { return name_; }
3716 bool strict_mode() { return strict_mode_; } 3736 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; }
3717 3737
3718 virtual void PrintDataTo(StringStream* stream); 3738 virtual void PrintDataTo(StringStream* stream);
3719 3739
3720 virtual Representation RequiredInputRepresentation(int index) { 3740 virtual Representation RequiredInputRepresentation(int index) {
3721 return Representation::Tagged(); 3741 return Representation::Tagged();
3722 } 3742 }
3723 3743
3724 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 3744 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
3725 3745
3726 private: 3746 private:
3727 Handle<String> name_; 3747 Handle<String> name_;
3728 bool strict_mode_; 3748 StrictModeFlag strict_mode_flag_;
3729 }; 3749 };
3730 3750
3731 3751
3732 class HStoreKeyedFastElement: public HTemplateInstruction<3> { 3752 class HStoreKeyedFastElement: public HTemplateInstruction<3> {
3733 public: 3753 public:
3734 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val, 3754 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val,
3735 ElementsKind elements_kind = FAST_ELEMENTS) 3755 ElementsKind elements_kind = FAST_ELEMENTS)
3736 : elements_kind_(elements_kind) { 3756 : elements_kind_(elements_kind) {
3737 SetOperandAt(0, obj); 3757 SetOperandAt(0, obj);
3738 SetOperandAt(1, key); 3758 SetOperandAt(1, key);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3879 3899
3880 virtual void PrintDataTo(StringStream* stream); 3900 virtual void PrintDataTo(StringStream* stream);
3881 3901
3882 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 3902 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
3883 3903
3884 private: 3904 private:
3885 bool strict_mode_; 3905 bool strict_mode_;
3886 }; 3906 };
3887 3907
3888 3908
3909 class HTransitionElementsKind: public HTemplateInstruction<1> {
3910 public:
3911 HTransitionElementsKind(HValue* object,
3912 Handle<Map> original_map,
3913 Handle<Map> transitioned_map)
3914 : original_map_(original_map),
3915 transitioned_map_(transitioned_map) {
3916 SetOperandAt(0, object);
3917 SetFlag(kUseGVN);
3918 SetFlag(kDependsOnMaps);
3919 set_representation(Representation::Tagged());
3920 }
3921
3922 virtual Representation RequiredInputRepresentation(int index) {
3923 return Representation::Tagged();
3924 }
3925
3926 HValue* object() { return OperandAt(0); }
3927 Handle<Map> original_map() { return original_map_; }
3928 Handle<Map> transitioned_map() { return transitioned_map_; }
3929
3930 virtual void PrintDataTo(StringStream* stream);
3931
3932 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
3933
3934 protected:
3935 virtual bool DataEquals(HValue* other) {
3936 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other);
3937 return original_map_.is_identical_to(instr->original_map()) &&
3938 transitioned_map_.is_identical_to(instr->transitioned_map());
3939 }
3940
3941 private:
3942 Handle<Map> original_map_;
3943 Handle<Map> transitioned_map_;
3944 };
3945
3946
3889 class HStringAdd: public HBinaryOperation { 3947 class HStringAdd: public HBinaryOperation {
3890 public: 3948 public:
3891 HStringAdd(HValue* context, HValue* left, HValue* right) 3949 HStringAdd(HValue* context, HValue* left, HValue* right)
3892 : HBinaryOperation(context, left, right) { 3950 : HBinaryOperation(context, left, right) {
3893 set_representation(Representation::Tagged()); 3951 set_representation(Representation::Tagged());
3894 SetFlag(kUseGVN); 3952 SetFlag(kUseGVN);
3895 SetFlag(kDependsOnMaps); 3953 SetFlag(kDependsOnMaps);
3896 } 3954 }
3897 3955
3898 virtual Representation RequiredInputRepresentation(int index) { 3956 virtual Representation RequiredInputRepresentation(int index) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3941 return new Range(0, String::kMaxUC16CharCode); 3999 return new Range(0, String::kMaxUC16CharCode);
3942 } 4000 }
3943 }; 4001 };
3944 4002
3945 4003
3946 class HStringCharFromCode: public HTemplateInstruction<2> { 4004 class HStringCharFromCode: public HTemplateInstruction<2> {
3947 public: 4005 public:
3948 HStringCharFromCode(HValue* context, HValue* char_code) { 4006 HStringCharFromCode(HValue* context, HValue* char_code) {
3949 SetOperandAt(0, context); 4007 SetOperandAt(0, context);
3950 SetOperandAt(1, char_code); 4008 SetOperandAt(1, char_code);
3951 set_representation(Representation::Tagged()); 4009 set_representation(Representation::Tagged());
3952 SetFlag(kUseGVN); 4010 SetFlag(kUseGVN);
3953 } 4011 }
3954 4012
3955 virtual Representation RequiredInputRepresentation(int index) { 4013 virtual Representation RequiredInputRepresentation(int index) {
3956 return index == 0 4014 return index == 0
3957 ? Representation::Tagged() 4015 ? Representation::Tagged()
3958 : Representation::Integer32(); 4016 : Representation::Integer32();
3959 } 4017 }
4018 virtual HType CalculateInferredType();
3960 4019
3961 HValue* context() { return OperandAt(0); } 4020 HValue* context() { return OperandAt(0); }
3962 HValue* value() { return OperandAt(1); } 4021 HValue* value() { return OperandAt(1); }
3963 4022
3964 virtual bool DataEquals(HValue* other) { return true; } 4023 virtual bool DataEquals(HValue* other) { return true; }
3965 4024
3966 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 4025 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
3967 }; 4026 };
3968 4027
3969 4028
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4027 4086
4028 HValue* context() { return OperandAt(0); } 4087 HValue* context() { return OperandAt(0); }
4029 Handle<FixedArray> constant_elements() const { return constant_elements_; } 4088 Handle<FixedArray> constant_elements() const { return constant_elements_; }
4030 int length() const { return length_; } 4089 int length() const { return length_; }
4031 4090
4032 bool IsCopyOnWrite() const; 4091 bool IsCopyOnWrite() const;
4033 4092
4034 virtual Representation RequiredInputRepresentation(int index) { 4093 virtual Representation RequiredInputRepresentation(int index) {
4035 return Representation::Tagged(); 4094 return Representation::Tagged();
4036 } 4095 }
4096 virtual HType CalculateInferredType();
4037 4097
4038 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) 4098 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral)
4039 4099
4040 private: 4100 private:
4041 int length_; 4101 int length_;
4042 Handle<FixedArray> constant_elements_; 4102 Handle<FixedArray> constant_elements_;
4043 }; 4103 };
4044 4104
4045 4105
4046 class HObjectLiteral: public HMaterializedLiteral<1> { 4106 class HObjectLiteral: public HMaterializedLiteral<1> {
(...skipping 14 matching lines...) Expand all
4061 HValue* context() { return OperandAt(0); } 4121 HValue* context() { return OperandAt(0); }
4062 Handle<FixedArray> constant_properties() const { 4122 Handle<FixedArray> constant_properties() const {
4063 return constant_properties_; 4123 return constant_properties_;
4064 } 4124 }
4065 bool fast_elements() const { return fast_elements_; } 4125 bool fast_elements() const { return fast_elements_; }
4066 bool has_function() const { return has_function_; } 4126 bool has_function() const { return has_function_; }
4067 4127
4068 virtual Representation RequiredInputRepresentation(int index) { 4128 virtual Representation RequiredInputRepresentation(int index) {
4069 return Representation::Tagged(); 4129 return Representation::Tagged();
4070 } 4130 }
4131 virtual HType CalculateInferredType();
4071 4132
4072 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) 4133 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral)
4073 4134
4074 private: 4135 private:
4075 Handle<FixedArray> constant_properties_; 4136 Handle<FixedArray> constant_properties_;
4076 bool fast_elements_; 4137 bool fast_elements_;
4077 bool has_function_; 4138 bool has_function_;
4078 }; 4139 };
4079 4140
4080 4141
4081 class HRegExpLiteral: public HMaterializedLiteral<1> { 4142 class HRegExpLiteral: public HMaterializedLiteral<1> {
4082 public: 4143 public:
4083 HRegExpLiteral(HValue* context, 4144 HRegExpLiteral(HValue* context,
4084 Handle<String> pattern, 4145 Handle<String> pattern,
4085 Handle<String> flags, 4146 Handle<String> flags,
4086 int literal_index) 4147 int literal_index)
4087 : HMaterializedLiteral<1>(literal_index, 0), 4148 : HMaterializedLiteral<1>(literal_index, 0),
4088 pattern_(pattern), 4149 pattern_(pattern),
4089 flags_(flags) { 4150 flags_(flags) {
4090 SetOperandAt(0, context); 4151 SetOperandAt(0, context);
4091 } 4152 }
4092 4153
4093 HValue* context() { return OperandAt(0); } 4154 HValue* context() { return OperandAt(0); }
4094 Handle<String> pattern() { return pattern_; } 4155 Handle<String> pattern() { return pattern_; }
4095 Handle<String> flags() { return flags_; } 4156 Handle<String> flags() { return flags_; }
4096 4157
4097 virtual Representation RequiredInputRepresentation(int index) { 4158 virtual Representation RequiredInputRepresentation(int index) {
4098 return Representation::Tagged(); 4159 return Representation::Tagged();
4099 } 4160 }
4161 virtual HType CalculateInferredType();
4100 4162
4101 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) 4163 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
4102 4164
4103 private: 4165 private:
4104 Handle<String> pattern_; 4166 Handle<String> pattern_;
4105 Handle<String> flags_; 4167 Handle<String> flags_;
4106 }; 4168 };
4107 4169
4108 4170
4109 class HFunctionLiteral: public HTemplateInstruction<1> { 4171 class HFunctionLiteral: public HTemplateInstruction<1> {
4110 public: 4172 public:
4111 HFunctionLiteral(HValue* context, 4173 HFunctionLiteral(HValue* context,
4112 Handle<SharedFunctionInfo> shared, 4174 Handle<SharedFunctionInfo> shared,
4113 bool pretenure) 4175 bool pretenure)
4114 : shared_info_(shared), pretenure_(pretenure) { 4176 : shared_info_(shared), pretenure_(pretenure) {
4115 SetOperandAt(0, context); 4177 SetOperandAt(0, context);
4116 set_representation(Representation::Tagged()); 4178 set_representation(Representation::Tagged());
4117 } 4179 }
4118 4180
4119 HValue* context() { return OperandAt(0); } 4181 HValue* context() { return OperandAt(0); }
4120 4182
4121 virtual Representation RequiredInputRepresentation(int index) { 4183 virtual Representation RequiredInputRepresentation(int index) {
4122 return Representation::Tagged(); 4184 return Representation::Tagged();
4123 } 4185 }
4186 virtual HType CalculateInferredType();
4124 4187
4125 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 4188 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
4126 4189
4127 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 4190 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
4128 bool pretenure() const { return pretenure_; } 4191 bool pretenure() const { return pretenure_; }
4129 4192
4130 private: 4193 private:
4131 Handle<SharedFunctionInfo> shared_info_; 4194 Handle<SharedFunctionInfo> shared_info_;
4132 bool pretenure_; 4195 bool pretenure_;
4133 }; 4196 };
4134 4197
4135 4198
4136 class HTypeof: public HTemplateInstruction<2> { 4199 class HTypeof: public HTemplateInstruction<2> {
4137 public: 4200 public:
4138 explicit HTypeof(HValue* context, HValue* value) { 4201 explicit HTypeof(HValue* context, HValue* value) {
4139 SetOperandAt(0, context); 4202 SetOperandAt(0, context);
4140 SetOperandAt(1, value); 4203 SetOperandAt(1, value);
4141 set_representation(Representation::Tagged()); 4204 set_representation(Representation::Tagged());
4142 } 4205 }
4143 4206
4144 HValue* context() { return OperandAt(0); } 4207 HValue* context() { return OperandAt(0); }
4145 HValue* value() { return OperandAt(1); } 4208 HValue* value() { return OperandAt(1); }
4146 4209
4210 virtual HValue* Canonicalize();
4147 virtual void PrintDataTo(StringStream* stream); 4211 virtual void PrintDataTo(StringStream* stream);
4148 4212
4149 virtual Representation RequiredInputRepresentation(int index) { 4213 virtual Representation RequiredInputRepresentation(int index) {
4150 return Representation::Tagged(); 4214 return Representation::Tagged();
4151 } 4215 }
4152 4216
4153 DECLARE_CONCRETE_INSTRUCTION(Typeof) 4217 DECLARE_CONCRETE_INSTRUCTION(Typeof)
4154 }; 4218 };
4155 4219
4156 4220
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 4297
4234 DECLARE_CONCRETE_INSTRUCTION(In) 4298 DECLARE_CONCRETE_INSTRUCTION(In)
4235 }; 4299 };
4236 4300
4237 #undef DECLARE_INSTRUCTION 4301 #undef DECLARE_INSTRUCTION
4238 #undef DECLARE_CONCRETE_INSTRUCTION 4302 #undef DECLARE_CONCRETE_INSTRUCTION
4239 4303
4240 } } // namespace v8::internal 4304 } } // namespace v8::internal
4241 4305
4242 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4306 #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