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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 19 matching lines...) Expand all
30 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 30 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
31 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 31 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
32 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10, 32 JSObject::NormalizeProperties(container, KEEP_INOBJECT_PROPERTIES, 10,
33 "ExportPrivateSymbols"); 33 "ExportPrivateSymbols");
34 Bootstrapper::ExportPrivateSymbols(isolate, container); 34 Bootstrapper::ExportPrivateSymbols(isolate, container);
35 JSObject::MigrateSlowToFast(container, 0, "ExportPrivateSymbols"); 35 JSObject::MigrateSlowToFast(container, 0, "ExportPrivateSymbols");
36 return *container; 36 return *container;
37 } 37 }
38 38
39 39
40 RUNTIME_FUNCTION(Runtime_ImportToRuntime) { 40 RUNTIME_FUNCTION(Runtime_InstallToContext) {
41 HandleScope scope(isolate); 41 HandleScope scope(isolate);
42 DCHECK(args.length() == 1); 42 DCHECK(args.length() == 1);
43 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 43 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
44 RUNTIME_ASSERT(array->HasFastElements());
44 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 45 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
45 Bootstrapper::ImportNatives(isolate, container); 46 Handle<Context> native_context = isolate->native_context();
47 Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()));
48 int length = Smi::cast(array->length())->value();
49 for (int i = 0; i < length; i += 2) {
50 RUNTIME_ASSERT(fixed_array->get(i)->IsString());
51 Handle<String> name(String::cast(fixed_array->get(i)));
52 RUNTIME_ASSERT(fixed_array->get(i + 1)->IsJSObject());
53 Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1)));
54 int index = Context::ImportedFieldIndexForName(name);
55 if (index == Context::kNotFound) {
56 index = Context::IntrinsicIndexForName(name);
57 }
58 RUNTIME_ASSERT(index != Context::kNotFound);
59 native_context->set(index, *object);
60 }
46 return isolate->heap()->undefined_value(); 61 return isolate->heap()->undefined_value();
47 } 62 }
48 63
49
50 RUNTIME_FUNCTION(Runtime_ImportExperimentalToRuntime) {
51 HandleScope scope(isolate);
52 DCHECK(args.length() == 1);
53 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
54 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
55 Bootstrapper::ImportExperimentalNatives(isolate, container);
56 return isolate->heap()->undefined_value();
57 }
58
59 64
60 RUNTIME_FUNCTION(Runtime_InstallJSBuiltins) { 65 RUNTIME_FUNCTION(Runtime_InstallJSBuiltins) {
61 HandleScope scope(isolate); 66 HandleScope scope(isolate);
62 DCHECK(args.length() == 1); 67 DCHECK(args.length() == 1);
63 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 68 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
64 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 69 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
65 Bootstrapper::InstallJSBuiltins(isolate, container); 70 Bootstrapper::InstallJSBuiltins(isolate, container);
66 return isolate->heap()->undefined_value(); 71 return isolate->heap()->undefined_value();
67 } 72 }
68 73
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 419 }
415 420
416 421
417 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { 422 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
418 HandleScope shs(isolate); 423 HandleScope shs(isolate);
419 return isolate->heap()->code_stub_exports_object(); 424 return isolate->heap()->code_stub_exports_object();
420 } 425 }
421 426
422 } // namespace internal 427 } // namespace internal
423 } // namespace v8 428 } // namespace v8
OLDNEW
« 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