OLD | NEW |
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 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 stream->Add(" "); | 2164 stream->Add(" "); |
2165 dependency()->PrintNameTo(stream); | 2165 dependency()->PrintNameTo(stream); |
2166 } | 2166 } |
2167 | 2167 |
2168 if (RequiresHoleCheck()) { | 2168 if (RequiresHoleCheck()) { |
2169 stream->Add(" check_hole"); | 2169 stream->Add(" check_hole"); |
2170 } | 2170 } |
2171 } | 2171 } |
2172 | 2172 |
2173 | 2173 |
| 2174 bool HLoadKeyed::UsesMustHandleHole() const { |
| 2175 if (IsFastPackedElementsKind(elements_kind())) { |
| 2176 return false; |
| 2177 } |
| 2178 |
| 2179 if (hole_mode() == ALLOW_RETURN_HOLE) return true; |
| 2180 |
| 2181 if (IsFastDoubleElementsKind(elements_kind())) { |
| 2182 return false; |
| 2183 } |
| 2184 |
| 2185 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { |
| 2186 HValue* use = it.value(); |
| 2187 if (!use->IsChange()) { |
| 2188 return false; |
| 2189 } |
| 2190 } |
| 2191 |
| 2192 return true; |
| 2193 } |
| 2194 |
| 2195 |
2174 bool HLoadKeyed::RequiresHoleCheck() const { | 2196 bool HLoadKeyed::RequiresHoleCheck() const { |
2175 if (IsFastPackedElementsKind(elements_kind())) { | 2197 if (IsFastPackedElementsKind(elements_kind())) { |
2176 return false; | 2198 return false; |
2177 } | 2199 } |
2178 | 2200 |
2179 if (IsFastDoubleElementsKind(elements_kind())) { | 2201 return !UsesMustHandleHole(); |
2180 return true; | |
2181 } | |
2182 | |
2183 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | |
2184 HValue* use = it.value(); | |
2185 if (!use->IsChange()) { | |
2186 return true; | |
2187 } | |
2188 } | |
2189 | |
2190 return false; | |
2191 } | 2202 } |
2192 | 2203 |
2193 | 2204 |
2194 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { | 2205 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
2195 object()->PrintNameTo(stream); | 2206 object()->PrintNameTo(stream); |
2196 stream->Add("["); | 2207 stream->Add("["); |
2197 key()->PrintNameTo(stream); | 2208 key()->PrintNameTo(stream); |
2198 stream->Add("]"); | 2209 stream->Add("]"); |
2199 } | 2210 } |
2200 | 2211 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 HType HStringCharFromCode::CalculateInferredType() { | 2465 HType HStringCharFromCode::CalculateInferredType() { |
2455 return HType::String(); | 2466 return HType::String(); |
2456 } | 2467 } |
2457 | 2468 |
2458 | 2469 |
2459 HType HAllocateObject::CalculateInferredType() { | 2470 HType HAllocateObject::CalculateInferredType() { |
2460 return HType::JSObject(); | 2471 return HType::JSObject(); |
2461 } | 2472 } |
2462 | 2473 |
2463 | 2474 |
| 2475 HType HAllocate::CalculateInferredType() { |
| 2476 return type_; |
| 2477 } |
| 2478 |
| 2479 |
2464 HType HFastLiteral::CalculateInferredType() { | 2480 HType HFastLiteral::CalculateInferredType() { |
2465 // TODO(mstarzinger): Be smarter, could also be JSArray here. | 2481 // TODO(mstarzinger): Be smarter, could also be JSArray here. |
2466 return HType::JSObject(); | 2482 return HType::JSObject(); |
2467 } | 2483 } |
2468 | 2484 |
2469 | 2485 |
2470 HType HArrayLiteral::CalculateInferredType() { | 2486 HType HArrayLiteral::CalculateInferredType() { |
2471 return HType::JSArray(); | 2487 return HType::JSArray(); |
2472 } | 2488 } |
2473 | 2489 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 // Propagate to the left argument. If the left argument cannot be -0, then | 2591 // Propagate to the left argument. If the left argument cannot be -0, then |
2576 // the result of the sub operation cannot be either. | 2592 // the result of the sub operation cannot be either. |
2577 if (range() == NULL || range()->CanBeMinusZero()) { | 2593 if (range() == NULL || range()->CanBeMinusZero()) { |
2578 return left(); | 2594 return left(); |
2579 } | 2595 } |
2580 return NULL; | 2596 return NULL; |
2581 } | 2597 } |
2582 | 2598 |
2583 | 2599 |
2584 bool HStoreKeyed::NeedsCanonicalization() { | 2600 bool HStoreKeyed::NeedsCanonicalization() { |
2585 // If value is an integer or comes from the result of a keyed load | 2601 // If value is an integer or smi or comes from the result of a keyed load or |
2586 // then it will be a non-hole value: no need for canonicalization. | 2602 // constant then it is either be a non-hole value or in the case of a constant |
2587 if (value()->IsLoadKeyed() || | 2603 // the hole is only being stored explicitly: no need for canonicalization. |
2588 (value()->IsChange() && HChange::cast(value())->from().IsInteger32())) { | 2604 if (value()->IsLoadKeyed() || value()->IsConstant()) { |
2589 return false; | 2605 return false; |
2590 } | 2606 } |
| 2607 |
| 2608 if (value()->IsChange()) { |
| 2609 if (HChange::cast(value())->from().IsInteger32()) { |
| 2610 return false; |
| 2611 } |
| 2612 if (HChange::cast(value())->value()->type().IsSmi()) { |
| 2613 return false; |
| 2614 } |
| 2615 } |
2591 return true; | 2616 return true; |
2592 } | 2617 } |
2593 | 2618 |
2594 | 2619 |
2595 #define H_CONSTANT_INT32(val) \ | 2620 #define H_CONSTANT_INT32(val) \ |
2596 new(zone) HConstant(FACTORY->NewNumberFromInt(val, TENURED), \ | 2621 new(zone) HConstant(FACTORY->NewNumberFromInt(val, TENURED), \ |
2597 Representation::Integer32()) | 2622 Representation::Integer32()) |
2598 #define H_CONSTANT_DOUBLE(val) \ | 2623 #define H_CONSTANT_DOUBLE(val) \ |
2599 new(zone) HConstant(FACTORY->NewNumber(val, TENURED), \ | 2624 new(zone) HConstant(FACTORY->NewNumber(val, TENURED), \ |
2600 Representation::Double()) | 2625 Representation::Double()) |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 | 2934 |
2910 | 2935 |
2911 void HCheckFunction::Verify() { | 2936 void HCheckFunction::Verify() { |
2912 HInstruction::Verify(); | 2937 HInstruction::Verify(); |
2913 ASSERT(HasNoUses()); | 2938 ASSERT(HasNoUses()); |
2914 } | 2939 } |
2915 | 2940 |
2916 #endif | 2941 #endif |
2917 | 2942 |
2918 } } // namespace v8::internal | 2943 } } // namespace v8::internal |
OLD | NEW |