diff options
Diffstat (limited to 'src/javascript')
-rw-r--r-- | src/javascript/jsc/api/ffi.zig | 8 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/BunBuiltinNames.h | 1 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp | 68 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.h | 52 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/WebCoreJSBuiltins.h | 52 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/ZigGlobalObject.cpp | 4 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/ZigGlobalObject.h | 5 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/bindings.zig | 8 | ||||
-rw-r--r-- | src/javascript/jsc/bindings/root.h | 1 |
9 files changed, 183 insertions, 16 deletions
diff --git a/src/javascript/jsc/api/ffi.zig b/src/javascript/jsc/api/ffi.zig index a6191beb0..4062baadb 100644 --- a/src/javascript/jsc/api/ffi.zig +++ b/src/javascript/jsc/api/ffi.zig @@ -574,8 +574,6 @@ pub const FFI = struct { .{ "char*", ABIType{ .pointer = .{ .primitive = Primitive.Tag.char } } }, .{ "void*", ABIType{ .pointer = .{ .primitive = Primitive.Tag.@"void" } } }, - .{ "const char*", ABIType{ .pointer = .{ .is_const = true, .primitive = Primitive.Tag.char } } }, - .{ "const void*", ABIType{ .pointer = .{ .is_const = true, .primitive = Primitive.Tag.@"void" } } }, }, ); @@ -662,16 +660,12 @@ pub const FFI = struct { char: i8, int8_t: i8, uint8_t: u8, - int16_t: i16, uint16_t: u16, - int32_t: c_int, uint32_t: c_uint, - int64_t: i64, uint64_t: u64, - double: f64, float: f32, @@ -744,7 +738,7 @@ pub const FFI = struct { .bool => { try writer.print("BOOLEAN_TO_JSVALUE({s})", .{self.symbol}); }, - .int8_t, .uint8_t, .int16_t, .uint16_t, .int32_t, .uint32_t => { + .char, .int8_t, .uint8_t, .int16_t, .uint16_t, .int32_t, .uint32_t => { try writer.print("INT32_TO_JSVALUE({s})", .{self.symbol}); }, .int64_t => {}, diff --git a/src/javascript/jsc/bindings/BunBuiltinNames.h b/src/javascript/jsc/bindings/BunBuiltinNames.h index 26d151319..f02a92e17 100644 --- a/src/javascript/jsc/bindings/BunBuiltinNames.h +++ b/src/javascript/jsc/bindings/BunBuiltinNames.h @@ -95,6 +95,7 @@ using namespace JSC; macro(version) \ macro(versions) \ macro(write) \ + macro(dataView) \ BUN_ADDITIONAL_PRIVATE_IDENTIFIERS(macro) \ class BunBuiltinNames { diff --git a/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp b/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp new file mode 100644 index 000000000..bf85a29ef --- /dev/null +++ b/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "WebCoreJSBuiltinInternals.h" + +#include "JSDOMGlobalObject.h" +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/HeapInlines.h> +#include <JavaScriptCore/JSCJSValueInlines.h> +#include <JavaScriptCore/SlotVisitorInlines.h> +#include <JavaScriptCore/StructureInlines.h> + +namespace WebCore { + +JSBuiltinInternalFunctions::JSBuiltinInternalFunctions(JSC::VM& vm) + : m_vm(vm) +{ + UNUSED_PARAM(vm); +} + +template<typename Visitor> +void JSBuiltinInternalFunctions::visit(Visitor& visitor) +{ + UNUSED_PARAM(visitor); +} + +template void JSBuiltinInternalFunctions::visit(AbstractSlotVisitor&); +template void JSBuiltinInternalFunctions::visit(SlotVisitor&); + +SUPPRESS_ASAN void JSBuiltinInternalFunctions::initialize(JSDOMGlobalObject& globalObject) +{ + UNUSED_PARAM(globalObject); + + JSVMClientData& clientData = *static_cast<JSVMClientData*>(m_vm.clientData); + JSDOMGlobalObject::GlobalPropertyInfo staticGlobals[] = { + }; + //globalObject.addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); + UNUSED_PARAM(clientData); +} + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.h b/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.h new file mode 100644 index 000000000..86fb9b3c6 --- /dev/null +++ b/src/javascript/jsc/bindings/WebCoreJSBuiltinInternals.h @@ -0,0 +1,52 @@ +namespace Zig { class GlobalObject; } +/* + * Copyright (c) 2016 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#pragma once + +#include <JavaScriptCore/VM.h> +#include <JavaScriptCore/WeakInlines.h> + +namespace WebCore { + +using JSDOMGlobalObject = Zig::GlobalObject; + +class JSBuiltinInternalFunctions { +public: + explicit JSBuiltinInternalFunctions(JSC::VM&); + + template<typename Visitor> void visit(Visitor&); + void initialize(JSDOMGlobalObject&); + + +private: + JSC::VM& m_vm; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/WebCoreJSBuiltins.h b/src/javascript/jsc/bindings/WebCoreJSBuiltins.h new file mode 100644 index 000000000..f2fd32881 --- /dev/null +++ b/src/javascript/jsc/bindings/WebCoreJSBuiltins.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#pragma once + +#include "JSBufferPrototypeBuiltins.h" +#include <JavaScriptCore/VM.h> + +namespace WebCore { + +class JSBuiltinFunctions { +public: + explicit JSBuiltinFunctions(JSC::VM& vm) + : m_vm(vm) + , m_jsBufferPrototypeBuiltins(m_vm) + { + } + + JSBufferPrototypeBuiltinsWrapper& jsBufferPrototypeBuiltins() { return m_jsBufferPrototypeBuiltins; } + +private: + JSC::VM& m_vm; + JSBufferPrototypeBuiltinsWrapper m_jsBufferPrototypeBuiltins; +}; + +} // namespace WebCore diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.cpp b/src/javascript/jsc/bindings/ZigGlobalObject.cpp index 8e522ab85..d613d6c61 100644 --- a/src/javascript/jsc/bindings/ZigGlobalObject.cpp +++ b/src/javascript/jsc/bindings/ZigGlobalObject.cpp @@ -87,7 +87,7 @@ #include "Process.h" #include "JavaScriptCore/RemoteInspectorServer.h" - +#include "WebCoreJSBuiltinInternals.h" #include "JSBuffer.h" using JSGlobalObject = JSC::JSGlobalObject; @@ -290,8 +290,10 @@ GlobalObject::GlobalObject(JSC::VM& vm, JSC::Structure* structure) , m_constructors(makeUnique<WebCore::DOMConstructors>()) , m_world(WebCore::DOMWrapperWorld::create(vm, WebCore::DOMWrapperWorld::Type::Normal)) , m_worldIsNormal(true) + , m_builtinInternalFunctions(vm) { + m_scriptExecutionContext = new WebCore::ScriptExecutionContext(&vm, this); } diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.h b/src/javascript/jsc/bindings/ZigGlobalObject.h index da67f93c1..e3914d447 100644 --- a/src/javascript/jsc/bindings/ZigGlobalObject.h +++ b/src/javascript/jsc/bindings/ZigGlobalObject.h @@ -22,6 +22,7 @@ class ScriptExecutionContext; #include "JavaScriptCore/JSGlobalObject.h" #include "JavaScriptCore/JSTypeInfo.h" #include "JavaScriptCore/Structure.h" +#include "WebCoreJSBuiltinInternals.h" #include "ZigConsoleClient.h" @@ -125,8 +126,12 @@ public: JSC::JSPromiseRejectionOperation); void setConsole(void* console); void installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm); + WebCore::JSBuiltinInternalFunctions& builtinInternalFunctions() { return m_builtinInternalFunctions; } private: + void addBuiltinGlobals(JSC::VM&); + friend void WebCore::JSBuiltinInternalFunctions::initialize(Zig::GlobalObject&); + WebCore::JSBuiltinInternalFunctions m_builtinInternalFunctions; GlobalObject(JSC::VM& vm, JSC::Structure* structure); std::unique_ptr<WebCore::DOMConstructors> m_constructors; uint8_t m_worldIsNormal; diff --git a/src/javascript/jsc/bindings/bindings.zig b/src/javascript/jsc/bindings/bindings.zig index 840f9025e..63848164a 100644 --- a/src/javascript/jsc/bindings/bindings.zig +++ b/src/javascript/jsc/bindings/bindings.zig @@ -3488,11 +3488,3 @@ pub const WTF = struct { pub const Callback = struct { // zig: Value, }; - -const NodeBuffer = @import("../node/buffer.zig"); - -comptime { - if (!JSC.is_bindgen) { - std.testing.refAllDecls(NodeBuffer.Write); - } -} diff --git a/src/javascript/jsc/bindings/root.h b/src/javascript/jsc/bindings/root.h index ec2d228f7..0e8f2b262 100644 --- a/src/javascript/jsc/bindings/root.h +++ b/src/javascript/jsc/bindings/root.h @@ -78,4 +78,5 @@ #define WTF_MAKE_ISO_ALLOCATED_EXPORT(className, a) WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(className); #define WTF_MAKE_ISO_ALLOCATED_IMPL(className) + #endif
\ No newline at end of file |