| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 global_context()->set_date_function(*date_fun); | 716 global_context()->set_date_function(*date_fun); |
| 717 } | 717 } |
| 718 | 718 |
| 719 | 719 |
| 720 { // -- R e g E x p | 720 { // -- R e g E x p |
| 721 // Builtin functions for RegExp.prototype. | 721 // Builtin functions for RegExp.prototype. |
| 722 Handle<JSFunction> regexp_fun = | 722 Handle<JSFunction> regexp_fun = |
| 723 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 723 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
| 724 Top::initial_object_prototype(), Builtins::Illegal, | 724 Top::initial_object_prototype(), Builtins::Illegal, |
| 725 true); | 725 true); |
| 726 |
| 726 global_context()->set_regexp_function(*regexp_fun); | 727 global_context()->set_regexp_function(*regexp_fun); |
| 727 | |
| 728 ASSERT(regexp_fun->has_initial_map()); | |
| 729 Handle<Map> initial_map(regexp_fun->initial_map()); | |
| 730 | |
| 731 ASSERT_EQ(0, initial_map->inobject_properties()); | |
| 732 | |
| 733 Handle<DescriptorArray> descriptors = Factory::NewDescriptorArray(5); | |
| 734 PropertyAttributes final = | |
| 735 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | |
| 736 int enum_index = 0; | |
| 737 { | |
| 738 // ECMA-262, section 15.10.7.1. | |
| 739 FieldDescriptor field(Heap::source_symbol(), | |
| 740 JSRegExp::kSourceFieldIndex, | |
| 741 final, | |
| 742 enum_index++); | |
| 743 descriptors->Set(0, &field); | |
| 744 } | |
| 745 { | |
| 746 // ECMA-262, section 15.10.7.2. | |
| 747 FieldDescriptor field(Heap::global_symbol(), | |
| 748 JSRegExp::kGlobalFieldIndex, | |
| 749 final, | |
| 750 enum_index++); | |
| 751 descriptors->Set(1, &field); | |
| 752 } | |
| 753 { | |
| 754 // ECMA-262, section 15.10.7.3. | |
| 755 FieldDescriptor field(Heap::ignore_case_symbol(), | |
| 756 JSRegExp::kIgnoreCaseFieldIndex, | |
| 757 final, | |
| 758 enum_index++); | |
| 759 descriptors->Set(2, &field); | |
| 760 } | |
| 761 { | |
| 762 // ECMA-262, section 15.10.7.4. | |
| 763 FieldDescriptor field(Heap::multiline_symbol(), | |
| 764 JSRegExp::kMultilineFieldIndex, | |
| 765 final, | |
| 766 enum_index++); | |
| 767 descriptors->Set(3, &field); | |
| 768 } | |
| 769 { | |
| 770 // ECMA-262, section 15.10.7.5. | |
| 771 PropertyAttributes writable = | |
| 772 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | |
| 773 FieldDescriptor field(Heap::last_index_symbol(), | |
| 774 JSRegExp::kLastIndexFieldIndex, | |
| 775 writable, | |
| 776 enum_index++); | |
| 777 descriptors->Set(4, &field); | |
| 778 } | |
| 779 descriptors->SetNextEnumerationIndex(enum_index); | |
| 780 descriptors->Sort(); | |
| 781 | |
| 782 initial_map->set_inobject_properties(5); | |
| 783 initial_map->set_pre_allocated_property_fields(5); | |
| 784 initial_map->set_unused_property_fields(0); | |
| 785 initial_map->set_instance_size( | |
| 786 initial_map->instance_size() + 5 * kPointerSize); | |
| 787 initial_map->set_instance_descriptors(*descriptors); | |
| 788 } | 728 } |
| 789 | 729 |
| 790 { // -- J S O N | 730 { // -- J S O N |
| 791 Handle<String> name = Factory::NewStringFromAscii(CStrVector("JSON")); | 731 Handle<String> name = Factory::NewStringFromAscii(CStrVector("JSON")); |
| 792 Handle<JSFunction> cons = Factory::NewFunction( | 732 Handle<JSFunction> cons = Factory::NewFunction( |
| 793 name, | 733 name, |
| 794 Factory::the_hole_value()); | 734 Factory::the_hole_value()); |
| 795 cons->SetInstancePrototype(global_context()->initial_object_prototype()); | 735 cons->SetInstancePrototype(global_context()->initial_object_prototype()); |
| 796 cons->SetInstanceClassName(*name); | 736 cons->SetInstanceClassName(*name); |
| 797 Handle<JSObject> json_object = Factory::NewJSObject(cons, TENURED); | 737 Handle<JSObject> json_object = Factory::NewJSObject(cons, TENURED); |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 } | 1599 } |
| 1660 | 1600 |
| 1661 | 1601 |
| 1662 // Restore statics that are thread local. | 1602 // Restore statics that are thread local. |
| 1663 char* BootstrapperActive::RestoreState(char* from) { | 1603 char* BootstrapperActive::RestoreState(char* from) { |
| 1664 nesting_ = *reinterpret_cast<int*>(from); | 1604 nesting_ = *reinterpret_cast<int*>(from); |
| 1665 return from + sizeof(nesting_); | 1605 return from + sizeof(nesting_); |
| 1666 } | 1606 } |
| 1667 | 1607 |
| 1668 } } // namespace v8::internal | 1608 } } // namespace v8::internal |
| OLD | NEW |