Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: src/factory.cc

Issue 145133013: External Array renaming and boilerplate scrapping (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« src/api.cc ('K') | « src/elements-kind.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698