| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 case HValue::kClampToUint8: | 855 case HValue::kClampToUint8: |
| 856 case HValue::kDeoptimize: | 856 case HValue::kDeoptimize: |
| 857 case HValue::kDiv: | 857 case HValue::kDiv: |
| 858 case HValue::kForInCacheArray: | 858 case HValue::kForInCacheArray: |
| 859 case HValue::kForInPrepareMap: | 859 case HValue::kForInPrepareMap: |
| 860 case HValue::kHasInPrototypeChainAndBranch: | 860 case HValue::kHasInPrototypeChainAndBranch: |
| 861 case HValue::kInvokeFunction: | 861 case HValue::kInvokeFunction: |
| 862 case HValue::kLoadContextSlot: | 862 case HValue::kLoadContextSlot: |
| 863 case HValue::kLoadFunctionPrototype: | 863 case HValue::kLoadFunctionPrototype: |
| 864 case HValue::kLoadKeyed: | 864 case HValue::kLoadKeyed: |
| 865 case HValue::kLoadKeyedGeneric: | |
| 866 case HValue::kMathFloorOfDiv: | 865 case HValue::kMathFloorOfDiv: |
| 867 case HValue::kMaybeGrowElements: | 866 case HValue::kMaybeGrowElements: |
| 868 case HValue::kMod: | 867 case HValue::kMod: |
| 869 case HValue::kMul: | 868 case HValue::kMul: |
| 870 case HValue::kOsrEntry: | 869 case HValue::kOsrEntry: |
| 871 case HValue::kPower: | 870 case HValue::kPower: |
| 872 case HValue::kPrologue: | 871 case HValue::kPrologue: |
| 873 case HValue::kRor: | 872 case HValue::kRor: |
| 874 case HValue::kSar: | 873 case HValue::kSar: |
| 875 case HValue::kSeqStringSetChar: | 874 case HValue::kSeqStringSetChar: |
| (...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 return false; | 2980 return false; |
| 2982 } | 2981 } |
| 2983 | 2982 |
| 2984 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { | 2983 if (hole_mode() == CONVERT_HOLE_TO_UNDEFINED) { |
| 2985 return false; | 2984 return false; |
| 2986 } | 2985 } |
| 2987 | 2986 |
| 2988 return !UsesMustHandleHole(); | 2987 return !UsesMustHandleHole(); |
| 2989 } | 2988 } |
| 2990 | 2989 |
| 2990 HValue* HCallWithDescriptor::Canonicalize() { |
| 2991 if (kind() != Code::KEYED_LOAD_IC) return this; |
| 2991 | 2992 |
| 2992 std::ostream& HLoadKeyedGeneric::PrintDataTo( | |
| 2993 std::ostream& os) const { // NOLINT | |
| 2994 return os << NameOf(object()) << "[" << NameOf(key()) << "]"; | |
| 2995 } | |
| 2996 | |
| 2997 | |
| 2998 HValue* HLoadKeyedGeneric::Canonicalize() { | |
| 2999 // Recognize generic keyed loads that use property name generated | 2993 // Recognize generic keyed loads that use property name generated |
| 3000 // by for-in statement as a key and rewrite them into fast property load | 2994 // by for-in statement as a key and rewrite them into fast property load |
| 3001 // by index. | 2995 // by index. |
| 3002 if (key()->IsLoadKeyed()) { | 2996 typedef LoadWithVectorDescriptor Descriptor; |
| 3003 HLoadKeyed* key_load = HLoadKeyed::cast(key()); | 2997 HValue* key = parameter(Descriptor::kName); |
| 2998 if (key->IsLoadKeyed()) { |
| 2999 HLoadKeyed* key_load = HLoadKeyed::cast(key); |
| 3004 if (key_load->elements()->IsForInCacheArray()) { | 3000 if (key_load->elements()->IsForInCacheArray()) { |
| 3005 HForInCacheArray* names_cache = | 3001 HForInCacheArray* names_cache = |
| 3006 HForInCacheArray::cast(key_load->elements()); | 3002 HForInCacheArray::cast(key_load->elements()); |
| 3007 | 3003 |
| 3008 if (names_cache->enumerable() == object()) { | 3004 HValue* object = parameter(Descriptor::kReceiver); |
| 3005 if (names_cache->enumerable() == object) { |
| 3009 HForInCacheArray* index_cache = | 3006 HForInCacheArray* index_cache = |
| 3010 names_cache->index_cache(); | 3007 names_cache->index_cache(); |
| 3011 HCheckMapValue* map_check = HCheckMapValue::New( | 3008 HCheckMapValue* map_check = HCheckMapValue::New( |
| 3012 block()->graph()->isolate(), block()->graph()->zone(), | 3009 block()->graph()->isolate(), block()->graph()->zone(), |
| 3013 block()->graph()->GetInvalidContext(), object(), | 3010 block()->graph()->GetInvalidContext(), object, names_cache->map()); |
| 3014 names_cache->map()); | |
| 3015 HInstruction* index = HLoadKeyed::New( | 3011 HInstruction* index = HLoadKeyed::New( |
| 3016 block()->graph()->isolate(), block()->graph()->zone(), | 3012 block()->graph()->isolate(), block()->graph()->zone(), |
| 3017 block()->graph()->GetInvalidContext(), index_cache, key_load->key(), | 3013 block()->graph()->GetInvalidContext(), index_cache, key_load->key(), |
| 3018 key_load->key(), nullptr, key_load->elements_kind()); | 3014 key_load->key(), nullptr, key_load->elements_kind()); |
| 3019 map_check->InsertBefore(this); | 3015 map_check->InsertBefore(this); |
| 3020 index->InsertBefore(this); | 3016 index->InsertBefore(this); |
| 3021 return Prepend(new(block()->zone()) HLoadFieldByIndex( | 3017 return Prepend(new (block()->zone()) HLoadFieldByIndex(object, index)); |
| 3022 object(), index)); | |
| 3023 } | 3018 } |
| 3024 } | 3019 } |
| 3025 } | 3020 } |
| 3026 | |
| 3027 return this; | 3021 return this; |
| 3028 } | 3022 } |
| 3029 | 3023 |
| 3030 | |
| 3031 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT | 3024 std::ostream& HStoreNamedField::PrintDataTo(std::ostream& os) const { // NOLINT |
| 3032 os << NameOf(object()) << access_ << " = " << NameOf(value()); | 3025 os << NameOf(object()) << access_ << " = " << NameOf(value()); |
| 3033 if (NeedsWriteBarrier()) os << " (write-barrier)"; | 3026 if (NeedsWriteBarrier()) os << " (write-barrier)"; |
| 3034 if (has_transition()) os << " (transition map " << *transition_map() << ")"; | 3027 if (has_transition()) os << " (transition map " << *transition_map() << ")"; |
| 3035 return os; | 3028 return os; |
| 3036 } | 3029 } |
| 3037 | 3030 |
| 3038 | 3031 |
| 3039 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT | 3032 std::ostream& HStoreKeyed::PrintDataTo(std::ostream& os) const { // NOLINT |
| 3040 if (!is_fixed_typed_array()) { | 3033 if (!is_fixed_typed_array()) { |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4039 case HObjectAccess::kExternalMemory: | 4032 case HObjectAccess::kExternalMemory: |
| 4040 os << "[external-memory]"; | 4033 os << "[external-memory]"; |
| 4041 break; | 4034 break; |
| 4042 } | 4035 } |
| 4043 | 4036 |
| 4044 return os << "@" << access.offset(); | 4037 return os << "@" << access.offset(); |
| 4045 } | 4038 } |
| 4046 | 4039 |
| 4047 } // namespace internal | 4040 } // namespace internal |
| 4048 } // namespace v8 | 4041 } // namespace v8 |
| OLD | NEW |