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

Side by Side Diff: src/runtime/runtime-internal.cc

Issue 1294803004: Native context: run prologue.js before runtime.js (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: also change BUILD.gn 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 unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | tools/gyp/v8.gyp » ('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/v8.h" 5 #include "src/v8.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/debug/debug.h" 10 #include "src/debug/debug.h"
10 #include "src/frames-inl.h" 11 #include "src/frames-inl.h"
11 #include "src/messages.h" 12 #include "src/messages.h"
12 #include "src/parser.h" 13 #include "src/parser.h"
13 #include "src/prettyprinter.h" 14 #include "src/prettyprinter.h"
14 #include "src/runtime/runtime-utils.h" 15 #include "src/runtime/runtime-utils.h"
15 16
16 namespace v8 { 17 namespace v8 {
17 namespace internal { 18 namespace internal {
18 19
(...skipping 18 matching lines...) Expand all
37 RUNTIME_FUNCTION(Runtime_ImportExperimentalToRuntime) { 38 RUNTIME_FUNCTION(Runtime_ImportExperimentalToRuntime) {
38 HandleScope scope(isolate); 39 HandleScope scope(isolate);
39 DCHECK(args.length() == 1); 40 DCHECK(args.length() == 1);
40 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0); 41 CONVERT_ARG_HANDLE_CHECKED(JSObject, container, 0);
41 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); 42 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
42 Bootstrapper::ImportExperimentalNatives(isolate, container); 43 Bootstrapper::ImportExperimentalNatives(isolate, container);
43 return isolate->heap()->undefined_value(); 44 return isolate->heap()->undefined_value();
44 } 45 }
45 46
46 47
48 RUNTIME_FUNCTION(Runtime_InstallFunctionsFromArray) {
49 HandleScope scope(isolate);
50 DCHECK(args.length() == 3);
51 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
52 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 1);
53 CONVERT_ARG_HANDLE_CHECKED(JSArray, functions, 2);
54 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
55
56 int num_items = NumberToInt32(functions->length()) / 2;
57 if (!object->IsJSGlobalObject() && object->HasFastProperties()) {
58 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, num_items,
59 "InstallFunctions");
60 }
61
62 Handle<FixedArray> array(FixedArray::cast(functions->elements()));
63 for (int i = 0; i < num_items; ++i) {
64 RUNTIME_ASSERT(array->get(i * 2)->IsString());
65 RUNTIME_ASSERT(array->get(i * 2 + 1)->IsJSFunction());
66 Handle<String> name(String::cast(array->get(i * 2)));
67 Handle<JSFunction> fun(JSFunction::cast(array->get(i * 2 + 1)));
68 fun->shared()->set_name(*name);
69 RUNTIME_ASSERT(fun->RemovePrototype());
70 fun->shared()->set_native(true);
71 RETURN_FAILURE_ON_EXCEPTION(
72 isolate,
73 JSObject::SetOwnPropertyIgnoreAttributes(object, name, fun, attrs));
74 }
75
76 if (!object->IsJSGlobalObject()) {
77 JSObject::MigrateSlowToFast(object, 0, "InstallFunctions");
78 }
79
80 return isolate->heap()->undefined_value();
81 }
82
83
47 RUNTIME_FUNCTION(Runtime_Throw) { 84 RUNTIME_FUNCTION(Runtime_Throw) {
48 HandleScope scope(isolate); 85 HandleScope scope(isolate);
49 DCHECK(args.length() == 1); 86 DCHECK(args.length() == 1);
50 return isolate->Throw(args[0]); 87 return isolate->Throw(args[0]);
51 } 88 }
52 89
53 90
54 RUNTIME_FUNCTION(Runtime_ReThrow) { 91 RUNTIME_FUNCTION(Runtime_ReThrow) {
55 HandleScope scope(isolate); 92 HandleScope scope(isolate);
56 DCHECK(args.length() == 1); 93 DCHECK(args.length() == 1);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 435 }
399 436
400 437
401 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) { 438 RUNTIME_FUNCTION(Runtime_GetCodeStubExportsObject) {
402 HandleScope shs(isolate); 439 HandleScope shs(isolate);
403 return isolate->heap()->code_stub_exports_object(); 440 return isolate->heap()->code_stub_exports_object();
404 } 441 }
405 442
406 } // namespace internal 443 } // namespace internal
407 } // namespace v8 444 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698