Reviewers: jochen, Yang,
Message:
Technically a breaking change... in an API nobody is using, hopefully?
Description:
Rename "extras exports" to "extras binding"
[email protected], [email protected]
BUG=507133
LOG=Y
Please review this at https://codereview.chromium.org/1275683002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -21 lines):
M include/v8.h
M src/api.cc
M src/bootstrapper.cc
M src/contexts.h
M test/cctest/test-api.cc
M test/cctest/test-extra.js
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index
1b65770d35e3fe98bf6f374b3df5b6c46b817ba6..19373a1398720ad1816df0dfd49ec5f8f88a86c0
100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -6606,10 +6606,12 @@ 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.
+ * Gets the binding object used by V8 extras. Extra natives get a
reference
+ * to this object and can use it to "export" functionality by adding
+ * properties. Extra natives can also "import" functionality by accessing
+ * properties added by the embedder using the V8 API.
*/
- Local<Object> GetExtrasExportsObject();
+ Local<Object> GetExtrasBindingObject();
/**
* Sets the embedder data with the given index, growing the data as
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
ef08b032dd21d7c73f6a0cb25109c789bcf88482..f91110fa8d8cdac851965ec88a94245e16155db6
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5545,11 +5545,11 @@ void Context::DetachGlobal() {
}
-Local<v8::Object> Context::GetExtrasExportsObject() {
+Local<v8::Object> Context::GetExtrasBindingObject() {
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);
+ i::Handle<i::JSObject> binding(context->extras_binding_object(),
isolate);
+ return Utils::ToLocal(binding);
}
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
37beeff7dd361fe53539ff55b07bcae82976100b..ee62d53d0ec124f741feec7b76d402fc46880f32
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1550,8 +1550,8 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate*
isolate, int index) {
Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<ExtraNatives>(index);
Handle<Object> global = isolate->global_object();
- Handle<Object> exports = isolate->extras_exports_object();
- Handle<Object> args[] = {global, exports};
+ Handle<Object> binding = isolate->extras_binding_object();
+ Handle<Object> args[] = {global, binding};
return Bootstrapper::CompileNative(
isolate, name,
Handle<JSObject>(isolate->native_context()->builtins()),
source_code, arraysize(args), args);
@@ -2103,11 +2103,11 @@ bool Genesis::InstallNatives(ContextType
context_type) {
"utils container for native scripts");
native_context()->set_natives_utils_object(*utils);
- Handle<JSObject> extras_exports =
+ Handle<JSObject> extras_binding =
factory()->NewJSObject(isolate()->object_function());
- JSObject::NormalizeProperties(extras_exports, CLEAR_INOBJECT_PROPERTIES,
2,
- "container to export to extra natives");
- native_context()->set_extras_exports_object(*extras_exports);
+ JSObject::NormalizeProperties(extras_binding, CLEAR_INOBJECT_PROPERTIES,
2,
+ "container for binding to/from extra
natives");
+ native_context()->set_extras_binding_object(*extras_binding);
if (FLAG_expose_natives_as != NULL) {
Handle<String> utils_key =
factory()->NewStringFromAsciiChecked("utils");
Index: src/contexts.h
diff --git a/src/contexts.h b/src/contexts.h
index
0d7da9186859dd1fa1058926cb6601306f24d4b5..9c8dc8a860ab2e86cca55933a9aec93bc5e0f83a
100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -201,7 +201,7 @@ enum BindingFlags {
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction,
array_values_iterator) \
V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable,
script_context_table) \
V(NATIVES_UTILS_OBJECT_INDEX, Object,
natives_utils_object) \
- V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_exports_object)
+ V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_binding_object)
// A table of all script contexts. Every loaded top-level script with
top-level
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
9df749bbc98a7b5b39352161f2ea9dc7cd0cec28..10bfd047dbdfde4f68c808c97c72480dba5d84c5
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21621,19 +21621,19 @@ TEST(ExtrasExportsObject) {
// standalone.gypi ensures we include the test-extra.js file, which
should
// export the tested functions.
- v8::Local<v8::Object> exports = env->GetExtrasExportsObject();
+ v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
auto func =
- exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
+ binding->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>();
auto undefined = v8::Undefined(isolate);
auto result = func->Call(undefined, 0, {}).As<v8::Number>();
CHECK_EQ(5, result->Int32Value());
v8::Handle<v8::FunctionTemplate> runtimeFunction =
v8::FunctionTemplate::New(isolate, ExtrasExportsTestRuntimeFunction);
- exports->Set(v8_str("runtime"), runtimeFunction->GetFunction());
+ binding->Set(v8_str("runtime"), runtimeFunction->GetFunction());
func =
-
exports->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>();
+
binding->Get(v8_str("testExtraShouldCallToRuntime")).As<v8::Function>();
result = func->Call(undefined, 0, {}).As<v8::Number>();
CHECK_EQ(7, result->Int32Value());
}
Index: test/cctest/test-extra.js
diff --git a/test/cctest/test-extra.js b/test/cctest/test-extra.js
index
829ddee01a4c140aacbfa9ca4969daae9ad7929d..f943ea6c4e5adedb79b2c44213cdcf6a8ba56c60
100644
--- a/test/cctest/test-extra.js
+++ b/test/cctest/test-extra.js
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-(function (global, exports) {
+(function (global, binding) {
'use strict';
- exports.testExtraShouldReturnFive = function () {
+ binding.testExtraShouldReturnFive = function () {
return 5;
};
- exports.testExtraShouldCallToRuntime = function() {
- return exports.runtime(3);
+ binding.testExtraShouldCallToRuntime = function() {
+ return binding.runtime(3);
};
})
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.