Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: src/runtime/runtime-internal.cc

Issue 1306993003: Call JS functions via native context instead of js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-internal.cc
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc
index 12864066c4e333d3f9c7f7bb84b1164474a77171..236a79c7919a9dbe038a30ad6037758b04e67957 100644
--- a/src/runtime/runtime-internal.cc
+++ b/src/runtime/runtime-internal.cc
@@ -37,22 +37,27 @@ RUNTIME_FUNCTION(Runtime_ExportPrivateSymbols) {
}
-RUNTIME_FUNCTION(Runtime_ImportToRuntime) {
+RUNTIME_FUNCTION(Runtime_InstallToContext) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
- RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
- Bootstrapper::ImportNatives(isolate, container);
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_ImportExperimentalToRuntime) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
+ RUNTIME_ASSERT(array->HasFastElements());
RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
- Bootstrapper::ImportExperimentalNatives(isolate, container);
+ Handle<Context> native_context = isolate->native_context();
+ Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()));
+ int length = Smi::cast(array->length())->value();
+ for (int i = 0; i < length; i += 2) {
+ RUNTIME_ASSERT(fixed_array->get(i)->IsString());
+ Handle<String> name(String::cast(fixed_array->get(i)));
+ RUNTIME_ASSERT(fixed_array->get(i + 1)->IsJSObject());
+ Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1)));
+ int index = Context::ImportedFieldIndexForName(name);
+ if (index == Context::kNotFound) {
+ index = Context::IntrinsicIndexForName(name);
+ }
+ RUNTIME_ASSERT(index != Context::kNotFound);
+ native_context->set(index, *object);
+ }
return isolate->heap()->undefined_value();
}
« no previous file with comments | « src/runtime/runtime.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698