diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
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<JSArrayBufferConstructor>(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<ArrayBuffer> 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; } |