OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 SetPrototype(opaque_reference_fun, prototype); | 1606 SetPrototype(opaque_reference_fun, prototype); |
1607 global_context()->set_opaque_reference_function(*opaque_reference_fun); | 1607 global_context()->set_opaque_reference_function(*opaque_reference_fun); |
1608 } | 1608 } |
1609 | 1609 |
1610 { // --- I n t e r n a l A r r a y --- | 1610 { // --- I n t e r n a l A r r a y --- |
1611 // An array constructor on the builtins object that works like | 1611 // An array constructor on the builtins object that works like |
1612 // the public Array constructor, except that its prototype | 1612 // the public Array constructor, except that its prototype |
1613 // doesn't inherit from Object.prototype. | 1613 // doesn't inherit from Object.prototype. |
1614 // To be used only for internal work by builtins. Instances | 1614 // To be used only for internal work by builtins. Instances |
1615 // must not be leaked to user code. | 1615 // must not be leaked to user code. |
1616 // Only works correctly when called as a constructor. The normal | |
1617 // Array code uses Array.prototype as prototype when called as | |
1618 // a function. | |
1619 Handle<JSFunction> array_function = | 1616 Handle<JSFunction> array_function = |
1620 InstallFunction(builtins, | 1617 InstallFunction(builtins, |
1621 "InternalArray", | 1618 "InternalArray", |
1622 JS_ARRAY_TYPE, | 1619 JS_ARRAY_TYPE, |
1623 JSArray::kSize, | 1620 JSArray::kSize, |
1624 isolate()->initial_object_prototype(), | 1621 isolate()->initial_object_prototype(), |
1625 Builtins::kArrayCode, | 1622 Builtins::kInternalArrayCode, |
1626 true); | 1623 true); |
1627 Handle<JSObject> prototype = | 1624 Handle<JSObject> prototype = |
1628 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1625 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1629 SetPrototype(array_function, prototype); | 1626 SetPrototype(array_function, prototype); |
1630 | 1627 |
1631 array_function->shared()->set_construct_stub( | 1628 array_function->shared()->set_construct_stub( |
1632 isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); | 1629 isolate()->builtins()->builtin(Builtins::kArrayConstructCode)); |
1633 array_function->shared()->DontAdaptArguments(); | 1630 array_function->shared()->DontAdaptArguments(); |
1634 | 1631 |
1635 // InternalArrays should not use Smi-Only array optimizations. There are too | 1632 // InternalArrays should not use Smi-Only array optimizations. There are too |
(...skipping 11 matching lines...) Expand all Loading... |
1647 // Make "length" magic on instances. | 1644 // Make "length" magic on instances. |
1648 Handle<DescriptorArray> array_descriptors = | 1645 Handle<DescriptorArray> array_descriptors = |
1649 factory()->CopyAppendForeignDescriptor( | 1646 factory()->CopyAppendForeignDescriptor( |
1650 factory()->empty_descriptor_array(), | 1647 factory()->empty_descriptor_array(), |
1651 factory()->length_symbol(), | 1648 factory()->length_symbol(), |
1652 factory()->NewForeign(&Accessors::ArrayLength), | 1649 factory()->NewForeign(&Accessors::ArrayLength), |
1653 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); | 1650 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE)); |
1654 | 1651 |
1655 array_function->initial_map()->set_instance_descriptors( | 1652 array_function->initial_map()->set_instance_descriptors( |
1656 *array_descriptors); | 1653 *array_descriptors); |
| 1654 |
| 1655 global_context()->set_internal_array_function(*array_function); |
1657 } | 1656 } |
1658 | 1657 |
1659 if (FLAG_disable_native_files) { | 1658 if (FLAG_disable_native_files) { |
1660 PrintF("Warning: Running without installed natives!\n"); | 1659 PrintF("Warning: Running without installed natives!\n"); |
1661 return true; | 1660 return true; |
1662 } | 1661 } |
1663 | 1662 |
1664 // Install natives. | 1663 // Install natives. |
1665 for (int i = Natives::GetDebuggerCount(); | 1664 for (int i = Natives::GetDebuggerCount(); |
1666 i < Natives::GetBuiltinsCount(); | 1665 i < Natives::GetBuiltinsCount(); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2355 return from + sizeof(NestingCounterType); | 2354 return from + sizeof(NestingCounterType); |
2356 } | 2355 } |
2357 | 2356 |
2358 | 2357 |
2359 // Called when the top-level V8 mutex is destroyed. | 2358 // Called when the top-level V8 mutex is destroyed. |
2360 void Bootstrapper::FreeThreadResources() { | 2359 void Bootstrapper::FreeThreadResources() { |
2361 ASSERT(!IsActive()); | 2360 ASSERT(!IsActive()); |
2362 } | 2361 } |
2363 | 2362 |
2364 } } // namespace v8::internal | 2363 } } // namespace v8::internal |
OLD | NEW |