OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/hydrogen-instructions.h" | 5 #include "src/crankshaft/hydrogen-instructions.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/ieee754.h" | 8 #include "src/base/ieee754.h" |
9 #include "src/base/safe_math.h" | 9 #include "src/base/safe_math.h" |
10 #include "src/crankshaft/hydrogen-infer-representation.h" | 10 #include "src/crankshaft/hydrogen-infer-representation.h" |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 case HValue::kClampToUint8: | 839 case HValue::kClampToUint8: |
840 case HValue::kDeoptimize: | 840 case HValue::kDeoptimize: |
841 case HValue::kDiv: | 841 case HValue::kDiv: |
842 case HValue::kForInCacheArray: | 842 case HValue::kForInCacheArray: |
843 case HValue::kForInPrepareMap: | 843 case HValue::kForInPrepareMap: |
844 case HValue::kHasInPrototypeChainAndBranch: | 844 case HValue::kHasInPrototypeChainAndBranch: |
845 case HValue::kInvokeFunction: | 845 case HValue::kInvokeFunction: |
846 case HValue::kLoadContextSlot: | 846 case HValue::kLoadContextSlot: |
847 case HValue::kLoadFunctionPrototype: | 847 case HValue::kLoadFunctionPrototype: |
848 case HValue::kLoadKeyed: | 848 case HValue::kLoadKeyed: |
849 case HValue::kLoadKeyedGeneric: | |
850 case HValue::kMathFloorOfDiv: | 849 case HValue::kMathFloorOfDiv: |
851 case HValue::kMaybeGrowElements: | 850 case HValue::kMaybeGrowElements: |
852 case HValue::kMod: | 851 case HValue::kMod: |
853 case HValue::kMul: | 852 case HValue::kMul: |
854 case HValue::kOsrEntry: | 853 case HValue::kOsrEntry: |
855 case HValue::kPower: | 854 case HValue::kPower: |
856 case HValue::kPrologue: | 855 case HValue::kPrologue: |
857 case HValue::kRor: | 856 case HValue::kRor: |
858 case HValue::kSar: | 857 case HValue::kSar: |
859 case HValue::kSeqStringSetChar: | 858 case HValue::kSeqStringSetChar: |
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2965 return false; | 2964 return false; |
2966 } | 2965 } |
2967 | 2966 |
2968 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { | 2967 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { |
2969 return false; | 2968 return false; |
2970 } | 2969 } |
2971 | 2970 |
2972 return !UsesMustHandleHole(); | 2971 return !UsesMustHandleHole(); |
2973 } | 2972 } |
2974 | 2973 |
2974 HValue* HCallWithDescriptor::Canonicalize() { | |
Igor Sheludko
2016/10/12 11:07:38
Non-trivial change.
| |
2975 if (kind() != Code::KEYED_LOAD_IC) return this; | |
2975 | 2976 |
2976 std::ostream& HLoadKeyedGeneric::PrintDataTo( | |
2977 std::ostream& os) const { // NOLINT | |
2978 return os << NameOf(object()) << "[" << NameOf(key()) << "]"; | |
2979 } | |
2980 | |
2981 | |
2982 HValue* HLoadKeyedGeneric::Canonicalize() { | |
2983 // Recognize generic keyed loads that use property name generated | 2977 // Recognize generic keyed loads that use property name generated |
2984 // by for-in statement as a key and rewrite them into fast property load | 2978 // by for-in statement as a key and rewrite them into fast property load |
2985 // by index. | 2979 // by index. |
2986 if (key()->IsLoadKeyed()) { | 2980 typedef LoadWithVectorDescriptor Descriptor; |
2987 HLoadKeyed* key_load = HLoadKeyed::cast(key()); | 2981 HValue* key = parameter(Descriptor::kName); |
2982 if (key->IsLoadKeyed()) { | |
2983 HLoadKeyed* key_load = HLoadKeyed::cast(key); | |
2988 if (key_load->elements()->IsForInCacheArray()) { | 2984 if (key_load->elements()->IsForInCacheArray()) { |
2989 HForInCacheArray* names_cache = | 2985 HForInCacheArray* names_cache = |
2990 HForInCacheArray::cast(key_load->elements()); | 2986 HForInCacheArray::cast(key_load->elements()); |
2991 | 2987 |
2992 if (names_cache->enumerable() == object()) { | 2988 HValue* object = parameter(Descriptor::kReceiver); |
2989 if (names_cache->enumerable() == object) { | |
2993 HForInCacheArray* index_cache = | 2990 HForInCacheArray* index_cache = |
2994 names_cache->index_cache(); | 2991 names_cache->index_cache(); |
2995 HCheckMapValue* map_check = HCheckMapValue::New( | 2992 HCheckMapValue* map_check = HCheckMapValue::New( |
2996 block()->graph()->isolate(), block()->graph()->zone(), | 2993 block()->graph()->isolate(), block()->graph()->zone(), |
2997 block()->graph()->GetInvalidContext(), object(), | 2994 block()->graph()->GetInvalidContext(), object, names_cache->map()); |
2998 names_cache->map()); | |
2999 HInstruction* index = HLoadKeyed::New( | 2995 HInstruction* index = HLoadKeyed::New( |
3000 block()->graph()->isolate(), block()->graph()->zone(), | 2996 block()->graph()->isolate(), block()->graph()->zone(), |
3001 block()->graph()->GetInvalidContext(), index_cache, key_load->key(), | 2997 block()->graph()->GetInvalidContext(), index_cache, key_load->key(), |
3002 key_load->key(), nullptr, key_load->elements_kind()); | 2998 key_load->key(), nullptr, key_load->elements_kind()); |
3003 map_check->InsertBefore(this); | 2999 map_check->InsertBefore(this); |
3004 index->InsertBefore(this); | 3000 index->InsertBefore(this); |
3005 return Prepend(new(block()->zone()) HLoadFieldByIndex( | 3001 return Prepend(new (block()->zone()) HLoadFieldByIndex(object, index)); |
3006 object(), index)); | |
3007 } | 3002 } |
3008 } | 3003 } |
3009 } | 3004 } |
3010 | |
3011 return this; | 3005 return this; |
3012 } | 3006 } |
3013 | 3007 |
3014 | |
3015 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT | 3008 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT |
3016 os << NameOf(object()) << access_ << " = " << NameOf(value()); | 3009 os << NameOf(object()) << access_ << " = " << NameOf(value()); |
3017 if (NeedsWriteBarrier()) os << " (write-barrier)"; | 3010 if (NeedsWriteBarrier()) os << " (write-barrier)"; |
3018 if (has_transition()) os << " (transition map " << *transition_map() << ")"; | 3011 if (has_transition()) os << " (transition map " << *transition_map() << ")"; |
3019 return os; | 3012 return os; |
3020 } | 3013 } |
3021 | 3014 |
3022 | 3015 |
3023 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT | 3016 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT |
3024 if (!is_fixed_typed_array()) { | 3017 if (!is_fixed_typed_array()) { |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4023 case HObjectAccess::kExternalMemory: | 4016 case HObjectAccess::kExternalMemory: |
4024 os << "[external-memory]"; | 4017 os << "[external-memory]"; |
4025 break; | 4018 break; |
4026 } | 4019 } |
4027 | 4020 |
4028 return os << "@" << access.offset(); | 4021 return os << "@" << access.offset(); |
4029 } | 4022 } |
4030 | 4023 |
4031 } // namespace internal | 4024 } // namespace internal |
4032 } // namespace v8 | 4025 } // namespace v8 |
OLD | NEW |