OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 647 |
648 // Install global Function object | 648 // Install global Function object |
649 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, | 649 InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize, |
650 empty_function, Builtins::Illegal, true); // ECMA native. | 650 empty_function, Builtins::Illegal, true); // ECMA native. |
651 | 651 |
652 { // --- A r r a y --- | 652 { // --- A r r a y --- |
653 Handle<JSFunction> array_function = | 653 Handle<JSFunction> array_function = |
654 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, | 654 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, |
655 Top::initial_object_prototype(), Builtins::ArrayCode, | 655 Top::initial_object_prototype(), Builtins::ArrayCode, |
656 true); | 656 true); |
| 657 array_function->shared()->set_construct_stub( |
| 658 Builtins::builtin(Builtins::ArrayConstructCode)); |
657 array_function->shared()->DontAdaptArguments(); | 659 array_function->shared()->DontAdaptArguments(); |
658 | 660 |
659 // This seems a bit hackish, but we need to make sure Array.length | 661 // This seems a bit hackish, but we need to make sure Array.length |
660 // is 1. | 662 // is 1. |
661 array_function->shared()->set_length(1); | 663 array_function->shared()->set_length(1); |
662 Handle<DescriptorArray> array_descriptors = | 664 Handle<DescriptorArray> array_descriptors = |
663 Factory::CopyAppendProxyDescriptor( | 665 Factory::CopyAppendProxyDescriptor( |
664 Factory::empty_descriptor_array(), | 666 Factory::empty_descriptor_array(), |
665 Factory::length_symbol(), | 667 Factory::length_symbol(), |
666 Factory::NewProxy(&Accessors::ArrayLength), | 668 Factory::NewProxy(&Accessors::ArrayLength), |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 to->set_map(*new_to_map); | 1466 to->set_map(*new_to_map); |
1465 } | 1467 } |
1466 | 1468 |
1467 | 1469 |
1468 void Genesis::MakeFunctionInstancePrototypeWritable() { | 1470 void Genesis::MakeFunctionInstancePrototypeWritable() { |
1469 // Make a new function map so all future functions | 1471 // Make a new function map so all future functions |
1470 // will have settable and enumerable prototype properties. | 1472 // will have settable and enumerable prototype properties. |
1471 HandleScope scope; | 1473 HandleScope scope; |
1472 | 1474 |
1473 Handle<DescriptorArray> function_map_descriptors = | 1475 Handle<DescriptorArray> function_map_descriptors = |
1474 ComputeFunctionInstanceDescriptor(false, true); | 1476 ComputeFunctionInstanceDescriptor(false); |
1475 Handle<Map> fm = Factory::CopyMapDropDescriptors(Top::function_map()); | 1477 Handle<Map> fm = Factory::CopyMapDropDescriptors(Top::function_map()); |
1476 fm->set_instance_descriptors(*function_map_descriptors); | 1478 fm->set_instance_descriptors(*function_map_descriptors); |
1477 Top::context()->global_context()->set_function_map(*fm); | 1479 Top::context()->global_context()->set_function_map(*fm); |
1478 } | 1480 } |
1479 | 1481 |
1480 | 1482 |
1481 void Genesis::AddSpecialFunction(Handle<JSObject> prototype, | 1483 void Genesis::AddSpecialFunction(Handle<JSObject> prototype, |
1482 const char* name, | 1484 const char* name, |
1483 Handle<Code> code) { | 1485 Handle<Code> code) { |
1484 Handle<String> key = Factory::LookupAsciiSymbol(name); | 1486 Handle<String> key = Factory::LookupAsciiSymbol(name); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 } | 1600 } |
1599 | 1601 |
1600 | 1602 |
1601 // Restore statics that are thread local. | 1603 // Restore statics that are thread local. |
1602 char* Genesis::RestoreState(char* from) { | 1604 char* Genesis::RestoreState(char* from) { |
1603 current_ = *reinterpret_cast<Genesis**>(from); | 1605 current_ = *reinterpret_cast<Genesis**>(from); |
1604 return from + sizeof(current_); | 1606 return from + sizeof(current_); |
1605 } | 1607 } |
1606 | 1608 |
1607 } } // namespace v8::internal | 1609 } } // namespace v8::internal |
OLD | NEW |