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 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2116 stream->Add(" "); | 2116 stream->Add(" "); |
2117 dependency()->PrintNameTo(stream); | 2117 dependency()->PrintNameTo(stream); |
2118 } | 2118 } |
2119 | 2119 |
2120 if (RequiresHoleCheck()) { | 2120 if (RequiresHoleCheck()) { |
2121 stream->Add(" check_hole"); | 2121 stream->Add(" check_hole"); |
2122 } | 2122 } |
2123 } | 2123 } |
2124 | 2124 |
2125 | 2125 |
2126 bool HLoadKeyed::CanReturnHole() const { | |
Michael Starzinger
2013/02/01 13:15:08
This name is kind of disambiguate, it took me a wh
danno
2013/02/02 17:56:21
Done.
| |
2127 if (IsFastPackedElementsKind(elements_kind())) { | |
2128 return false; | |
2129 } | |
2130 | |
2131 if (hole_mode() == ALLOW_RETURN_HOLE) return true; | |
2132 | |
2133 if (IsFastDoubleElementsKind(elements_kind())) { | |
2134 return false; | |
2135 } | |
2136 | |
2137 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | |
2138 HValue* use = it.value(); | |
2139 if (!use->IsChange()) { | |
2140 return false; | |
2141 } | |
2142 } | |
2143 | |
2144 return true; | |
2145 } | |
2146 | |
2147 | |
2126 bool HLoadKeyed::RequiresHoleCheck() const { | 2148 bool HLoadKeyed::RequiresHoleCheck() const { |
2127 if (IsFastPackedElementsKind(elements_kind())) { | 2149 if (IsFastPackedElementsKind(elements_kind())) { |
2128 return false; | 2150 return false; |
2129 } | 2151 } |
2130 | 2152 |
2131 if (IsFastDoubleElementsKind(elements_kind())) { | 2153 return !CanReturnHole(); |
2132 return true; | |
2133 } | |
2134 | |
2135 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { | |
2136 HValue* use = it.value(); | |
2137 if (!use->IsChange()) { | |
2138 return true; | |
2139 } | |
2140 } | |
2141 | |
2142 return false; | |
2143 } | 2154 } |
2144 | 2155 |
2145 | 2156 |
2146 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { | 2157 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { |
2147 object()->PrintNameTo(stream); | 2158 object()->PrintNameTo(stream); |
2148 stream->Add("["); | 2159 stream->Add("["); |
2149 key()->PrintNameTo(stream); | 2160 key()->PrintNameTo(stream); |
2150 stream->Add("]"); | 2161 stream->Add("]"); |
2151 } | 2162 } |
2152 | 2163 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2406 HType HStringCharFromCode::CalculateInferredType() { | 2417 HType HStringCharFromCode::CalculateInferredType() { |
2407 return HType::String(); | 2418 return HType::String(); |
2408 } | 2419 } |
2409 | 2420 |
2410 | 2421 |
2411 HType HAllocateObject::CalculateInferredType() { | 2422 HType HAllocateObject::CalculateInferredType() { |
2412 return HType::JSObject(); | 2423 return HType::JSObject(); |
2413 } | 2424 } |
2414 | 2425 |
2415 | 2426 |
2427 HType HAllocate::CalculateInferredType() { | |
2428 return type_; | |
2429 } | |
2430 | |
2431 | |
2416 HType HFastLiteral::CalculateInferredType() { | 2432 HType HFastLiteral::CalculateInferredType() { |
2417 // TODO(mstarzinger): Be smarter, could also be JSArray here. | 2433 // TODO(mstarzinger): Be smarter, could also be JSArray here. |
2418 return HType::JSObject(); | 2434 return HType::JSObject(); |
2419 } | 2435 } |
2420 | 2436 |
2421 | 2437 |
2422 HType HArrayLiteral::CalculateInferredType() { | 2438 HType HArrayLiteral::CalculateInferredType() { |
2423 return HType::JSArray(); | 2439 return HType::JSArray(); |
2424 } | 2440 } |
2425 | 2441 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2527 // Propagate to the left argument. If the left argument cannot be -0, then | 2543 // Propagate to the left argument. If the left argument cannot be -0, then |
2528 // the result of the sub operation cannot be either. | 2544 // the result of the sub operation cannot be either. |
2529 if (range() == NULL || range()->CanBeMinusZero()) { | 2545 if (range() == NULL || range()->CanBeMinusZero()) { |
2530 return left(); | 2546 return left(); |
2531 } | 2547 } |
2532 return NULL; | 2548 return NULL; |
2533 } | 2549 } |
2534 | 2550 |
2535 | 2551 |
2536 bool HStoreKeyed::NeedsCanonicalization() { | 2552 bool HStoreKeyed::NeedsCanonicalization() { |
2537 // If value is an integer or comes from the result of a keyed load | 2553 // If value is an integer or smi or comes from the result of a keyed load or |
2538 // then it will be a non-hole value: no need for canonicalization. | 2554 // constant then it is either be a non-hole value or in the case of a constant |
2539 if (value()->IsLoadKeyed() || | 2555 // the hole is only being stored explicitly: no need for canonicalization. |
2540 (value()->IsChange() && HChange::cast(value())->from().IsInteger32())) { | 2556 if (value()->IsLoadKeyed() || value()->IsConstant()) { |
2541 return false; | 2557 return false; |
2542 } | 2558 } |
2559 | |
2560 if (value()->IsChange()) { | |
2561 if (HChange::cast(value())->from().IsInteger32()) { | |
2562 return false; | |
2563 } | |
2564 if (HChange::cast(value())->value()->type().IsSmi()) { | |
2565 return false; | |
2566 } | |
2567 } | |
2543 return true; | 2568 return true; |
2544 } | 2569 } |
2545 | 2570 |
2546 | 2571 |
2547 #define H_CONSTANT_INT32(val) \ | 2572 #define H_CONSTANT_INT32(val) \ |
2548 new(zone) HConstant(FACTORY->NewNumberFromInt(val, TENURED), \ | 2573 new(zone) HConstant(FACTORY->NewNumberFromInt(val, TENURED), \ |
2549 Representation::Integer32()) | 2574 Representation::Integer32()) |
2550 #define H_CONSTANT_DOUBLE(val) \ | 2575 #define H_CONSTANT_DOUBLE(val) \ |
2551 new(zone) HConstant(FACTORY->NewNumber(val, TENURED), \ | 2576 new(zone) HConstant(FACTORY->NewNumber(val, TENURED), \ |
2552 Representation::Double()) | 2577 Representation::Double()) |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2861 | 2886 |
2862 | 2887 |
2863 void HCheckFunction::Verify() { | 2888 void HCheckFunction::Verify() { |
2864 HInstruction::Verify(); | 2889 HInstruction::Verify(); |
2865 ASSERT(HasNoUses()); | 2890 ASSERT(HasNoUses()); |
2866 } | 2891 } |
2867 | 2892 |
2868 #endif | 2893 #endif |
2869 | 2894 |
2870 } } // namespace v8::internal | 2895 } } // namespace v8::internal |
OLD | NEW |