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

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: 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
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_ExportToRuntime) {
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 const Runtime::Function* function = Runtime::FunctionForName(name);
55 RUNTIME_ASSERT(function->intrinsic_type == Runtime::CONTEXT);
56 native_context->set(function->index, *object);
57 }
46 return isolate->heap()->undefined_value(); 58 return isolate->heap()->undefined_value();
47 } 59 }
48 60
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 61
60 RUNTIME_FUNCTION(Runtime_InstallJSBuiltins) { 62 RUNTIME_FUNCTION(Runtime_InstallJSBuiltins) {
61 HandleScope scope(isolate); 63 HandleScope scope(isolate);
62 DCHECK(args.length() == 1); 64 DCHECK(args.length() == 1);
63 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 65 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
64 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 66 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
65 Bootstrapper::InstallJSBuiltins(isolate, container); 67 Bootstrapper::InstallJSBuiltins(isolate, container);
66 return isolate->heap()->undefined_value(); 68 return isolate->heap()->undefined_value();
67 } 69 }
68 70
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 416 }
415 417
416 418
417 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { 419 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
418 HandleScope shs(isolate); 420 HandleScope shs(isolate);
419 return isolate->heap()->code_stub_exports_object(); 421 return isolate->heap()->code_stub_exports_object();
420 } 422 }
421 423
422 } // namespace internal 424 } // namespace internal
423 } // namespace v8 425 } // namespace v8
OLDNEW
« src/runtime/runtime.h ('K') | « src/runtime/runtime.cc ('k') | src/templates.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698