Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index f36006c1140db9bae82216352f4df5215d35735a..8dfab1803f165169b020a9c975cfb117b9826619 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1056,6 +1056,54 @@ Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { |
} |
+Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) { |
+ JSFunction* typed_array_fun; |
+ Context* native_context = isolate()->context()->native_context(); |
+ switch (type) { |
+ case kExternalUnsignedByteArray: |
+ typed_array_fun = native_context->uint8_array_fun(); |
+ break; |
+ |
+ case kExternalByteArray: |
+ typed_array_fun = native_context->int8_array_fun(); |
+ break; |
+ |
+ case kExternalUnsignedShortArray: |
+ typed_array_fun = native_context->uint16_array_fun(); |
+ break; |
+ |
+ case kExternalShortArray: |
+ typed_array_fun = native_context->int16_array_fun(); |
+ break; |
+ |
+ case kExternalUnsignedIntArray: |
+ typed_array_fun = native_context->uint32_array_fun(); |
+ break; |
+ |
+ case kExternalIntArray: |
+ typed_array_fun = native_context->int32_array_fun(); |
+ break; |
+ |
+ case kExternalFloatArray: |
+ typed_array_fun = native_context->float_array_fun(); |
+ break; |
+ |
+ case kExternalDoubleArray: |
+ typed_array_fun = native_context->double_array_fun(); |
+ break; |
+ |
+ default: |
+ UNREACHABLE(); |
+ return Handle<JSTypedArray>(); |
+ } |
+ |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateJSObject(typed_array_fun), |
+ JSTypedArray); |
+} |
+ |
+ |
Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, |
Handle<Object> prototype) { |
CALL_HEAP_FUNCTION( |