| OLD | NEW | 
|---|
| 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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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  Loading... | 
| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2685   return from + sizeof(NestingCounterType); | 2673   return from + sizeof(NestingCounterType); | 
| 2686 } | 2674 } | 
| 2687 | 2675 | 
| 2688 | 2676 | 
| 2689 // Called when the top-level V8 mutex is destroyed. | 2677 // Called when the top-level V8 mutex is destroyed. | 
| 2690 void Bootstrapper::FreeThreadResources() { | 2678 void Bootstrapper::FreeThreadResources() { | 
| 2691   ASSERT(!IsActive()); | 2679   ASSERT(!IsActive()); | 
| 2692 } | 2680 } | 
| 2693 | 2681 | 
| 2694 } }  // namespace v8::internal | 2682 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|