Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 8a9fa4bf69741185e0af36912d653822555ee6a3..717bb2544a8ceadc0d587d62d77d0c35546b3c07 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -723,8 +723,67 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global, |
InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
Top::initial_object_prototype(), Builtins::Illegal, |
true); |
- |
global_context()->set_regexp_function(*regexp_fun); |
+ |
+ ASSERT(regexp_fun->has_initial_map()); |
+ Handle<Map> initial_map(regexp_fun->initial_map()); |
+ |
+ ASSERT_EQ(0, initial_map->inobject_properties()); |
+ |
+ Handle<DescriptorArray> descriptors = Factory::NewDescriptorArray(5); |
+ PropertyAttributes final = |
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
+ { |
+ // ECMA-262, section 15.10.7.1. |
+ FieldDescriptor field(Heap::source_symbol(), |
+ JSRegExp::kSourceFieldIndex, |
+ final, |
+ 0); |
+ descriptors->Set(0, &field); |
+ } |
+ { |
+ // ECMA-262, section 15.10.7.2. |
+ FieldDescriptor field(Heap::global_symbol(), |
+ JSRegExp::kGlobalFieldIndex, |
+ final, |
+ 1); |
+ descriptors->Set(1, &field); |
+ } |
+ { |
+ // ECMA-262, section 15.10.7.3. |
+ FieldDescriptor field(Heap::ignore_case_symbol(), |
+ JSRegExp::kIgnoreCaseFieldIndex, |
+ final, |
+ 2); |
+ descriptors->Set(2, &field); |
+ } |
+ { |
+ // ECMA-262, section 15.10.7.4. |
+ FieldDescriptor field(Heap::multiline_symbol(), |
+ JSRegExp::kMultilineFieldIndex, |
+ final, |
+ 3); |
Erik Corry
2010/03/26 13:51:34
You already made a constant for this '3'.
Lasse Reichstein
2010/03/26 14:19:09
Actually, not. This "3" is the enumeration index,
|
+ descriptors->Set(3, &field); |
+ } |
+ { |
+ // ECMA-262, section 15.10.7.5. |
+ PropertyAttributes writable = |
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
+ FieldDescriptor field(Heap::last_index_symbol(), |
+ JSRegExp::kLastIndexFieldIndex, |
+ writable, |
+ 4); |
+ descriptors->Set(4, &field); |
+ } |
+ descriptors->SetNextEnumerationIndex(5); |
+ descriptors->Sort(); |
+ |
+ initial_map->set_inobject_properties(5); |
+ initial_map->set_pre_allocated_property_fields(5); |
+ initial_map->set_unused_property_fields(0); |
+ initial_map->set_instance_size( |
+ initial_map->instance_size() + 5 * kPointerSize); |
+ initial_map->set_instance_descriptors(*descriptors); |
} |
{ // -- J S O N |