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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); | 883 CallbacksDescriptor d(*factory->length_string(), *array_length, attribs); |
884 array_function->initial_map()->AppendDescriptor(&d, witness); | 884 array_function->initial_map()->AppendDescriptor(&d, witness); |
885 } | 885 } |
886 | 886 |
887 // array_function is used internally. JS code creating array object should | 887 // array_function is used internally. JS code creating array object should |
888 // search for the 'Array' property on the global object and use that one | 888 // search for the 'Array' property on the global object and use that one |
889 // as the constructor. 'Array' property on a global object can be | 889 // as the constructor. 'Array' property on a global object can be |
890 // overwritten by JS code. | 890 // overwritten by JS code. |
891 native_context()->set_array_function(*array_function); | 891 native_context()->set_array_function(*array_function); |
892 | 892 |
893 // Cache the array maps | 893 if (FLAG_optimize_constructed_arrays) { |
894 MaybeObject* cache_result = CacheInitialJSArrayMaps(*native_context(), | 894 // Cache the array maps, needed by ArrayConstructorStub |
895 *initial_map); | 895 MaybeObject* cache_result = CacheInitialJSArrayMaps(*native_context(), |
896 if (cache_result->IsFailure()) return false; | 896 *initial_map); |
| 897 if (cache_result->IsFailure()) return false; |
897 | 898 |
898 if (FLAG_optimize_constructed_arrays) { | |
899 ArrayConstructorStub array_constructor_stub(isolate); | 899 ArrayConstructorStub array_constructor_stub(isolate); |
900 array_function->shared()->set_construct_stub( | 900 Handle<Code> code = array_constructor_stub.GetCode(isolate); |
901 *array_constructor_stub.GetCode(isolate)); | 901 array_function->shared()->set_construct_stub(*code); |
902 } else { | 902 } else { |
903 array_function->shared()->set_construct_stub( | 903 array_function->shared()->set_construct_stub( |
904 isolate->builtins()->builtin(Builtins::kCommonArrayConstructCode)); | 904 isolate->builtins()->builtin(Builtins::kCommonArrayConstructCode)); |
905 } | 905 } |
906 } | 906 } |
907 | 907 |
908 { // --- N u m b e r --- | 908 { // --- N u m b e r --- |
909 Handle<JSFunction> number_fun = | 909 Handle<JSFunction> number_fun = |
910 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, | 910 InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize, |
911 isolate->initial_object_prototype(), | 911 isolate->initial_object_prototype(), |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 return from + sizeof(NestingCounterType); | 2564 return from + sizeof(NestingCounterType); |
2565 } | 2565 } |
2566 | 2566 |
2567 | 2567 |
2568 // Called when the top-level V8 mutex is destroyed. | 2568 // Called when the top-level V8 mutex is destroyed. |
2569 void Bootstrapper::FreeThreadResources() { | 2569 void Bootstrapper::FreeThreadResources() { |
2570 ASSERT(!IsActive()); | 2570 ASSERT(!IsActive()); |
2571 } | 2571 } |
2572 | 2572 |
2573 } } // namespace v8::internal | 2573 } } // namespace v8::internal |
OLD | NEW |