OLD | NEW |
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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 source_code, arraysize(args), args); | 1543 source_code, arraysize(args), args); |
1544 } | 1544 } |
1545 | 1545 |
1546 | 1546 |
1547 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { | 1547 bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) { |
1548 HandleScope scope(isolate); | 1548 HandleScope scope(isolate); |
1549 Vector<const char> name = ExtraNatives::GetScriptName(index); | 1549 Vector<const char> name = ExtraNatives::GetScriptName(index); |
1550 Handle<String> source_code = | 1550 Handle<String> source_code = |
1551 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); | 1551 isolate->bootstrapper()->SourceLookup<ExtraNatives>(index); |
1552 Handle<Object> global = isolate->global_object(); | 1552 Handle<Object> global = isolate->global_object(); |
1553 Handle<Object> exports = isolate->extras_exports_object(); | 1553 Handle<Object> binding = isolate->extras_binding_object(); |
1554 Handle<Object> args[] = {global, exports}; | 1554 Handle<Object> args[] = {global, binding}; |
1555 return Bootstrapper::CompileNative( | 1555 return Bootstrapper::CompileNative( |
1556 isolate, name, Handle<JSObject>(isolate->native_context()->builtins()), | 1556 isolate, name, Handle<JSObject>(isolate->native_context()->builtins()), |
1557 source_code, arraysize(args), args); | 1557 source_code, arraysize(args), args); |
1558 } | 1558 } |
1559 | 1559 |
1560 | 1560 |
1561 bool Bootstrapper::CompileCodeStubBuiltin(Isolate* isolate, int index) { | 1561 bool Bootstrapper::CompileCodeStubBuiltin(Isolate* isolate, int index) { |
1562 HandleScope scope(isolate); | 1562 HandleScope scope(isolate); |
1563 Vector<const char> name = CodeStubNatives::GetScriptName(index); | 1563 Vector<const char> name = CodeStubNatives::GetScriptName(index); |
1564 Handle<String> source_code = | 1564 Handle<String> source_code = |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 if (!InstallJSBuiltins(builtins)) return false; | 2096 if (!InstallJSBuiltins(builtins)) return false; |
2097 return true; | 2097 return true; |
2098 } | 2098 } |
2099 | 2099 |
2100 // Set up the utils object as shared container between native scripts. | 2100 // Set up the utils object as shared container between native scripts. |
2101 Handle<JSObject> utils = factory()->NewJSObject(isolate()->object_function()); | 2101 Handle<JSObject> utils = factory()->NewJSObject(isolate()->object_function()); |
2102 JSObject::NormalizeProperties(utils, CLEAR_INOBJECT_PROPERTIES, 16, | 2102 JSObject::NormalizeProperties(utils, CLEAR_INOBJECT_PROPERTIES, 16, |
2103 "utils container for native scripts"); | 2103 "utils container for native scripts"); |
2104 native_context()->set_natives_utils_object(*utils); | 2104 native_context()->set_natives_utils_object(*utils); |
2105 | 2105 |
2106 Handle<JSObject> extras_exports = | 2106 Handle<JSObject> extras_binding = |
2107 factory()->NewJSObject(isolate()->object_function()); | 2107 factory()->NewJSObject(isolate()->object_function()); |
2108 JSObject::NormalizeProperties(extras_exports, CLEAR_INOBJECT_PROPERTIES, 2, | 2108 JSObject::NormalizeProperties(extras_binding, CLEAR_INOBJECT_PROPERTIES, 2, |
2109 "container to export to extra natives"); | 2109 "container for binding to/from extra natives"); |
2110 native_context()->set_extras_exports_object(*extras_exports); | 2110 native_context()->set_extras_binding_object(*extras_binding); |
2111 | 2111 |
2112 if (FLAG_expose_natives_as != NULL) { | 2112 if (FLAG_expose_natives_as != NULL) { |
2113 Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils"); | 2113 Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils"); |
2114 JSObject::AddProperty(builtins, utils_key, utils, NONE); | 2114 JSObject::AddProperty(builtins, utils_key, utils, NONE); |
2115 } | 2115 } |
2116 | 2116 |
2117 { // -- S c r i p t | 2117 { // -- S c r i p t |
2118 // Builtin functions for Script. | 2118 // Builtin functions for Script. |
2119 Handle<JSFunction> script_fun = InstallFunction( | 2119 Handle<JSFunction> script_fun = InstallFunction( |
2120 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, | 2120 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3259 } | 3259 } |
3260 | 3260 |
3261 | 3261 |
3262 // Called when the top-level V8 mutex is destroyed. | 3262 // Called when the top-level V8 mutex is destroyed. |
3263 void Bootstrapper::FreeThreadResources() { | 3263 void Bootstrapper::FreeThreadResources() { |
3264 DCHECK(!IsActive()); | 3264 DCHECK(!IsActive()); |
3265 } | 3265 } |
3266 | 3266 |
3267 } // namespace internal | 3267 } // namespace internal |
3268 } // namespace v8 | 3268 } // namespace v8 |
OLD | NEW |