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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "natives.h" | 9 #include "natives.h" |
10 #include "snapshot.h" | 10 #include "snapshot.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 | 862 |
863 // array_function is used internally. JS code creating array object should | 863 // array_function is used internally. JS code creating array object should |
864 // search for the 'Array' property on the global object and use that one | 864 // search for the 'Array' property on the global object and use that one |
865 // as the constructor. 'Array' property on a global object can be | 865 // as the constructor. 'Array' property on a global object can be |
866 // overwritten by JS code. | 866 // overwritten by JS code. |
867 native_context()->set_array_function(*array_function); | 867 native_context()->set_array_function(*array_function); |
868 | 868 |
869 // Cache the array maps, needed by ArrayConstructorStub | 869 // Cache the array maps, needed by ArrayConstructorStub |
870 CacheInitialJSArrayMaps(native_context(), initial_map); | 870 CacheInitialJSArrayMaps(native_context(), initial_map); |
871 ArrayConstructorStub array_constructor_stub(isolate); | 871 ArrayConstructorStub array_constructor_stub(isolate); |
872 Handle<Code> code = array_constructor_stub.GetCode(isolate); | 872 Handle<Code> code = array_constructor_stub.GetCode(); |
873 array_function->shared()->set_construct_stub(*code); | 873 array_function->shared()->set_construct_stub(*code); |
874 } | 874 } |
875 | 875 |
876 { // --- N u m b e r --- | 876 { // --- N u m b e r --- |
877 Handle<JSFunction> number_fun = | 877 Handle<JSFunction> number_fun = |
878 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, | 878 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, |
879 isolate->initial_object_prototype(), | 879 isolate->initial_object_prototype(), |
880 Builtins::kIllegal, true, true); | 880 Builtins::kIllegal, true, true); |
881 native_context()->set_number_function(*number_fun); | 881 native_context()->set_number_function(*number_fun); |
882 } | 882 } |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 JS_ARRAY_TYPE, | 1587 JS_ARRAY_TYPE, |
1588 JSArray::kSize, | 1588 JSArray::kSize, |
1589 isolate()->initial_object_prototype(), | 1589 isolate()->initial_object_prototype(), |
1590 Builtins::kInternalArrayCode, | 1590 Builtins::kInternalArrayCode, |
1591 true, true); | 1591 true, true); |
1592 Handle<JSObject> prototype = | 1592 Handle<JSObject> prototype = |
1593 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1593 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1594 Accessors::FunctionSetPrototype(array_function, prototype); | 1594 Accessors::FunctionSetPrototype(array_function, prototype); |
1595 | 1595 |
1596 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); | 1596 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); |
1597 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); | 1597 Handle<Code> code = internal_array_constructor_stub.GetCode(); |
1598 array_function->shared()->set_construct_stub(*code); | 1598 array_function->shared()->set_construct_stub(*code); |
1599 array_function->shared()->DontAdaptArguments(); | 1599 array_function->shared()->DontAdaptArguments(); |
1600 | 1600 |
1601 Handle<Map> original_map(array_function->initial_map()); | 1601 Handle<Map> original_map(array_function->initial_map()); |
1602 Handle<Map> initial_map = Map::Copy(original_map); | 1602 Handle<Map> initial_map = Map::Copy(original_map); |
1603 initial_map->set_elements_kind(elements_kind); | 1603 initial_map->set_elements_kind(elements_kind); |
1604 array_function->set_initial_map(*initial_map); | 1604 array_function->set_initial_map(*initial_map); |
1605 | 1605 |
1606 // Make "length" magic on instances. | 1606 // Make "length" magic on instances. |
1607 Map::EnsureDescriptorSlack(initial_map, 1); | 1607 Map::EnsureDescriptorSlack(initial_map, 1); |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 return from + sizeof(NestingCounterType); | 2679 return from + sizeof(NestingCounterType); |
2680 } | 2680 } |
2681 | 2681 |
2682 | 2682 |
2683 // Called when the top-level V8 mutex is destroyed. | 2683 // Called when the top-level V8 mutex is destroyed. |
2684 void Bootstrapper::FreeThreadResources() { | 2684 void Bootstrapper::FreeThreadResources() { |
2685 ASSERT(!IsActive()); | 2685 ASSERT(!IsActive()); |
2686 } | 2686 } |
2687 | 2687 |
2688 } } // namespace v8::internal | 2688 } } // namespace v8::internal |
OLD | NEW |