Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/bootstrapper.cc

Issue 148573005: A64: Synchronize with r16249. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // Allocate a new prototype for the object function. 484 // Allocate a new prototype for the object function.
485 Handle<JSObject> prototype = factory->NewJSObject( 485 Handle<JSObject> prototype = factory->NewJSObject(
486 isolate->object_function(), 486 isolate->object_function(),
487 TENURED); 487 TENURED);
488 488
489 native_context()->set_initial_object_prototype(*prototype); 489 native_context()->set_initial_object_prototype(*prototype);
490 // For bootstrapping set the array prototype to be the same as the object 490 // For bootstrapping set the array prototype to be the same as the object
491 // prototype, otherwise the missing initial_array_prototype will cause 491 // prototype, otherwise the missing initial_array_prototype will cause
492 // assertions during startup. 492 // assertions during startup.
493 native_context()->set_initial_array_prototype(*prototype); 493 native_context()->set_initial_array_prototype(*prototype);
494 SetPrototype(object_fun, prototype); 494 Accessors::FunctionSetPrototype(object_fun, prototype);
495 } 495 }
496 496
497 // Allocate the empty function as the prototype for function ECMAScript 497 // Allocate the empty function as the prototype for function ECMAScript
498 // 262 15.3.4. 498 // 262 15.3.4.
499 Handle<String> empty_string = 499 Handle<String> empty_string =
500 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty")); 500 factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty"));
501 Handle<JSFunction> empty_function = 501 Handle<JSFunction> empty_function =
502 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE); 502 factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE);
503 503
504 // --- E m p t y --- 504 // --- E m p t y ---
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 Handle<Object>(native_context()->initial_object_prototype(), isolate)); 1057 Handle<Object>(native_context()->initial_object_prototype(), isolate));
1058 cons->SetInstanceClassName(*name); 1058 cons->SetInstanceClassName(*name);
1059 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); 1059 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
1060 ASSERT(json_object->IsJSObject()); 1060 ASSERT(json_object->IsJSObject());
1061 CHECK_NOT_EMPTY_HANDLE(isolate, 1061 CHECK_NOT_EMPTY_HANDLE(isolate,
1062 JSObject::SetLocalPropertyIgnoreAttributes( 1062 JSObject::SetLocalPropertyIgnoreAttributes(
1063 global, name, json_object, DONT_ENUM)); 1063 global, name, json_object, DONT_ENUM));
1064 native_context()->set_json_object(*json_object); 1064 native_context()->set_json_object(*json_object);
1065 } 1065 }
1066 1066
1067 { // -- A r r a y B u f f e r
1068 Handle<JSFunction> array_buffer_fun =
1069 InstallFunction(
1070 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1071 JSArrayBuffer::kSizeWithInternalFields,
1072 isolate->initial_object_prototype(),
1073 Builtins::kIllegal, true, true);
1074 native_context()->set_array_buffer_fun(*array_buffer_fun);
1075 }
1076
1077 { // -- T y p e d A r r a y s
1078 Handle<JSFunction> int8_fun = InstallTypedArray("Int8Array",
1079 EXTERNAL_BYTE_ELEMENTS);
1080 native_context()->set_int8_array_fun(*int8_fun);
1081 Handle<JSFunction> uint8_fun = InstallTypedArray("Uint8Array",
1082 EXTERNAL_UNSIGNED_BYTE_ELEMENTS);
1083 native_context()->set_uint8_array_fun(*uint8_fun);
1084 Handle<JSFunction> int16_fun = InstallTypedArray("Int16Array",
1085 EXTERNAL_SHORT_ELEMENTS);
1086 native_context()->set_int16_array_fun(*int16_fun);
1087 Handle<JSFunction> uint16_fun = InstallTypedArray("Uint16Array",
1088 EXTERNAL_UNSIGNED_SHORT_ELEMENTS);
1089 native_context()->set_uint16_array_fun(*uint16_fun);
1090 Handle<JSFunction> int32_fun = InstallTypedArray("Int32Array",
1091 EXTERNAL_INT_ELEMENTS);
1092 native_context()->set_int32_array_fun(*int32_fun);
1093 Handle<JSFunction> uint32_fun = InstallTypedArray("Uint32Array",
1094 EXTERNAL_UNSIGNED_INT_ELEMENTS);
1095 native_context()->set_uint32_array_fun(*uint32_fun);
1096 Handle<JSFunction> float_fun = InstallTypedArray("Float32Array",
1097 EXTERNAL_FLOAT_ELEMENTS);
1098 native_context()->set_float_array_fun(*float_fun);
1099 Handle<JSFunction> double_fun = InstallTypedArray("Float64Array",
1100 EXTERNAL_DOUBLE_ELEMENTS);
1101 native_context()->set_double_array_fun(*double_fun);
1102 Handle<JSFunction> uint8c_fun = InstallTypedArray("Uint8ClampedArray",
1103 EXTERNAL_PIXEL_ELEMENTS);
1104 native_context()->set_uint8c_array_fun(*uint8c_fun);
1105
1106 Handle<JSFunction> data_view_fun =
1107 InstallFunction(
1108 global, "DataView", JS_DATA_VIEW_TYPE,
1109 JSDataView::kSizeWithInternalFields,
1110 isolate->initial_object_prototype(),
1111 Builtins::kIllegal, true, true);
1112 native_context()->set_data_view_fun(*data_view_fun);
1113 }
1114
1067 { // --- arguments_boilerplate_ 1115 { // --- arguments_boilerplate_
1068 // Make sure we can recognize argument objects at runtime. 1116 // Make sure we can recognize argument objects at runtime.
1069 // This is done by introducing an anonymous function with 1117 // This is done by introducing an anonymous function with
1070 // class_name equals 'Arguments'. 1118 // class_name equals 'Arguments'.
1071 Handle<String> arguments_string = factory->InternalizeOneByteString( 1119 Handle<String> arguments_string = factory->InternalizeOneByteString(
1072 STATIC_ASCII_VECTOR("Arguments")); 1120 STATIC_ASCII_VECTOR("Arguments"));
1073 Handle<Code> code = Handle<Code>( 1121 Handle<Code> code = Handle<Code>(
1074 isolate->builtins()->builtin(Builtins::kIllegal)); 1122 isolate->builtins()->builtin(Builtins::kIllegal));
1075 Handle<JSObject> prototype = 1123 Handle<JSObject> prototype =
1076 Handle<JSObject>( 1124 Handle<JSObject>(
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 isolate()->initial_object_prototype(), 1372 isolate()->initial_object_prototype(),
1325 Builtins::kIllegal, true, true); 1373 Builtins::kIllegal, true, true);
1326 } 1374 }
1327 { // -- W e a k S e t 1375 { // -- W e a k S e t
1328 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, 1376 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1329 isolate()->initial_object_prototype(), 1377 isolate()->initial_object_prototype(),
1330 Builtins::kIllegal, true, true); 1378 Builtins::kIllegal, true, true);
1331 } 1379 }
1332 } 1380 }
1333 1381
1334 if (FLAG_harmony_array_buffer) {
1335 // -- A r r a y B u f f e r
1336 Handle<JSFunction> array_buffer_fun =
1337 InstallFunction(
1338 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1339 JSArrayBuffer::kSizeWithInternalFields,
1340 isolate()->initial_object_prototype(),
1341 Builtins::kIllegal, true, true);
1342 native_context()->set_array_buffer_fun(*array_buffer_fun);
1343 }
1344
1345 if (FLAG_harmony_typed_arrays) {
1346 // -- T y p e d A r r a y s
1347 Handle<JSFunction> int8_fun = InstallTypedArray("Int8Array",
1348 EXTERNAL_BYTE_ELEMENTS);
1349 native_context()->set_int8_array_fun(*int8_fun);
1350 Handle<JSFunction> uint8_fun = InstallTypedArray("Uint8Array",
1351 EXTERNAL_UNSIGNED_BYTE_ELEMENTS);
1352 native_context()->set_uint8_array_fun(*uint8_fun);
1353 Handle<JSFunction> int16_fun = InstallTypedArray("Int16Array",
1354 EXTERNAL_SHORT_ELEMENTS);
1355 native_context()->set_int16_array_fun(*int16_fun);
1356 Handle<JSFunction> uint16_fun = InstallTypedArray("Uint16Array",
1357 EXTERNAL_UNSIGNED_SHORT_ELEMENTS);
1358 native_context()->set_uint16_array_fun(*uint16_fun);
1359 Handle<JSFunction> int32_fun = InstallTypedArray("Int32Array",
1360 EXTERNAL_INT_ELEMENTS);
1361 native_context()->set_int32_array_fun(*int32_fun);
1362 Handle<JSFunction> uint32_fun = InstallTypedArray("Uint32Array",
1363 EXTERNAL_UNSIGNED_INT_ELEMENTS);
1364 native_context()->set_uint32_array_fun(*uint32_fun);
1365 Handle<JSFunction> float_fun = InstallTypedArray("Float32Array",
1366 EXTERNAL_FLOAT_ELEMENTS);
1367 native_context()->set_float_array_fun(*float_fun);
1368 Handle<JSFunction> double_fun = InstallTypedArray("Float64Array",
1369 EXTERNAL_DOUBLE_ELEMENTS);
1370 native_context()->set_double_array_fun(*double_fun);
1371 Handle<JSFunction> uint8c_fun = InstallTypedArray("Uint8ClampedArray",
1372 EXTERNAL_PIXEL_ELEMENTS);
1373 native_context()->set_uint8c_array_fun(*uint8c_fun);
1374
1375 Handle<JSFunction> data_view_fun =
1376 InstallFunction(
1377 global, "DataView", JS_DATA_VIEW_TYPE,
1378 JSDataView::kSizeWithInternalFields,
1379 isolate()->initial_object_prototype(),
1380 Builtins::kIllegal, true, true);
1381 native_context()->set_data_view_fun(*data_view_fun);
1382 }
1383
1384 if (FLAG_harmony_generators) { 1382 if (FLAG_harmony_generators) {
1385 // Create generator meta-objects and install them on the builtins object. 1383 // Create generator meta-objects and install them on the builtins object.
1386 Handle<JSObject> builtins(native_context()->builtins()); 1384 Handle<JSObject> builtins(native_context()->builtins());
1387 Handle<JSObject> generator_object_prototype = 1385 Handle<JSObject> generator_object_prototype =
1388 factory()->NewJSObject(isolate()->object_function(), TENURED); 1386 factory()->NewJSObject(isolate()->object_function(), TENURED);
1389 Handle<JSFunction> generator_function_prototype = 1387 Handle<JSFunction> generator_function_prototype =
1390 InstallFunction(builtins, "GeneratorFunctionPrototype", 1388 InstallFunction(builtins, "GeneratorFunctionPrototype",
1391 JS_FUNCTION_TYPE, JSFunction::kHeaderSize, 1389 JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
1392 generator_object_prototype, Builtins::kIllegal, 1390 generator_object_prototype, Builtins::kIllegal,
1393 false, false); 1391 false, false);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 Handle<JSFunction> array_function = 1623 Handle<JSFunction> array_function =
1626 InstallFunction(builtins, 1624 InstallFunction(builtins,
1627 name, 1625 name,
1628 JS_ARRAY_TYPE, 1626 JS_ARRAY_TYPE,
1629 JSArray::kSize, 1627 JSArray::kSize,
1630 isolate()->initial_object_prototype(), 1628 isolate()->initial_object_prototype(),
1631 Builtins::kInternalArrayCode, 1629 Builtins::kInternalArrayCode,
1632 true, true); 1630 true, true);
1633 Handle<JSObject> prototype = 1631 Handle<JSObject> prototype =
1634 factory()->NewJSObject(isolate()->object_function(), TENURED); 1632 factory()->NewJSObject(isolate()->object_function(), TENURED);
1635 SetPrototype(array_function, prototype); 1633 Accessors::FunctionSetPrototype(array_function, prototype);
1636 1634
1637 InternalArrayConstructorStub internal_array_constructor_stub(isolate()); 1635 InternalArrayConstructorStub internal_array_constructor_stub(isolate());
1638 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate()); 1636 Handle<Code> code = internal_array_constructor_stub.GetCode(isolate());
1639 array_function->shared()->set_construct_stub(*code); 1637 array_function->shared()->set_construct_stub(*code);
1640 array_function->shared()->DontAdaptArguments(); 1638 array_function->shared()->DontAdaptArguments();
1641 1639
1642 Handle<Map> original_map(array_function->initial_map()); 1640 Handle<Map> original_map(array_function->initial_map());
1643 Handle<Map> initial_map = factory()->CopyMap(original_map); 1641 Handle<Map> initial_map = factory()->CopyMap(original_map);
1644 initial_map->set_elements_kind(elements_kind); 1642 initial_map->set_elements_kind(elements_kind);
1645 array_function->set_initial_map(*initial_map); 1643 array_function->set_initial_map(*initial_map);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 native_context()->set_runtime_context(*context); 1721 native_context()->set_runtime_context(*context);
1724 1722
1725 { // -- S c r i p t 1723 { // -- S c r i p t
1726 // Builtin functions for Script. 1724 // Builtin functions for Script.
1727 Handle<JSFunction> script_fun = 1725 Handle<JSFunction> script_fun =
1728 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, 1726 InstallFunction(builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
1729 isolate()->initial_object_prototype(), 1727 isolate()->initial_object_prototype(),
1730 Builtins::kIllegal, false, false); 1728 Builtins::kIllegal, false, false);
1731 Handle<JSObject> prototype = 1729 Handle<JSObject> prototype =
1732 factory()->NewJSObject(isolate()->object_function(), TENURED); 1730 factory()->NewJSObject(isolate()->object_function(), TENURED);
1733 SetPrototype(script_fun, prototype); 1731 Accessors::FunctionSetPrototype(script_fun, prototype);
1734 native_context()->set_script_function(*script_fun); 1732 native_context()->set_script_function(*script_fun);
1735 1733
1736 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); 1734 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1737 1735
1738 Handle<DescriptorArray> script_descriptors( 1736 Handle<DescriptorArray> script_descriptors(
1739 factory()->NewDescriptorArray(0, 13)); 1737 factory()->NewDescriptorArray(0, 13));
1740 DescriptorArray::WhitenessWitness witness(*script_descriptors); 1738 DescriptorArray::WhitenessWitness witness(*script_descriptors);
1741 1739
1742 Handle<Foreign> script_source( 1740 Handle<Foreign> script_source(
1743 factory()->NewForeign(&Accessors::ScriptSource)); 1741 factory()->NewForeign(&Accessors::ScriptSource));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 // Builtin function for OpaqueReference -- a JSValue-based object, 1877 // Builtin function for OpaqueReference -- a JSValue-based object,
1880 // that keeps its field isolated from JavaScript code. It may store 1878 // that keeps its field isolated from JavaScript code. It may store
1881 // objects, that JavaScript code may not access. 1879 // objects, that JavaScript code may not access.
1882 Handle<JSFunction> opaque_reference_fun = 1880 Handle<JSFunction> opaque_reference_fun =
1883 InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE, 1881 InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE,
1884 JSValue::kSize, 1882 JSValue::kSize,
1885 isolate()->initial_object_prototype(), 1883 isolate()->initial_object_prototype(),
1886 Builtins::kIllegal, false, false); 1884 Builtins::kIllegal, false, false);
1887 Handle<JSObject> prototype = 1885 Handle<JSObject> prototype =
1888 factory()->NewJSObject(isolate()->object_function(), TENURED); 1886 factory()->NewJSObject(isolate()->object_function(), TENURED);
1889 SetPrototype(opaque_reference_fun, prototype); 1887 Accessors::FunctionSetPrototype(opaque_reference_fun, prototype);
1890 native_context()->set_opaque_reference_function(*opaque_reference_fun); 1888 native_context()->set_opaque_reference_function(*opaque_reference_fun);
1891 } 1889 }
1892 1890
1893 // InternalArrays should not use Smi-Only array optimizations. There are too 1891 // InternalArrays should not use Smi-Only array optimizations. There are too
1894 // many places in the C++ runtime code (e.g. RegEx) that assume that 1892 // many places in the C++ runtime code (e.g. RegEx) that assume that
1895 // elements in InternalArrays can be set to non-Smi values without going 1893 // elements in InternalArrays can be set to non-Smi values without going
1896 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT 1894 // through a common bottleneck that would make the SMI_ONLY -> FAST_ELEMENT
1897 // transition easy to trap. Moreover, they rarely are smi-only. 1895 // transition easy to trap. Moreover, they rarely are smi-only.
1898 { 1896 {
1899 Handle<JSFunction> array_function = 1897 Handle<JSFunction> array_function =
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 if (FLAG_harmony_collections && 2051 if (FLAG_harmony_collections &&
2054 strcmp(ExperimentalNatives::GetScriptName(i).start(), 2052 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2055 "native collection.js") == 0) { 2053 "native collection.js") == 0) {
2056 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 2054 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2057 } 2055 }
2058 if (FLAG_harmony_observation && 2056 if (FLAG_harmony_observation &&
2059 strcmp(ExperimentalNatives::GetScriptName(i).start(), 2057 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2060 "native object-observe.js") == 0) { 2058 "native object-observe.js") == 0) {
2061 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 2059 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2062 } 2060 }
2063 if (FLAG_harmony_array_buffer &&
2064 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2065 "native arraybuffer.js") == 0) {
2066 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2067 }
2068 if (FLAG_harmony_typed_arrays &&
2069 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2070 "native typedarray.js") == 0) {
2071 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2072 }
2073 if (FLAG_harmony_generators && 2061 if (FLAG_harmony_generators &&
2074 strcmp(ExperimentalNatives::GetScriptName(i).start(), 2062 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2075 "native generator.js") == 0) { 2063 "native generator.js") == 0) {
2076 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 2064 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2077 } 2065 }
2078 if (FLAG_harmony_iteration && 2066 if (FLAG_harmony_iteration &&
2079 strcmp(ExperimentalNatives::GetScriptName(i).start(), 2067 strcmp(ExperimentalNatives::GetScriptName(i).start(),
2080 "native array-iterator.js") == 0) { 2068 "native array-iterator.js") == 0) {
2081 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 2069 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
2082 } 2070 }
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 return from + sizeof(NestingCounterType); 2675 return from + sizeof(NestingCounterType);
2688 } 2676 }
2689 2677
2690 2678
2691 // Called when the top-level V8 mutex is destroyed. 2679 // Called when the top-level V8 mutex is destroyed.
2692 void Bootstrapper::FreeThreadResources() { 2680 void Bootstrapper::FreeThreadResources() {
2693 ASSERT(!IsActive()); 2681 ASSERT(!IsActive());
2694 } 2682 }
2695 2683
2696 } } // namespace v8::internal 2684 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698