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

Side by Side Diff: src/bootstrapper.cc

Issue 1140333003: Introduce extras export object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed comments Created 5 years, 7 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/api.cc ('k') | src/contexts.h » ('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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 return CompileNative(isolate, name, source_code, arraysize(args), args); 1460 return CompileNative(isolate, name, source_code, arraysize(args), args);
1461 } 1461 }
1462 1462
1463 1463
1464 bool Genesis::CompileExtraBuiltin(Isolate* isolate, int index) { 1464 bool Genesis::CompileExtraBuiltin(Isolate* isolate, int index) {
1465 HandleScope scope(isolate); 1465 HandleScope scope(isolate);
1466 Vector<const char> name = ExtraNatives::GetScriptName(index); 1466 Vector<const char> name = ExtraNatives::GetScriptName(index);
1467 Handle<String> source_code = 1467 Handle<String> source_code =
1468 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); 1468 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index);
1469 Handle<Object> global = isolate->global_object(); 1469 Handle<Object> global = isolate->global_object();
1470 Handle<Object> exports = isolate->builtin_exports_object(); 1470 Handle<Object> exports = isolate->extras_exports_object();
1471 Handle<Object> args[] = {global, exports}; 1471 Handle<Object> args[] = {global, exports};
1472 return CompileNative(isolate, name, source_code, arraysize(args), args); 1472 return CompileNative(isolate, name, source_code, arraysize(args), args);
1473 } 1473 }
1474 1474
1475 1475
1476 bool Genesis::CompileNative(Isolate* isolate, Vector<const char> name, 1476 bool Genesis::CompileNative(Isolate* isolate, Vector<const char> name,
1477 Handle<String> source, int argc, 1477 Handle<String> source, int argc,
1478 Handle<Object> argv[]) { 1478 Handle<Object> argv[]) {
1479 SuppressDebug compiling_natives(isolate->debug()); 1479 SuppressDebug compiling_natives(isolate->debug());
1480 // During genesis, the boilerplate for stack overflow won't work until the 1480 // During genesis, the boilerplate for stack overflow won't work until the
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1911
1912 native_context()->set_runtime_context(*context); 1912 native_context()->set_runtime_context(*context);
1913 1913
1914 // Set up shared object to set up cross references between native scripts. 1914 // Set up shared object to set up cross references between native scripts.
1915 // "shared" is used for cross references between native scripts that are part 1915 // "shared" is used for cross references between native scripts that are part
1916 // of the snapshot. "builtin_exports" is used for experimental natives. 1916 // of the snapshot. "builtin_exports" is used for experimental natives.
1917 Handle<JSObject> shared = 1917 Handle<JSObject> shared =
1918 factory()->NewJSObject(isolate()->object_function()); 1918 factory()->NewJSObject(isolate()->object_function());
1919 JSObject::NormalizeProperties(shared, CLEAR_INOBJECT_PROPERTIES, 16, 1919 JSObject::NormalizeProperties(shared, CLEAR_INOBJECT_PROPERTIES, 16,
1920 "container to share between native scripts"); 1920 "container to share between native scripts");
1921
1921 Handle<JSObject> builtin_exports = 1922 Handle<JSObject> builtin_exports =
1922 factory()->NewJSObject(isolate()->object_function()); 1923 factory()->NewJSObject(isolate()->object_function());
1923 JSObject::NormalizeProperties(builtin_exports, CLEAR_INOBJECT_PROPERTIES, 16, 1924 JSObject::NormalizeProperties(builtin_exports, CLEAR_INOBJECT_PROPERTIES, 16,
1924 "container to export to experimental natives"); 1925 "container to export to experimental natives");
1925 native_context()->set_builtin_exports_object(*builtin_exports); 1926 native_context()->set_builtin_exports_object(*builtin_exports);
1926 1927
1928 Handle<JSObject> extras_exports =
1929 factory()->NewJSObject(isolate()->object_function());
1930 JSObject::NormalizeProperties(extras_exports, CLEAR_INOBJECT_PROPERTIES, 2,
1931 "container to export to extra natives");
1932 native_context()->set_extras_exports_object(*extras_exports);
1933
1927 if (FLAG_expose_natives_as != NULL) { 1934 if (FLAG_expose_natives_as != NULL) {
1928 Handle<String> shared_key = factory()->NewStringFromAsciiChecked("shared"); 1935 Handle<String> shared_key = factory()->NewStringFromAsciiChecked("shared");
1929 JSObject::AddProperty(builtins, shared_key, shared, NONE); 1936 JSObject::AddProperty(builtins, shared_key, shared, NONE);
1930 } 1937 }
1931 1938
1932 { // -- S c r i p t 1939 { // -- S c r i p t
1933 // Builtin functions for Script. 1940 // Builtin functions for Script.
1934 Handle<JSFunction> script_fun = InstallFunction( 1941 Handle<JSFunction> script_fun = InstallFunction(
1935 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, 1942 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
1936 isolate()->initial_object_prototype(), Builtins::kIllegal); 1943 isolate()->initial_object_prototype(), Builtins::kIllegal);
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 return from + sizeof(NestingCounterType); 3037 return from + sizeof(NestingCounterType);
3031 } 3038 }
3032 3039
3033 3040
3034 // Called when the top-level V8 mutex is destroyed. 3041 // Called when the top-level V8 mutex is destroyed.
3035 void Bootstrapper::FreeThreadResources() { 3042 void Bootstrapper::FreeThreadResources() {
3036 DCHECK(!IsActive()); 3043 DCHECK(!IsActive());
3037 } 3044 }
3038 3045
3039 } } // namespace v8::internal 3046 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698