OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 Handle<Map> initial_map(regexp_fun->initial_map()); | 1037 Handle<Map> initial_map(regexp_fun->initial_map()); |
1038 | 1038 |
1039 DCHECK_EQ(0, initial_map->inobject_properties()); | 1039 DCHECK_EQ(0, initial_map->inobject_properties()); |
1040 | 1040 |
1041 PropertyAttributes final = | 1041 PropertyAttributes final = |
1042 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | 1042 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); |
1043 Map::EnsureDescriptorSlack(initial_map, 5); | 1043 Map::EnsureDescriptorSlack(initial_map, 5); |
1044 | 1044 |
1045 { | 1045 { |
1046 // ECMA-262, section 15.10.7.1. | 1046 // ECMA-262, section 15.10.7.1. |
1047 FieldDescriptor field(factory->source_string(), | 1047 Handle<AccessorInfo> regexp_source( |
1048 JSRegExp::kSourceFieldIndex, | 1048 Accessors::RegExpSourceInfo(isolate, final)); |
1049 final, | 1049 CallbacksDescriptor d(factory->source_string(), regexp_source, final); |
1050 Representation::Tagged()); | 1050 initial_map->AppendDescriptor(&d); |
1051 initial_map->AppendDescriptor(&field); | |
1052 } | 1051 } |
1053 { | 1052 { |
1054 // ECMA-262, section 15.10.7.2. | 1053 // ECMA-262, section 15.10.7.2. |
1055 FieldDescriptor field(factory->global_string(), | 1054 FieldDescriptor field(factory->global_string(), |
1056 JSRegExp::kGlobalFieldIndex, | 1055 JSRegExp::kGlobalFieldIndex, |
1057 final, | 1056 final, |
1058 Representation::Tagged()); | 1057 Representation::Tagged()); |
1059 initial_map->AppendDescriptor(&field); | 1058 initial_map->AppendDescriptor(&field); |
1060 } | 1059 } |
1061 { | 1060 { |
(...skipping 16 matching lines...) Expand all Loading... |
1078 // ECMA-262, section 15.10.7.5. | 1077 // ECMA-262, section 15.10.7.5. |
1079 PropertyAttributes writable = | 1078 PropertyAttributes writable = |
1080 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | 1079 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
1081 FieldDescriptor field(factory->last_index_string(), | 1080 FieldDescriptor field(factory->last_index_string(), |
1082 JSRegExp::kLastIndexFieldIndex, | 1081 JSRegExp::kLastIndexFieldIndex, |
1083 writable, | 1082 writable, |
1084 Representation::Tagged()); | 1083 Representation::Tagged()); |
1085 initial_map->AppendDescriptor(&field); | 1084 initial_map->AppendDescriptor(&field); |
1086 } | 1085 } |
1087 | 1086 |
1088 initial_map->set_inobject_properties(5); | 1087 static const int num_fields = JSRegExp::kInObjectFieldCount; |
1089 initial_map->set_pre_allocated_property_fields(5); | 1088 initial_map->set_inobject_properties(num_fields); |
| 1089 initial_map->set_pre_allocated_property_fields(num_fields); |
1090 initial_map->set_unused_property_fields(0); | 1090 initial_map->set_unused_property_fields(0); |
1091 initial_map->set_instance_size( | 1091 initial_map->set_instance_size(initial_map->instance_size() + |
1092 initial_map->instance_size() + 5 * kPointerSize); | 1092 num_fields * kPointerSize); |
1093 | 1093 |
1094 // RegExp prototype object is itself a RegExp. | 1094 // RegExp prototype object is itself a RegExp. |
1095 Handle<Map> proto_map = Map::Copy(initial_map, "RegExpPrototype"); | 1095 Handle<Map> proto_map = Map::Copy(initial_map, "RegExpPrototype"); |
1096 proto_map->set_prototype(native_context()->initial_object_prototype()); | 1096 proto_map->set_prototype(native_context()->initial_object_prototype()); |
1097 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map); | 1097 Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map); |
1098 proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, | |
1099 heap->query_colon_string()); | |
1100 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, | 1098 proto->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, |
1101 heap->false_value()); | 1099 heap->false_value()); |
1102 proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, | 1100 proto->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, |
1103 heap->false_value()); | 1101 heap->false_value()); |
1104 proto->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, | 1102 proto->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, |
1105 heap->false_value()); | 1103 heap->false_value()); |
1106 proto->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, | 1104 proto->InObjectPropertyAtPut(JSRegExp::kLastIndexFieldIndex, |
1107 Smi::FromInt(0), | 1105 Smi::FromInt(0), |
1108 SKIP_WRITE_BARRIER); // It's a Smi. | 1106 SKIP_WRITE_BARRIER); // It's a Smi. |
1109 proto_map->set_is_prototype_map(true); | 1107 proto_map->set_is_prototype_map(true); |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 return from + sizeof(NestingCounterType); | 2829 return from + sizeof(NestingCounterType); |
2832 } | 2830 } |
2833 | 2831 |
2834 | 2832 |
2835 // Called when the top-level V8 mutex is destroyed. | 2833 // Called when the top-level V8 mutex is destroyed. |
2836 void Bootstrapper::FreeThreadResources() { | 2834 void Bootstrapper::FreeThreadResources() { |
2837 DCHECK(!IsActive()); | 2835 DCHECK(!IsActive()); |
2838 } | 2836 } |
2839 | 2837 |
2840 } } // namespace v8::internal | 2838 } } // namespace v8::internal |
OLD | NEW |