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/hydrogen-instructions.h" | 5 #include "src/hydrogen-instructions.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/double.h" | 8 #include "src/double.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 case HValue::kEnvironmentMarker: | 806 case HValue::kEnvironmentMarker: |
807 case HValue::kForceRepresentation: | 807 case HValue::kForceRepresentation: |
808 case HValue::kGetCachedArrayIndex: | 808 case HValue::kGetCachedArrayIndex: |
809 case HValue::kGoto: | 809 case HValue::kGoto: |
810 case HValue::kHasCachedArrayIndexAndBranch: | 810 case HValue::kHasCachedArrayIndexAndBranch: |
811 case HValue::kHasInstanceTypeAndBranch: | 811 case HValue::kHasInstanceTypeAndBranch: |
812 case HValue::kInnerAllocatedObject: | 812 case HValue::kInnerAllocatedObject: |
813 case HValue::kInstanceOf: | 813 case HValue::kInstanceOf: |
814 case HValue::kIsConstructCallAndBranch: | 814 case HValue::kIsConstructCallAndBranch: |
815 case HValue::kHasInPrototypeChainAndBranch: | 815 case HValue::kHasInPrototypeChainAndBranch: |
816 case HValue::kIsObjectAndBranch: | |
817 case HValue::kIsSmiAndBranch: | 816 case HValue::kIsSmiAndBranch: |
818 case HValue::kIsStringAndBranch: | 817 case HValue::kIsStringAndBranch: |
819 case HValue::kIsUndetectableAndBranch: | 818 case HValue::kIsUndetectableAndBranch: |
820 case HValue::kLeaveInlined: | 819 case HValue::kLeaveInlined: |
821 case HValue::kLoadFieldByIndex: | 820 case HValue::kLoadFieldByIndex: |
822 case HValue::kLoadGlobalGeneric: | 821 case HValue::kLoadGlobalGeneric: |
823 case HValue::kLoadGlobalViaContext: | 822 case HValue::kLoadGlobalViaContext: |
824 case HValue::kLoadNamedField: | 823 case HValue::kLoadNamedField: |
825 case HValue::kLoadNamedGeneric: | 824 case HValue::kLoadNamedGeneric: |
826 case HValue::kLoadRoot: | 825 case HValue::kLoadRoot: |
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3266 if (FLAG_fold_constants && left()->IsConstant() && right()->IsConstant()) { | 3265 if (FLAG_fold_constants && left()->IsConstant() && right()->IsConstant()) { |
3267 *block = HConstant::cast(left())->DataEquals(HConstant::cast(right())) | 3266 *block = HConstant::cast(left())->DataEquals(HConstant::cast(right())) |
3268 ? FirstSuccessor() : SecondSuccessor(); | 3267 ? FirstSuccessor() : SecondSuccessor(); |
3269 return true; | 3268 return true; |
3270 } | 3269 } |
3271 *block = NULL; | 3270 *block = NULL; |
3272 return false; | 3271 return false; |
3273 } | 3272 } |
3274 | 3273 |
3275 | 3274 |
3276 bool ConstantIsObject(HConstant* constant, Isolate* isolate) { | |
3277 if (constant->HasNumberValue()) return false; | |
3278 if (constant->GetUnique().IsKnownGlobal(isolate->heap()->null_value())) { | |
3279 return true; | |
3280 } | |
3281 if (constant->IsUndetectable()) return false; | |
3282 InstanceType type = constant->GetInstanceType(); | |
3283 return (FIRST_NONCALLABLE_SPEC_OBJECT_TYPE <= type) && | |
3284 (type <= LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
3285 } | |
3286 | |
3287 | |
3288 bool HIsObjectAndBranch::KnownSuccessorBlock(HBasicBlock** block) { | |
3289 if (FLAG_fold_constants && value()->IsConstant()) { | |
3290 *block = ConstantIsObject(HConstant::cast(value()), isolate()) | |
3291 ? FirstSuccessor() : SecondSuccessor(); | |
3292 return true; | |
3293 } | |
3294 *block = NULL; | |
3295 return false; | |
3296 } | |
3297 | |
3298 | |
3299 bool HIsStringAndBranch::KnownSuccessorBlock(HBasicBlock** block) { | 3275 bool HIsStringAndBranch::KnownSuccessorBlock(HBasicBlock** block) { |
3300 if (known_successor_index() != kNoKnownSuccessorIndex) { | 3276 if (known_successor_index() != kNoKnownSuccessorIndex) { |
3301 *block = SuccessorAt(known_successor_index()); | 3277 *block = SuccessorAt(known_successor_index()); |
3302 return true; | 3278 return true; |
3303 } | 3279 } |
3304 if (FLAG_fold_constants && value()->IsConstant()) { | 3280 if (FLAG_fold_constants && value()->IsConstant()) { |
3305 *block = HConstant::cast(value())->HasStringValue() | 3281 *block = HConstant::cast(value())->HasStringValue() |
3306 ? FirstSuccessor() : SecondSuccessor(); | 3282 ? FirstSuccessor() : SecondSuccessor(); |
3307 return true; | 3283 return true; |
3308 } | 3284 } |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4744 case HObjectAccess::kExternalMemory: | 4720 case HObjectAccess::kExternalMemory: |
4745 os << "[external-memory]"; | 4721 os << "[external-memory]"; |
4746 break; | 4722 break; |
4747 } | 4723 } |
4748 | 4724 |
4749 return os << "@" << access.offset(); | 4725 return os << "@" << access.offset(); |
4750 } | 4726 } |
4751 | 4727 |
4752 } // namespace internal | 4728 } // namespace internal |
4753 } // namespace v8 | 4729 } // namespace v8 |
OLD | NEW |