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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 *fun = result; | 1348 *fun = result; |
1349 | 1349 |
1350 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); | 1350 ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind); |
1351 *external_map = Map::AsElementsKind(initial_map, external_kind); | 1351 *external_map = Map::AsElementsKind(initial_map, external_kind); |
1352 } | 1352 } |
1353 | 1353 |
1354 | 1354 |
1355 void Genesis::InitializeExperimentalGlobal() { | 1355 void Genesis::InitializeExperimentalGlobal() { |
1356 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no | 1356 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no |
1357 // longer need to live behind flags, so functions get added to the snapshot. | 1357 // longer need to live behind flags, so functions get added to the snapshot. |
| 1358 Handle<JSObject> builtins(native_context()->builtins()); |
1358 | 1359 |
1359 if (FLAG_harmony_generators) { | 1360 if (FLAG_harmony_generators) { |
1360 // Create generator meta-objects and install them on the builtins object. | 1361 // Create generator meta-objects and install them on the builtins object. |
1361 Handle<JSObject> builtins(native_context()->builtins()); | |
1362 Handle<JSObject> generator_object_prototype = | 1362 Handle<JSObject> generator_object_prototype = |
1363 factory()->NewJSObject(isolate()->object_function(), TENURED); | 1363 factory()->NewJSObject(isolate()->object_function(), TENURED); |
1364 Handle<JSFunction> generator_function_prototype = InstallFunction( | 1364 Handle<JSFunction> generator_function_prototype = InstallFunction( |
1365 builtins, "GeneratorFunctionPrototype", JS_FUNCTION_TYPE, | 1365 builtins, "GeneratorFunctionPrototype", JS_FUNCTION_TYPE, |
1366 JSFunction::kHeaderSize, generator_object_prototype, | 1366 JSFunction::kHeaderSize, generator_object_prototype, |
1367 Builtins::kIllegal); | 1367 Builtins::kIllegal); |
1368 InstallFunction(builtins, "GeneratorFunction", | 1368 InstallFunction(builtins, "GeneratorFunction", |
1369 JS_FUNCTION_TYPE, JSFunction::kSize, | 1369 JS_FUNCTION_TYPE, JSFunction::kSize, |
1370 generator_function_prototype, Builtins::kIllegal); | 1370 generator_function_prototype, Builtins::kIllegal); |
1371 | 1371 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 *strict_generator_function_map); | 1410 *strict_generator_function_map); |
1411 | 1411 |
1412 Handle<JSFunction> object_function(native_context()->object_function()); | 1412 Handle<JSFunction> object_function(native_context()->object_function()); |
1413 Handle<Map> generator_object_prototype_map = Map::Create( | 1413 Handle<Map> generator_object_prototype_map = Map::Create( |
1414 object_function, 0); | 1414 object_function, 0); |
1415 generator_object_prototype_map->set_prototype( | 1415 generator_object_prototype_map->set_prototype( |
1416 *generator_object_prototype); | 1416 *generator_object_prototype); |
1417 native_context()->set_generator_object_prototype_map( | 1417 native_context()->set_generator_object_prototype_map( |
1418 *generator_object_prototype_map); | 1418 *generator_object_prototype_map); |
1419 } | 1419 } |
| 1420 Handle<HeapObject> flag( |
| 1421 FLAG_harmony_regexps ? heap()->true_value() : heap()->false_value()); |
| 1422 PropertyAttributes attributes = |
| 1423 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
| 1424 Runtime::DefineObjectProperty(builtins, factory()->harmony_regexps_string(), |
| 1425 flag, attributes).Assert(); |
1420 } | 1426 } |
1421 | 1427 |
1422 | 1428 |
1423 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { | 1429 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { |
1424 Vector<const char> name = Natives::GetScriptName(index); | 1430 Vector<const char> name = Natives::GetScriptName(index); |
1425 Handle<String> source_code = | 1431 Handle<String> source_code = |
1426 isolate->bootstrapper()->NativesSourceLookup(index); | 1432 isolate->bootstrapper()->NativesSourceLookup(index); |
1427 return CompileNative(isolate, name, source_code); | 1433 return CompileNative(isolate, name, source_code); |
1428 } | 1434 } |
1429 | 1435 |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 return from + sizeof(NestingCounterType); | 2731 return from + sizeof(NestingCounterType); |
2726 } | 2732 } |
2727 | 2733 |
2728 | 2734 |
2729 // Called when the top-level V8 mutex is destroyed. | 2735 // Called when the top-level V8 mutex is destroyed. |
2730 void Bootstrapper::FreeThreadResources() { | 2736 void Bootstrapper::FreeThreadResources() { |
2731 DCHECK(!IsActive()); | 2737 DCHECK(!IsActive()); |
2732 } | 2738 } |
2733 | 2739 |
2734 } } // namespace v8::internal | 2740 } } // namespace v8::internal |
OLD | NEW |