| 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/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 1216 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
| 1217 isolate->initial_object_prototype(), | 1217 isolate->initial_object_prototype(), |
| 1218 Builtins::kIllegal); | 1218 Builtins::kIllegal); |
| 1219 native_context()->set_regexp_function(*regexp_fun); | 1219 native_context()->set_regexp_function(*regexp_fun); |
| 1220 | 1220 |
| 1221 DCHECK(regexp_fun->has_initial_map()); | 1221 DCHECK(regexp_fun->has_initial_map()); |
| 1222 Handle<Map> initial_map(regexp_fun->initial_map()); | 1222 Handle<Map> initial_map(regexp_fun->initial_map()); |
| 1223 | 1223 |
| 1224 DCHECK_EQ(0, initial_map->GetInObjectProperties()); | 1224 DCHECK_EQ(0, initial_map->GetInObjectProperties()); |
| 1225 | 1225 |
| 1226 PropertyAttributes final = | 1226 Map::EnsureDescriptorSlack(initial_map, 1); |
| 1227 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | |
| 1228 Map::EnsureDescriptorSlack(initial_map, 5); | |
| 1229 | 1227 |
| 1230 { | 1228 // ECMA-262, section 15.10.7.5. |
| 1231 // ES6 21.2.3.2.1 | 1229 PropertyAttributes writable = |
| 1232 DataDescriptor field(factory->regexp_source_symbol(), | 1230 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); |
| 1233 JSRegExp::kSourceFieldIndex, final, | 1231 DataDescriptor field(factory->last_index_string(), |
| 1234 Representation::Tagged()); | 1232 JSRegExp::kLastIndexFieldIndex, writable, |
| 1235 initial_map->AppendDescriptor(&field); | 1233 Representation::Tagged()); |
| 1236 } | 1234 initial_map->AppendDescriptor(&field); |
| 1237 { | |
| 1238 DataDescriptor field(factory->regexp_flags_symbol(), | |
| 1239 JSRegExp::kFlagsFieldIndex, final, | |
| 1240 Representation::Smi()); | |
| 1241 initial_map->AppendDescriptor(&field); | |
| 1242 } | |
| 1243 { | |
| 1244 // ECMA-262, section 15.10.7.5. | |
| 1245 PropertyAttributes writable = | |
| 1246 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | |
| 1247 DataDescriptor field(factory->last_index_string(), | |
| 1248 JSRegExp::kLastIndexFieldIndex, writable, | |
| 1249 Representation::Tagged()); | |
| 1250 initial_map->AppendDescriptor(&field); | |
| 1251 } | |
| 1252 | 1235 |
| 1253 static const int num_fields = JSRegExp::kInObjectFieldCount; | 1236 static const int num_fields = JSRegExp::kInObjectFieldCount; |
| 1254 initial_map->SetInObjectProperties(num_fields); | 1237 initial_map->SetInObjectProperties(num_fields); |
| 1255 initial_map->set_unused_property_fields(0); | 1238 initial_map->set_unused_property_fields(0); |
| 1256 initial_map->set_instance_size(initial_map->instance_size() + | 1239 initial_map->set_instance_size(initial_map->instance_size() + |
| 1257 num_fields * kPointerSize); | 1240 num_fields * kPointerSize); |
| 1258 } | 1241 } |
| 1259 | 1242 |
| 1260 // Initialize the embedder data slot. | 1243 // Initialize the embedder data slot. |
| 1261 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1244 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 } | 3228 } |
| 3246 | 3229 |
| 3247 | 3230 |
| 3248 // Called when the top-level V8 mutex is destroyed. | 3231 // Called when the top-level V8 mutex is destroyed. |
| 3249 void Bootstrapper::FreeThreadResources() { | 3232 void Bootstrapper::FreeThreadResources() { |
| 3250 DCHECK(!IsActive()); | 3233 DCHECK(!IsActive()); |
| 3251 } | 3234 } |
| 3252 | 3235 |
| 3253 } // namespace internal | 3236 } // namespace internal |
| 3254 } // namespace v8 | 3237 } // namespace v8 |
| OLD | NEW |