OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 12817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12828 } | 12828 } |
12829 | 12829 |
12830 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { | 12830 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { |
12831 return Smi::FromInt(static_cast<int>(result)); | 12831 return Smi::FromInt(static_cast<int>(result)); |
12832 } | 12832 } |
12833 ASSERT_NE(NULL, result_double); | 12833 ASSERT_NE(NULL, result_double); |
12834 result_double->set_value(static_cast<double>(result)); | 12834 result_double->set_value(static_cast<double>(result)); |
12835 return result_double; | 12835 return result_double; |
12836 } | 12836 } |
12837 | 12837 |
| 12838 ExternalArrayType JSTypedArray::type() { |
| 12839 switch (elements()->map()->instance_type()) { |
| 12840 case EXTERNAL_BYTE_ARRAY_TYPE: |
| 12841 return kExternalByteArray; |
| 12842 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 12843 return kExternalUnsignedByteArray; |
| 12844 case EXTERNAL_SHORT_ARRAY_TYPE: |
| 12845 return kExternalShortArray; |
| 12846 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 12847 return kExternalUnsignedShortArray; |
| 12848 case EXTERNAL_INT_ARRAY_TYPE: |
| 12849 return kExternalIntArray; |
| 12850 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 12851 return kExternalUnsignedIntArray; |
| 12852 case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 12853 return kExternalFloatArray; |
| 12854 case EXTERNAL_DOUBLE_ARRAY_TYPE: |
| 12855 return kExternalDoubleArray; |
| 12856 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 12857 return kExternalPixelArray; |
| 12858 default: |
| 12859 return static_cast<ExternalArrayType>(-1); |
| 12860 } |
| 12861 } |
| 12862 |
12838 | 12863 |
12839 Object* ExternalPixelArray::SetValue(uint32_t index, Object* value) { | 12864 Object* ExternalPixelArray::SetValue(uint32_t index, Object* value) { |
12840 uint8_t clamped_value = 0; | 12865 uint8_t clamped_value = 0; |
12841 if (index < static_cast<uint32_t>(length())) { | 12866 if (index < static_cast<uint32_t>(length())) { |
12842 if (value->IsSmi()) { | 12867 if (value->IsSmi()) { |
12843 int int_value = Smi::cast(value)->value(); | 12868 int int_value = Smi::cast(value)->value(); |
12844 if (int_value < 0) { | 12869 if (int_value < 0) { |
12845 clamped_value = 0; | 12870 clamped_value = 0; |
12846 } else if (int_value > 255) { | 12871 } else if (int_value > 255) { |
12847 clamped_value = 255; | 12872 clamped_value = 255; |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14517 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14542 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14518 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14543 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14519 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14544 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14520 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14545 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14521 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14546 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14522 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14547 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14523 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14548 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14524 } | 14549 } |
14525 | 14550 |
14526 } } // namespace v8::internal | 14551 } } // namespace v8::internal |
OLD | NEW |