Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
add chakrashim and enable node.js on chakra
Browse files Browse the repository at this point in the history
"chakrashim" provides an implementation of the essential V8 APIs on
top of the public API for Microsoft's Chakra JavaScript engine known
as JSRT.

Use a build switch "chakra" to build node with chakrashim.

Add Visual Studio 2015 and ARM build support on Windows.
  • Loading branch information
Jianchun Xu committed Jun 29, 2015
1 parent a6bc75d commit 47000c7
Show file tree
Hide file tree
Showing 61 changed files with 11,691 additions and 30 deletions.
6 changes: 6 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['target_arch=="arm"', {
'msvs_configuration_platform': 'ARM',
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand All @@ -90,6 +93,9 @@
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
['target_arch=="arm"', {
'msvs_configuration_platform': 'ARM',
}],
['OS=="solaris"', {
# pull in V8's postmortem metadata
'ldflags': [ '-Wl,-z,allextract' ]
Expand Down
15 changes: 15 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ parser.add_option('--enable-static',
dest='enable_static',
help='build as static library')

parser.add_option("--use-chakra",
action="store_true",
dest="use_chakra",
help="Use the Chakra JavaScript engine instead of V8")

(options, args) = parser.parse_args()

# set up auto-download list
Expand Down Expand Up @@ -472,6 +477,11 @@ def check_compiler(o):
def cc_macros():
"""Checks predefined macros using the CC command."""

if os.name == 'nt':
k = {}
k['__ARM_ARCH_7__'] = True
k['__ARM_NEON__'] = True
return k
try:
p = subprocess.Popen(shlex.split(CC) + ['-dM', '-E', '-'],
stdin=subprocess.PIPE,
Expand Down Expand Up @@ -1001,6 +1011,10 @@ def configure_intl(o):
pprint.pformat(icu_config, indent=2) + '\n')
return # end of configure_intl

def configure_chakra(o):
o['variables']['node_use_chakra'] = b(options.use_chakra)


output = {
'variables': { 'python': sys.executable },
'include_dirs': [],
Expand Down Expand Up @@ -1028,6 +1042,7 @@ configure_openssl(output)
configure_winsdk(output)
configure_intl(output)
configure_fullystatic(output)
configure_chakra(output)

# variables should be a root level element,
# move everything else to target_defaults
Expand Down
9 changes: 9 additions & 0 deletions deps/chakrashim/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# chakrashim project contributors

Curtis Man <[email protected]>
Jianchun Xu <[email protected]>
Nadav Bar <[email protected]>
Paul Vick <[email protected]>
Saar Yahalom <[email protected]>
Sandeep Agarwal <[email protected]>
Munyiri Kamau <[email protected]>
19 changes: 19 additions & 0 deletions deps/chakrashim/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright Microsoft. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
126 changes: 126 additions & 0 deletions deps/chakrashim/chakrashim.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
'variables': {
'library_files': [
'lib/chakra_shim.js',
],
},
'targets': [{
'target_name': 'chakrashim',
'type': '<(library)',

'dependencies': [
'chakra_js2c#host',
],

'include_dirs': [
'include',
'<(SHARED_INTERMEDIATE_DIR)'
],
'defines': [
'USE_EDGEMODE_JSRT=1',
],
'conditions': [
[ 'target_arch=="ia32"', { 'defines': [ '__i386__=1' ] } ],
[ 'target_arch=="x64"', { 'defines': [ '__x86_64__=1' ] } ],
[ 'target_arch=="arm"', { 'defines': [ '__arm__=1' ] } ],
],
'direct_dependent_settings': {
'include_dirs': [
'include',
],
'defines': [
'USE_CHAKRA=1',
'USE_EDGEMODE_JSRT=1',
'_WIN32_WINNT=0x0601',
],
'libraries': [
'-lchakrart.lib',
'-lole32.lib',
],
'conditions': [
[ 'target_arch!="arm"', {
'libraries': [ '-lversion.lib' ]
}, {
'libraries!': [ '-lpsapi.lib' ],
'libraries': [ '-lonecore.lib' ],
'defines': [ '__arm__=1' ]
}],
],
},
'sources': [
'include/v8.h',
'include/v8-debug.h',
'include/v8-profiler.h',
'include/v8chakra.h',
'include/jsrtutils.h',
'include/jsrtproxyutils.h',
'src/jsrtcachedpropertyidref.h',
'src/jsrtcontextshim.h',
'src/jsrtcontextshim.cc',
'src/jsrtcrosscontext.h',
'src/jsrtcrosscontext.cc',
'src/jsrtisolateshim.cc',
'src/jsrtisolateshim.h',
'src/jsrtpromise.cc',
'src/jsrtproxyutils.cc',
'src/jsrtstringutils.h',
'src/jsrtstringutils.cc',
'src/jsrtutils.cc',
'src/v8array.cc',
'src/v8boolean.cc',
'src/v8booleanobject.cc',
'src/v8context.cc',
'src/v8date.cc',
'src/v8debug.cc',
'src/v8exception.cc',
'src/v8function.cc',
'src/v8functiontemplate.cc',
'src/v8global.cc',
'src/v8handlescope.cc',
'src/v8int32.cc',
'src/v8integer.cc',
'src/v8isolate.cc',
'src/v8message.cc',
'src/v8number.cc',
'src/v8numberobject.cc',
'src/v8object.cc',
'src/v8objecttemplate.cc',
'src/v8persistent.cc',
'src/v8returnvalue.cc',
'src/v8script.cc',
'src/v8signature.cc',
'src/v8string.cc',
'src/v8stringobject.cc',
'src/v8template.cc',
'src/v8trycatch.cc',
'src/v8uint32.cc',
'src/v8value.cc',
'src/v8v8.cc',
'src/v8external.cc',
],
}, # end chakrashim
{
'target_name': 'chakra_js2c',
'type': 'none',
'toolsets': ['host'],
'actions': [
{
'action_name': 'chakra_js2c',
'inputs': [
'<@(library_files)'
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/chakra_natives.h',
],
'action': [
'<(python)',
'./../../tools/js2c.py',
'-chakra',
'<@(_outputs)',
'<@(_inputs)',
],
},
],
}, # end chakra_js2c
],
}
64 changes: 64 additions & 0 deletions deps/chakrashim/include/jsrtproxyutils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright Microsoft. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and / or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#pragma once

#include "jsrt.h"
#include "jsrtutils.h"
#include <map>

namespace jsrt
{
// Proxy Traps types, please see:
// http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies
// for more details regarding harmony proxies
enum ProxyTraps
{
ApplyTrap,
ConstructTrap,
DefinePropertyTrap,
DeletePropertyTrap,
EnumerateTrap,
GetTrap,
GetOwnPropertyDescriptorTrap,
GetPrototypeOfTrap,
HasTrap,
IsExtensibleTrap,
OwnKeysTrap,
PreventExtensionsTrap,
SetTrap,
SetPrototypeOfTrap,
TrapCount
};

enum CachedPropertyIdRef;
CachedPropertyIdRef GetProxyTrapCachedPropertyIdRef(ProxyTraps trap);

JsErrorCode CreateProxy(
_In_ JsValueRef target,
_In_ const std::map<ProxyTraps, JsNativeFunction>& conf,
_Out_ JsValueRef *result
);

JsErrorCode TryParseUInt32(
_In_ JsValueRef strRef,
_Out_ bool* isUInt32,
_Out_ unsigned int *uint32Value);
}
Loading

0 comments on commit 47000c7

Please sign in to comment.