From 32761a6cee1d0dee366b885b7b9c777e67885688 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sun, 10 Apr 2016 09:28:39 +0000 Subject: webkitgtk-2.4.11 --- .../runtime/JSArrayBufferConstructor.cpp | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp') diff --git a/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp b/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp index 03f077784..ca7e030e8 100644 --- a/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp +++ b/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2016 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,18 +28,17 @@ #include "Error.h" #include "ExceptionHelpers.h" -#include "GetterSetter.h" #include "JSArrayBuffer.h" #include "JSArrayBufferPrototype.h" #include "JSGlobalObject.h" -#include "JSCInlines.h" +#include "Operations.h" namespace JSC { static EncodedJSValue JSC_HOST_CALL arrayBufferFuncIsView(ExecState*); const ClassInfo JSArrayBufferConstructor::s_info = { - "Function", &Base::s_info, 0, + "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSArrayBufferConstructor) }; @@ -48,23 +47,22 @@ JSArrayBufferConstructor::JSArrayBufferConstructor(VM& vm, Structure* structure) { } -void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* prototype, GetterSetter* speciesSymbol) +void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* prototype) { - Base::finishCreation(vm, ASCIILiteral("ArrayBuffer")); + Base::finishCreation(vm, "ArrayBuffer"); putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly); - putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); JSGlobalObject* globalObject = this->globalObject(); - JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); + JSC_NATIVE_FUNCTION(vm.propertyNames->isView, arrayBufferFuncIsView, DontEnum, 1); } -JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype, GetterSetter* speciesSymbol) +JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype) { JSArrayBufferConstructor* result = new (NotNull, allocateCell(vm.heap)) JSArrayBufferConstructor(vm, structure); - result->finishCreation(vm, prototype, speciesSymbol); + result->finishCreation(vm, prototype); return result; } @@ -94,19 +92,14 @@ static EncodedJSValue JSC_HOST_CALL constructArrayBuffer(ExecState* exec) RefPtr buffer = ArrayBuffer::create(length, 1); if (!buffer) - return throwVMError(exec, createOutOfMemoryError(exec)); - - Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(exec, exec->newTarget(), constructor->globalObject()->arrayBufferStructure()); - JSArrayBuffer* result = JSArrayBuffer::create(exec->vm(), arrayBufferStructure, buffer.release()); + return throwVMError(exec, createOutOfMemoryError(constructor->globalObject())); + + JSArrayBuffer* result = JSArrayBuffer::create( + exec->vm(), constructor->globalObject()->arrayBufferStructure(), buffer); return JSValue::encode(result); } -static EncodedJSValue JSC_HOST_CALL callArrayBuffer(ExecState* exec) -{ - return JSValue::encode(throwConstructorCannotBeCalledAsFunctionTypeError(exec, "ArrayBuffer")); -} - ConstructType JSArrayBufferConstructor::getConstructData( JSCell*, ConstructData& constructData) { @@ -116,7 +109,7 @@ ConstructType JSArrayBufferConstructor::getConstructData( CallType JSArrayBufferConstructor::getCallData(JSCell*, CallData& callData) { - callData.native.function = callArrayBuffer; + callData.native.function = constructArrayBuffer; return CallTypeHost; } -- cgit v1.2.1