Commit c6cb81a8 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

Adds CSA builtin for abstract TypedArray constructor.

Also removes the JS constructor.

R=jgruber@chromium.org

Bug: v8:7624
Change-Id: I33493ab2fafb35f95fb1822d46d3f249568c0a56
Reviewed-on: https://chromium-review.googlesource.com/999534
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52469}
parent 1800e9bb
...@@ -2829,11 +2829,12 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -2829,11 +2829,12 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
} }
{ // -- T y p e d A r r a y { // -- T y p e d A r r a y
Handle<JSFunction> typed_array_fun = Handle<JSFunction> typed_array_fun = CreateFunction(
CreateFunction(isolate, factory->InternalizeUtf8String("TypedArray"), isolate, factory->InternalizeUtf8String("TypedArray"),
JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 0, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, 0, factory->the_hole_value(),
factory->the_hole_value(), Builtins::kIllegal); Builtins::kTypedArrayBaseConstructor);
typed_array_fun->shared()->set_native(false); typed_array_fun->shared()->set_native(false);
typed_array_fun->shared()->set_length(0);
InstallSpeciesGetter(typed_array_fun); InstallSpeciesGetter(typed_array_fun);
native_context()->set_typed_array_function(*typed_array_fun); native_context()->set_typed_array_function(*typed_array_fun);
......
...@@ -1102,6 +1102,7 @@ namespace internal { ...@@ -1102,6 +1102,7 @@ namespace internal {
kByteOffset) \ kByteOffset) \
/* ES #sec-typedarray-constructors */ \ /* ES #sec-typedarray-constructors */ \
TFS(CreateTypedArray, kTarget, kNewTarget, kArg1, kArg2, kArg3) \ TFS(CreateTypedArray, kTarget, kNewTarget, kArg1, kArg2, kArg3) \
TFJ(TypedArrayBaseConstructor, 0) \
TFJ(TypedArrayConstructorLazyDeoptContinuation, 1, kResult) \ TFJ(TypedArrayConstructorLazyDeoptContinuation, 1, kResult) \
TFJ(TypedArrayConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ TFJ(TypedArrayConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
CPP(TypedArrayPrototypeBuffer) \ CPP(TypedArrayPrototypeBuffer) \
......
...@@ -630,6 +630,12 @@ void TypedArrayBuiltinsAssembler::ConstructByIterable( ...@@ -630,6 +630,12 @@ void TypedArrayBuiltinsAssembler::ConstructByIterable(
element_size); element_size);
} }
TF_BUILTIN(TypedArrayBaseConstructor, TypedArrayBuiltinsAssembler) {
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
ThrowTypeError(context, MessageTemplate::kConstructAbstractClass,
"TypedArray");
}
// ES #sec-typedarray-constructors // ES #sec-typedarray-constructors
TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) { TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) {
TNode<Context> context = CAST(Parameter(Descriptor::kContext)); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
......
...@@ -105,16 +105,8 @@ DEFINE_METHOD( ...@@ -105,16 +105,8 @@ DEFINE_METHOD(
} }
); );
// TODO(bmeurer): Migrate this to a proper builtin.
function TypedArrayConstructor() {
throw %make_type_error(kConstructAbstractClass, "TypedArray");
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
%SetCode(GlobalTypedArray, TypedArrayConstructor);
%AddNamedProperty(GlobalTypedArray.prototype, "toString", ArrayToString, %AddNamedProperty(GlobalTypedArray.prototype, "toString", ArrayToString,
DONT_ENUM); DONT_ENUM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment