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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 if (has_int32_value_) { | 2568 if (has_int32_value_) { |
2569 res = new(zone) HConstant(int32_value_, | 2569 res = new(zone) HConstant(int32_value_, |
2570 Representation::Integer32(), | 2570 Representation::Integer32(), |
2571 is_not_in_new_space_, | 2571 is_not_in_new_space_, |
2572 handle_); | 2572 handle_); |
2573 } else if (has_double_value_) { | 2573 } else if (has_double_value_) { |
2574 res = new(zone) HConstant(DoubleToInt32(double_value_), | 2574 res = new(zone) HConstant(DoubleToInt32(double_value_), |
2575 Representation::Integer32(), | 2575 Representation::Integer32(), |
2576 is_not_in_new_space_, | 2576 is_not_in_new_space_, |
2577 handle_); | 2577 handle_); |
2578 } else { | |
2579 ASSERT(!HasNumberValue()); | |
2580 Maybe<HConstant*> number = CopyToTruncatedNumber(zone); | |
2581 if (number.has_value) return number.value->CopyToTruncatedInt32(zone); | |
2582 } | 2578 } |
2583 return Maybe<HConstant*>(res != NULL, res); | 2579 return Maybe<HConstant*>(res != NULL, res); |
2584 } | 2580 } |
2585 | 2581 |
2586 | 2582 |
2587 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) { | 2583 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) { |
2588 HConstant* res = NULL; | 2584 HConstant* res = NULL; |
2589 Handle<Object> handle = this->handle(zone->isolate()); | 2585 Handle<Object> handle = this->handle(zone->isolate()); |
2590 if (handle->IsBoolean()) { | 2586 if (handle->IsBoolean()) { |
2591 res = handle->BooleanValue() ? | 2587 res = handle->BooleanValue() ? |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4240 break; | 4236 break; |
4241 case kExternalMemory: | 4237 case kExternalMemory: |
4242 stream->Add("[external-memory]"); | 4238 stream->Add("[external-memory]"); |
4243 break; | 4239 break; |
4244 } | 4240 } |
4245 | 4241 |
4246 stream->Add("@%d", offset()); | 4242 stream->Add("@%d", offset()); |
4247 } | 4243 } |
4248 | 4244 |
4249 } } // namespace v8::internal | 4245 } } // namespace v8::internal |
OLD | NEW |