OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); | 879 CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); |
880 array_function->initial_map()->AppendDescriptor(&d, witness); | 880 array_function->initial_map()->AppendDescriptor(&d, witness); |
881 } | 881 } |
882 | 882 |
883 // array_function is used internally. JS code creating array object should | 883 // array_function is used internally. JS code creating array object should |
884 // search for the 'Array' property on the global object and use that one | 884 // search for the 'Array' property on the global object and use that one |
885 // as the constructor. 'Array' property on a global object can be | 885 // as the constructor. 'Array' property on a global object can be |
886 // overwritten by JS code. | 886 // overwritten by JS code. |
887 native_context()->set_array_function(*array_function); | 887 native_context()->set_array_function(*array_function); |
888 | 888 |
889 if (FLAG_optimize_constructed_arrays) { | 889 // Cache the array maps, needed by ArrayConstructorStub |
890 // Cache the array maps, needed by ArrayConstructorStub | 890 CacheInitialJSArrayMaps(native_context(), initial_map); |
891 CacheInitialJSArrayMaps(native_context(), initial_map); | 891 ArrayConstructorStub array_constructor_stub(isolate); |
892 ArrayConstructorStub array_constructor_stub(isolate); | 892 Handle<Code> code = array_constructor_stub.GetCode(isolate); |
893 Handle<Code> code = array_constructor_stub.GetCode(isolate); | 893 array_function->shared()->set_construct_stub(*code); |
894 array_function->shared()->set_construct_stub(*code); | |
895 } else { | |
896 array_function->shared()->set_construct_stub( | |
897 isolate->builtins()->builtin(Builtins::kCommonArrayConstructCode)); | |
898 } | |
899 } | 894 } |
900 | 895 |
901 { // --- N u m b e r --- | 896 { // --- N u m b e r --- |
902 Handle<JSFunction> number_fun = | 897 Handle<JSFunction> number_fun = |
903 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, | 898 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, |
904 isolate->initial_object_prototype(), | 899 isolate->initial_object_prototype(), |
905 Builtins::kIllegal, true, true); | 900 Builtins::kIllegal, true, true); |
906 native_context()->set_number_function(*number_fun); | 901 native_context()->set_number_function(*number_fun); |
907 } | 902 } |
908 | 903 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 name, | 1611 name, |
1617 JS_ARRAY_TYPE, | 1612 JS_ARRAY_TYPE, |
1618 JSArray::kSize, | 1613 JSArray::kSize, |
1619 isolate()->initial_object_prototype(), | 1614 isolate()->initial_object_prototype(), |
1620 Builtins::kInternalArrayCode, | 1615 Builtins::kInternalArrayCode, |
1621 true, true); | 1616 true, true); |
1622 Handle<JSObject> prototype = | 1617 Handle<JSObject> prototype = |
1623 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1618 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1624 SetPrototype(array_function, prototype); | 1619 SetPrototype(array_function, prototype); |
1625 | 1620 |
1626 if (FLAG_optimize_constructed_arrays) { | 1621 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); |
1627 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); | 1622 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); |
1628 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); | 1623 array_function->shared()->set_construct_stub(*code); |
1629 array_function->shared()->set_construct_stub(*code); | |
1630 } else { | |
1631 array_function->shared()->set_construct_stub( | |
1632 isolate()->builtins()->builtin(Builtins::kCommonArrayConstructCode)); | |
1633 } | |
1634 | |
1635 array_function->shared()->DontAdaptArguments(); | 1624 array_function->shared()->DontAdaptArguments(); |
1636 | 1625 |
1637 Handle<Map> original_map(array_function->initial_map()); | 1626 Handle<Map> original_map(array_function->initial_map()); |
1638 Handle<Map> initial_map = factory()->CopyMap(original_map); | 1627 Handle<Map> initial_map = factory()->CopyMap(original_map); |
1639 initial_map->set_elements_kind(elements_kind); | 1628 initial_map->set_elements_kind(elements_kind); |
1640 array_function->set_initial_map(*initial_map); | 1629 array_function->set_initial_map(*initial_map); |
1641 | 1630 |
1642 // Make "length" magic on instances. | 1631 // Make "length" magic on instances. |
1643 Handle<DescriptorArray> array_descriptors( | 1632 Handle<DescriptorArray> array_descriptors( |
1644 factory()->NewDescriptorArray(0, 1)); | 1633 factory()->NewDescriptorArray(0, 1)); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 return from + sizeof(NestingCounterType); | 2640 return from + sizeof(NestingCounterType); |
2652 } | 2641 } |
2653 | 2642 |
2654 | 2643 |
2655 // Called when the top-level V8 mutex is destroyed. | 2644 // Called when the top-level V8 mutex is destroyed. |
2656 void Bootstrapper::FreeThreadResources() { | 2645 void Bootstrapper::FreeThreadResources() { |
2657 ASSERT(!IsActive()); | 2646 ASSERT(!IsActive()); |
2658 } | 2647 } |
2659 | 2648 |
2660 } } // namespace v8::internal | 2649 } } // namespace v8::internal |
OLD | NEW |