| 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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 isolate(), | 1479 isolate(), |
| 1480 isolate()->heap()->AllocateJSObject(*data_view_fun), | 1480 isolate()->heap()->AllocateJSObject(*data_view_fun), |
| 1481 JSDataView); | 1481 JSDataView); |
| 1482 } | 1482 } |
| 1483 | 1483 |
| 1484 | 1484 |
| 1485 static JSFunction* GetTypedArrayFun(ExternalArrayType type, | 1485 static JSFunction* GetTypedArrayFun(ExternalArrayType type, |
| 1486 Isolate* isolate) { | 1486 Isolate* isolate) { |
| 1487 Context* native_context = isolate->context()->native_context(); | 1487 Context* native_context = isolate->context()->native_context(); |
| 1488 switch (type) { | 1488 switch (type) { |
| 1489 case kExternalUnsignedByteArray: | 1489 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \ |
| 1490 return native_context->uint8_array_fun(); | 1490 case kExternal##Type##Array: \ |
| 1491 return native_context->type##_array_fun(); |
| 1491 | 1492 |
| 1492 case kExternalByteArray: | 1493 TYPED_ARRAYS(TYPED_ARRAY_FUN) |
| 1493 return native_context->int8_array_fun(); | 1494 #undef TYPED_ARRAY_FUN |
| 1494 | |
| 1495 case kExternalUnsignedShortArray: | |
| 1496 return native_context->uint16_array_fun(); | |
| 1497 | |
| 1498 case kExternalShortArray: | |
| 1499 return native_context->int16_array_fun(); | |
| 1500 | |
| 1501 case kExternalUnsignedIntArray: | |
| 1502 return native_context->uint32_array_fun(); | |
| 1503 | |
| 1504 case kExternalIntArray: | |
| 1505 return native_context->int32_array_fun(); | |
| 1506 | |
| 1507 case kExternalFloatArray: | |
| 1508 return native_context->float_array_fun(); | |
| 1509 | |
| 1510 case kExternalDoubleArray: | |
| 1511 return native_context->double_array_fun(); | |
| 1512 | |
| 1513 case kExternalPixelArray: | |
| 1514 return native_context->uint8c_array_fun(); | |
| 1515 | 1495 |
| 1516 default: | 1496 default: |
| 1517 UNREACHABLE(); | 1497 UNREACHABLE(); |
| 1518 return NULL; | 1498 return NULL; |
| 1519 } | 1499 } |
| 1520 } | 1500 } |
| 1521 | 1501 |
| 1522 | 1502 |
| 1523 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { | 1503 Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { |
| 1524 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); | 1504 Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate())); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 return Handle<Object>::null(); | 1990 return Handle<Object>::null(); |
| 2011 } | 1991 } |
| 2012 | 1992 |
| 2013 | 1993 |
| 2014 Handle<Object> Factory::ToBoolean(bool value) { | 1994 Handle<Object> Factory::ToBoolean(bool value) { |
| 2015 return value ? true_value() : false_value(); | 1995 return value ? true_value() : false_value(); |
| 2016 } | 1996 } |
| 2017 | 1997 |
| 2018 | 1998 |
| 2019 } } // namespace v8::internal | 1999 } } // namespace v8::internal |
| OLD | NEW |