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

Commit

Permalink
Revert of Add the concept of a V8 extras exports object (patchset #5
Browse files Browse the repository at this point in the history
…id:80001 of https://codereview.chromium.org/1128113006/)

Reason for revert:
[Sheriff] Causes gc stress failures:
http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20arm64%20-%20sim%20-%20gc%20stress/builds/2167

Original issue's description:
> Add the concept of a V8 extras exports object
>
> Exposed to the extras as extrasExports (on the builtins object), on
> which they can put things that should be accessible from C++. Exposed
> to C++ through the V8 API as v8::Context::GetExtrasExportsObject().
>
> Adding a test (in test-api.cc) required adding a simple extra,
> test-extra.js, which we build into the standalone builds.
>
> R=yangguo@chromium.org, jochen@chromium.org
> BUG=
>
> Committed: https://crrev.com/ad547cea05f3e02c67243b682e933fc53ac763d9
> Cr-Commit-Position: refs/heads/master@{#28317}

TBR=jochen@chromium.org,yangguo@chromium.org,domenic@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1127313005

Cr-Commit-Position: refs/heads/master@{#28332}
  • Loading branch information
mi-ac authored and Commit bot committed May 11, 2015
1 parent 7f4fa3b commit 19a28dc
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 75 deletions.
3 changes: 0 additions & 3 deletions build/standalone.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@
'msan%': '<(msan)',
'tsan%': '<(tsan)',

# Add a simple extra solely for the purpose of the cctests
'v8_extra_library_files': ['../test/cctest/test-extra.js'],

# .gyp files or targets should set v8_code to 1 if they build V8 specific
# code, as opposed to external code. This variable is used to control such
# things as the set of warnings to enable, and whether warnings are treated
Expand Down
6 changes: 0 additions & 6 deletions include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -6370,12 +6370,6 @@ class V8_EXPORT Context {
*/
V8_INLINE Local<Value> GetEmbedderData(int index);

/**
* Gets the exports object used by V8 extras. Extra natives get a reference
* to this object and can use it to export functionality.
*/
Local<Object> GetExtrasExportsObject();

/**
* Sets the embedder data with the given index, growing the data as
* needed. Note that index 0 currently has a special meaning for Chrome's
Expand Down
8 changes: 0 additions & 8 deletions src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5492,14 +5492,6 @@ void Context::DetachGlobal() {
}


Local<v8::Object> Context::GetExtrasExportsObject() {
i::Handle<i::Context> context = Utils::OpenHandle(this);
i::Isolate* isolate = context->GetIsolate();
i::Handle<i::JSObject> exports(context->extras_exports_object(), isolate);
return Utils::ToLocal(exports);
}


void Context::AllowCodeGenerationFromStrings(bool allow) {
i::Handle<i::Context> context = Utils::OpenHandle(this);
i::Isolate* isolate = context->GetIsolate();
Expand Down
16 changes: 0 additions & 16 deletions src/bootstrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ class Genesis BASE_EMBEDDED {
void InitializeGlobal(Handle<GlobalObject> global_object,
Handle<JSFunction> empty_function);
void InitializeExperimentalGlobal();
void InitializeExtrasExportsObject();
// Installs the contents of the native .js files on the global objects.
// Used for creating a context from scratch.
void InstallNativeFunctions();
Expand Down Expand Up @@ -1442,20 +1441,6 @@ void Genesis::InitializeExperimentalGlobal() {
}


void Genesis::InitializeExtrasExportsObject() {
Handle<JSObject> exports =
factory()->NewJSObject(isolate()->object_function(), TENURED);

native_context()->set_extras_exports_object(*exports);

Handle<JSBuiltinsObject> builtins(native_context()->builtins());
Handle<String> exports_string =
factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("extrasExports"));
Runtime::SetObjectProperty(isolate(), builtins, exports_string, exports,
STRICT).Assert();
}


bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
Vector<const char> name = Natives::GetScriptName(index);
Handle<String> source_code =
Expand Down Expand Up @@ -2984,7 +2969,6 @@ Genesis::Genesis(Isolate* isolate,
// them after they have already been deserialized would also fail.
if (!isolate->serializer_enabled()) {
InitializeExperimentalGlobal();
InitializeExtrasExportsObject();
if (!InstallExperimentalNatives()) return;
if (!InstallExtraNatives()) return;
}
Expand Down
4 changes: 1 addition & 3 deletions src/contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ enum BindingFlags {
V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \
V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_exports_object)
V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table)


// A table of all script contexts. Every loaded top-level script with top-level
Expand Down Expand Up @@ -423,7 +422,6 @@ class Context: public FixedArray {
SCRIPT_CONTEXT_TABLE_INDEX,
MAP_CACHE_INDEX,
TO_LENGTH_FUN_INDEX,
EXTRAS_EXPORTS_OBJECT_INDEX,

// Properties from here are treated as weak references by the full GC.
// Scavenge treats them as strong references.
Expand Down
6 changes: 0 additions & 6 deletions src/runtime/runtime-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ RUNTIME_FUNCTION(Runtime_NativeScriptsCount) {
}


RUNTIME_FUNCTION(Runtime_NativeExtrasCount) {
DCHECK(args.length() == 0);
return Smi::FromInt(ExtraNatives::GetBuiltinsCount());
}


// Returns V8 version as a string.
RUNTIME_FUNCTION(Runtime_GetV8Version) {
HandleScope scope(isolate);
Expand Down
1 change: 0 additions & 1 deletion src/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ namespace internal {
F(Abort, 1, 1) \
F(AbortJS, 1, 1) \
F(NativeScriptsCount, 0, 1) \
F(NativeExtrasCount, 0, 1) \
F(GetV8Version, 0, 1) \
F(DisassembleFunction, 1, 1) \
F(TraceEnter, 0, 1) \
Expand Down
18 changes: 0 additions & 18 deletions test/cctest/test-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21029,21 +21029,3 @@ TEST(SealHandleScopeNested) {
USE(obj);
}
}


TEST(ExtrasExportsObject) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
LocalContext env;

// standalone.gypi ensures we include the test-extra.js file, which should
// add the testExtraShouldReturnFive export
v8::Local<v8::Object> exports = env->GetExtrasExportsObject();

auto func =
exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
auto undefined = v8::Undefined(isolate);
auto result = func->Call(undefined, 0, {}).As<v8::Number>();

CHECK(result->Value() == 5.0);
}
13 changes: 0 additions & 13 deletions test/cctest/test-extra.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/mjsunit/debug-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ for (i = 0; i < scripts.length; i++) {
}

// This has to be updated if the number of native scripts change.
assertEquals(%NativeScriptsCount() + %NativeExtrasCount(), named_native_count);
assertEquals(%NativeScriptsCount(), named_native_count);
// Only the 'gc' extension is loaded.
assertEquals(1, extension_count);
// This script and mjsunit.js has been loaded. If using d8, d8 loads
Expand Down

0 comments on commit 19a28dc

Please sign in to comment.