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

Commit

Permalink
Merge remote-tracking branch 'chakracore-master' into xplat
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianchun Xu committed Jul 15, 2016
2 parents f21cdaf + 784edee commit 5021d49
Show file tree
Hide file tree
Showing 221 changed files with 1,458 additions and 1,042 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.2.2">6.2.2</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.3.0">6.3.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.2.2">6.2.2</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.2.1">6.2.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.2.0">6.2.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.1.0">6.1.0</a><br/>
Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ test: all
$(MAKE) build-addons
$(MAKE) cctest
$(PYTHON) tools/test.py --mode=release -J \
addon doctool known_issues message pseudo-tty parallel sequential
addons doctool known_issues message pseudo-tty parallel sequential
$(MAKE) lint

test-parallel: all
Expand Down Expand Up @@ -184,11 +184,25 @@ test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node
test-all-valgrind: test-build
$(PYTHON) tools/test.py --mode=debug,release --valgrind

CI_NATIVE_SUITES := addons
CI_JS_SUITES := doctool known_issues message parallel pseudo-tty sequential

# Build and test addons without building anything else
test-ci-native: | test/addons/.buildstamp
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)

# This target should not use a native compiler at all
test-ci-js:
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES)

test-ci: | build-addons
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) addons doctool known_issues message pseudo-tty parallel \
sequential
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES) $(CI_JS_SUITES)

test-release: test-build
$(PYTHON) tools/test.py --mode=release
Expand Down Expand Up @@ -299,9 +313,11 @@ docopen: out/doc/api/all.html
docclean:
-rm -rf out/doc

run-ci:
build-ci:
$(PYTHON) ./configure $(CONFIG_FLAGS)
$(MAKE)

run-ci: build-ci
$(MAKE) test-ci

RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
Expand Down Expand Up @@ -709,4 +725,4 @@ endif
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci doc-only \
$(TARBALL)-headers
$(TARBALL)-headers test-ci test-ci-native test-ci-js build-ci
1 change: 1 addition & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
'ldflags': [ '-maix64' ],
}],
],
'ldflags': [ '-Wl,-bbigtoc' ],
'ldflags!': [ '-rdynamic' ],
}],
[ 'node_shared=="true"', {
Expand Down
6 changes: 3 additions & 3 deletions deps/chakrashim/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
// NOTE these macros are used by some of the tool scripts and the build
// system so their names cannot be changed without changing the scripts.
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 0
#define V8_BUILD_NUMBER 71
#define V8_PATCH_LEVEL 52
#define V8_MINOR_VERSION 1
#define V8_BUILD_NUMBER 281
#define V8_PATCH_LEVEL 69

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
4 changes: 3 additions & 1 deletion deps/chakrashim/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,7 @@ class V8_EXPORT Value : public Data {
bool IsRegExp() const;
bool IsExternal() const;
bool IsArrayBuffer() const;
bool IsArrayBufferView() const;
bool IsTypedArray() const;
bool IsUint8Array() const;
bool IsUint8ClampedArray() const;
Expand Down Expand Up @@ -1460,7 +1461,8 @@ class V8_EXPORT Array : public Object {

class V8_EXPORT BooleanObject : public Object {
public:
static Local<Value> New(bool value);
static Local<Value> New(Isolate* isolate, bool value);
V8_DEPRECATED("Pass an isolate", static Local<Value> New(bool value));
bool ValueOf() const;
static BooleanObject* Cast(Value* obj);
};
Expand Down
167 changes: 75 additions & 92 deletions deps/chakrashim/src/jsrtcontextshim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ ContextShim::ContextShim(IsolateShim * isolateShim,
context(context),
initialized(false),
exposeGC(exposeGC),
trueRef(JS_INVALID_REFERENCE),
falseRef(JS_INVALID_REFERENCE),
undefinedRef(JS_INVALID_REFERENCE),
nullRef(JS_INVALID_REFERENCE),
zero(JS_INVALID_REFERENCE),
globalObject(JS_INVALID_REFERENCE),
proxyOfGlobal(JS_INVALID_REFERENCE),
globalObjectTemplateInstance(globalObjectTemplateInstance),
getOwnPropertyDescriptorFunction(JS_INVALID_REFERENCE),
promiseContinuationFunction(JS_INVALID_REFERENCE),
Expand Down Expand Up @@ -307,10 +314,6 @@ bool ContextShim::InitializeBuiltIns() {
return false;
}

if (!InitializeReflect()) {
return false;
}

if (DefineProperty(globalObject,
GetIsolateShim()->GetKeepAliveObjectSymbolPropertyIdRef(),
PropertyDescriptorOptionValues::False,
Expand Down Expand Up @@ -338,27 +341,6 @@ static JsValueRef CHAKRA_CALLBACK ProxyOfGlobalGetPrototypeOfCallback(
return arguments[1];
}

bool ContextShim::InitializeReflect() {
if (!InitializeBuiltIn(&reflectObject,
[](JsValueRef * value) {
return GetPropertyOfGlobal("Reflect", value);
})) {
return false;
}

for (unsigned int i = 0; i < ProxyTraps::TrapCount; i++) {
if (!InitializeBuiltIn(&reflectFunctions[i],
[this, i](JsValueRef * value) {
return JsGetProperty(reflectObject,
this->GetIsolateShim()->GetProxyTrapPropertyIdRef((ProxyTraps)i),
value);
})) {
return false;
}
}
return true;
}

bool ContextShim::InitializeProxyOfGlobal() {
return InitializeBuiltIn(&proxyOfGlobal,
[this](JsValueRef * value) {
Expand All @@ -370,9 +352,18 @@ bool ContextShim::InitializeProxyOfGlobal() {
});
}

bool ContextShim::EnsureInitialized() {
if (initialized) {
return true;

bool ContextShim::DoInitializeContextShim() {
JsContextRef currentContext = IsolateShim::GetCurrent()
->GetCurrentContextShim()->GetContextRef();

JsContextRef thisContext = GetContextRef();
bool needToSwitchContext = currentContext != thisContext;

if (needToSwitchContext) {
if (JsSetCurrentContext(thisContext) != JsNoError) {
return false;
}
}

if (jsrt::InitializePromise() != JsNoError) {
Expand All @@ -391,8 +382,6 @@ bool ContextShim::EnsureInitialized() {
return false;
}

initialized = true;

// Following is a special one-time initialization that needs to marshal
// objects to this context. Do it after marking initialized = true.
if (!CheckConfigGlobalObjectTemplate()) {
Expand All @@ -401,12 +390,30 @@ bool ContextShim::EnsureInitialized() {

// add idleGC callback into prepareQueue
if (IsolateShim::IsIdleGcEnabled()) {
uv_prepare_start(IsolateShim::GetCurrent()->idleGc_prepare_handle(), PrepareIdleGC);
uv_prepare_start(IsolateShim::GetCurrent()->idleGc_prepare_handle(),
PrepareIdleGC);
}

if (needToSwitchContext) {
if (JsSetCurrentContext(currentContext) != JsNoError) {
return false;
}
}
return true;
}

void ContextShim::EnsureInitialized() {
if (initialized) {
return;
}

initialized = true;

if (!DoInitializeContextShim()) {
Fatal("Failed to initialize context");
}
}

bool ContextShim::ExposeGc() {
JsValueRef collectGarbageRef;

Expand Down Expand Up @@ -474,84 +481,60 @@ void ContextShim::RunMicrotasks() {

JsValueRef notUsed;
if (jsrt::CallFunction(task, &notUsed) != JsNoError) {
JsGetAndClearException(&notUsed); // swallow any exception from task
JsGetAndClearException(&notUsed); // swallow any exception from task
}
}
}

JsValueRef ContextShim::GetUndefined() {
return undefinedRef;
}

JsValueRef ContextShim::GetTrue() {
return trueRef;
}

JsValueRef ContextShim::GetFalse() {
return falseRef;
}

JsValueRef ContextShim::GetNull() {
return nullRef;
}

JsValueRef ContextShim::GetZero() {
return zero;
}

JsValueRef ContextShim::GetObjectConstructor() {
return globalConstructor[GlobalType::Object];
}

JsValueRef ContextShim::GetBooleanObjectConstructor() {
return globalConstructor[GlobalType::Boolean];
}
// check initialization state first instead of calling
// InitializeCurrentContextShim to save a function call for cases where
// contextshim is already initialized
#define DECLARE_GETOBJECT(name, object) \
JsValueRef ContextShim::Get##name() { \
CHAKRA_ASSERT(object != JS_INVALID_REFERENCE); \
return object; \
} \

JsValueRef ContextShim::GetNumberObjectConstructor() {
return globalConstructor[GlobalType::Number];
}
DECLARE_GETOBJECT(True, trueRef)
DECLARE_GETOBJECT(False, falseRef)
DECLARE_GETOBJECT(Undefined, undefinedRef)
DECLARE_GETOBJECT(Null, nullRef)
DECLARE_GETOBJECT(Zero, zero)
DECLARE_GETOBJECT(ObjectConstructor,
globalConstructor[GlobalType::Object])
DECLARE_GETOBJECT(BooleanObjectConstructor,
globalConstructor[GlobalType::Boolean])
DECLARE_GETOBJECT(NumberObjectConstructor,
globalConstructor[GlobalType::Number])
DECLARE_GETOBJECT(StringObjectConstructor,
globalConstructor[GlobalType::String])
DECLARE_GETOBJECT(DateConstructor,
globalConstructor[GlobalType::Date])
DECLARE_GETOBJECT(ProxyConstructor,
globalConstructor[GlobalType::Proxy])
DECLARE_GETOBJECT(GetOwnPropertyDescriptorFunction,
getOwnPropertyDescriptorFunction)
DECLARE_GETOBJECT(StringConcatFunction,
globalPrototypeFunction[GlobalPrototypeFunction
::String_concat])

JsValueRef ContextShim::GetStringObjectConstructor() {
return globalConstructor[GlobalType::String];
}

JsValueRef ContextShim::GetDateConstructor() {
return globalConstructor[GlobalType::Date];
}

JsValueRef ContextShim::GetProxyConstructor() {
return globalConstructor[GlobalType::Proxy];
JsValueRef ContextShim::GetProxyOfGlobal() {
EnsureInitialized();
CHAKRA_ASSERT(proxyOfGlobal != JS_INVALID_REFERENCE);
return proxyOfGlobal;
}

JsValueRef ContextShim::GetGlobalType(GlobalType index) {
CHAKRA_ASSERT(globalConstructor[index] != JS_INVALID_REFERENCE);
return globalConstructor[index];
}

JsValueRef ContextShim::GetGetOwnPropertyDescriptorFunction() {
return getOwnPropertyDescriptorFunction;
}

JsValueRef ContextShim::GetStringConcatFunction() {
return globalPrototypeFunction[GlobalPrototypeFunction::String_concat];
}

JsValueRef ContextShim::GetGlobalPrototypeFunction(
GlobalPrototypeFunction index) {
CHAKRA_ASSERT(globalPrototypeFunction[index] != JS_INVALID_REFERENCE);
return globalPrototypeFunction[index];
}

JsValueRef ContextShim::GetProxyOfGlobal() {
return proxyOfGlobal;
}

JsValueRef ContextShim::GetReflectObject() {
return reflectObject;
}

JsValueRef ContextShim::GetReflectFunctionForTrap(ProxyTraps trap) {
return reflectFunctions[trap];
}

JsValueRef ContextShim::GetCachedShimFunction(CachedPropertyIdRef id,
JsValueRef* func) {
if (*func == JS_INVALID_REFERENCE) {
Expand Down
17 changes: 6 additions & 11 deletions deps/chakrashim/src/jsrtcontextshim.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ContextShim {
static ContextShim * New(IsolateShim * isolateShim, bool exposeGC,
JsValueRef globalObjectTemplateInstance);
~ContextShim();
bool EnsureInitialized();
void EnsureInitialized();

IsolateShim * GetIsolateShim();
JsContextRef GetContextRef();
Expand All @@ -77,9 +77,6 @@ class ContextShim {
JsValueRef GetStringConcatFunction();
JsValueRef GetGlobalPrototypeFunction(GlobalPrototypeFunction index);
JsValueRef GetProxyOfGlobal();
JsValueRef GetReflectObject();
JsValueRef GetReflectFunctionForTrap(ProxyTraps traps);


void * GetAlignedPointerFromEmbedderData(int index);
void SetAlignedPointerInEmbedderData(int index, void * value);
Expand All @@ -90,9 +87,9 @@ class ContextShim {
private:
ContextShim(IsolateShim * isolateShim, JsContextRef context, bool exposeGC,
JsValueRef globalObjectTemplateInstance);
bool DoInitializeContextShim();
bool InitializeBuiltIns();
bool InitializeProxyOfGlobal();
bool InitializeReflect();
bool InitializeGlobalPrototypeFunctions();
bool InitializeObjectPrototypeToStringShim();

Expand Down Expand Up @@ -122,8 +119,6 @@ class ContextShim {
JsValueRef globalConstructor[GlobalType::_TypeCount];
JsValueRef globalObject;
JsValueRef proxyOfGlobal;
JsValueRef reflectObject;
JsValueRef reflectFunctions[ProxyTraps::TrapCount];

JsValueRef globalPrototypeFunction[GlobalPrototypeFunction::_FunctionCount];
JsValueRef getOwnPropertyDescriptorFunction;
Expand All @@ -132,10 +127,10 @@ class ContextShim {
std::vector<void*> embedderData;

#define DECLARE_CHAKRASHIM_FUNCTION_GETTER(F) \
public: \
JsValueRef Get##F##Function(); \
private: \
JsValueRef F##Function; \
public: \
JsValueRef Get##F##Function(); \
private: \
JsValueRef F##Function; \

DECLARE_CHAKRASHIM_FUNCTION_GETTER(cloneObject);
DECLARE_CHAKRASHIM_FUNCTION_GETTER(getPropertyNames);
Expand Down
Loading

0 comments on commit 5021d49

Please sign in to comment.