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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 TENURED); | 502 TENURED); |
503 Handle<Map> map = Map::Copy(handle(prototype->map())); | 503 Handle<Map> map = Map::Copy(handle(prototype->map())); |
504 map->set_is_prototype_map(true); | 504 map->set_is_prototype_map(true); |
505 prototype->set_map(*map); | 505 prototype->set_map(*map); |
506 | 506 |
507 native_context()->set_initial_object_prototype(*prototype); | 507 native_context()->set_initial_object_prototype(*prototype); |
508 // For bootstrapping set the array prototype to be the same as the object | 508 // For bootstrapping set the array prototype to be the same as the object |
509 // prototype, otherwise the missing initial_array_prototype will cause | 509 // prototype, otherwise the missing initial_array_prototype will cause |
510 // assertions during startup. | 510 // assertions during startup. |
511 native_context()->set_initial_array_prototype(*prototype); | 511 native_context()->set_initial_array_prototype(*prototype); |
512 Accessors::FunctionSetPrototype(object_fun, prototype); | 512 Accessors::FunctionSetPrototype(object_fun, prototype).Assert(); |
513 } | 513 } |
514 | 514 |
515 // Allocate the empty function as the prototype for function ECMAScript | 515 // Allocate the empty function as the prototype for function ECMAScript |
516 // 262 15.3.4. | 516 // 262 15.3.4. |
517 Handle<String> empty_string = | 517 Handle<String> empty_string = |
518 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty")); | 518 factory->InternalizeOneByteString(STATIC_CHAR_VECTOR("Empty")); |
519 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); | 519 Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction)); |
520 Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype( | 520 Handle<JSFunction> empty_function = factory->NewFunctionWithoutPrototype( |
521 empty_string, code); | 521 empty_string, code); |
522 | 522 |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 | 1666 |
1667 native_context()->set_runtime_context(*context); | 1667 native_context()->set_runtime_context(*context); |
1668 | 1668 |
1669 { // -- S c r i p t | 1669 { // -- S c r i p t |
1670 // Builtin functions for Script. | 1670 // Builtin functions for Script. |
1671 Handle<JSFunction> script_fun = InstallFunction( | 1671 Handle<JSFunction> script_fun = InstallFunction( |
1672 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, | 1672 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, |
1673 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1673 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1674 Handle<JSObject> prototype = | 1674 Handle<JSObject> prototype = |
1675 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1675 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1676 Accessors::FunctionSetPrototype(script_fun, prototype); | 1676 Accessors::FunctionSetPrototype(script_fun, prototype).Assert(); |
1677 native_context()->set_script_function(*script_fun); | 1677 native_context()->set_script_function(*script_fun); |
1678 | 1678 |
1679 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); | 1679 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); |
1680 Map::EnsureDescriptorSlack(script_map, 14); | 1680 Map::EnsureDescriptorSlack(script_map, 14); |
1681 | 1681 |
1682 PropertyAttributes attribs = | 1682 PropertyAttributes attribs = |
1683 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1683 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
1684 | 1684 |
1685 Handle<AccessorInfo> script_column = | 1685 Handle<AccessorInfo> script_column = |
1686 Accessors::ScriptColumnOffsetInfo(isolate(), attribs); | 1686 Accessors::ScriptColumnOffsetInfo(isolate(), attribs); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 } | 1808 } |
1809 { | 1809 { |
1810 // Builtin function for OpaqueReference -- a JSValue-based object, | 1810 // Builtin function for OpaqueReference -- a JSValue-based object, |
1811 // that keeps its field isolated from JavaScript code. It may store | 1811 // that keeps its field isolated from JavaScript code. It may store |
1812 // objects, that JavaScript code may not access. | 1812 // objects, that JavaScript code may not access. |
1813 Handle<JSFunction> opaque_reference_fun = InstallFunction( | 1813 Handle<JSFunction> opaque_reference_fun = InstallFunction( |
1814 builtins, "OpaqueReference", JS_VALUE_TYPE, JSValue::kSize, | 1814 builtins, "OpaqueReference", JS_VALUE_TYPE, JSValue::kSize, |
1815 isolate()->initial_object_prototype(), Builtins::kIllegal); | 1815 isolate()->initial_object_prototype(), Builtins::kIllegal); |
1816 Handle<JSObject> prototype = | 1816 Handle<JSObject> prototype = |
1817 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1817 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1818 Accessors::FunctionSetPrototype(opaque_reference_fun, prototype); | 1818 Accessors::FunctionSetPrototype(opaque_reference_fun, prototype).Assert(); |
1819 native_context()->set_opaque_reference_function(*opaque_reference_fun); | 1819 native_context()->set_opaque_reference_function(*opaque_reference_fun); |
1820 } | 1820 } |
1821 | 1821 |
1822 // InternalArrays should not use Smi-Only array optimizations. There are too | 1822 // InternalArrays should not use Smi-Only array optimizations. There are too |
1823 // many places in the C++ runtime code (e.g. RegEx) that assume that | 1823 // many places in the C++ runtime code (e.g. RegEx) that assume that |
1824 // elements in InternalArrays can be set to non-Smi values without going | 1824 // elements in InternalArrays can be set to non-Smi values without going |
1825 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT | 1825 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT |
1826 // transition easy to trap. Moreover, they rarely are smi-only. | 1826 // transition easy to trap. Moreover, they rarely are smi-only. |
1827 { | 1827 { |
1828 Handle<JSFunction> array_function = | 1828 Handle<JSFunction> array_function = |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 return from + sizeof(NestingCounterType); | 2713 return from + sizeof(NestingCounterType); |
2714 } | 2714 } |
2715 | 2715 |
2716 | 2716 |
2717 // Called when the top-level V8 mutex is destroyed. | 2717 // Called when the top-level V8 mutex is destroyed. |
2718 void Bootstrapper::FreeThreadResources() { | 2718 void Bootstrapper::FreeThreadResources() { |
2719 DCHECK(!IsActive()); | 2719 DCHECK(!IsActive()); |
2720 } | 2720 } |
2721 | 2721 |
2722 } } // namespace v8::internal | 2722 } } // namespace v8::internal |
OLD | NEW |