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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); | 1261 Handle<FixedArray> embedder_data = factory->NewFixedArray(3); |
1262 native_context()->set_embedder_data(*embedder_data); | 1262 native_context()->set_embedder_data(*embedder_data); |
1263 | 1263 |
1264 if (context_type == THIN_CONTEXT) return; | 1264 if (context_type == THIN_CONTEXT) return; |
1265 | 1265 |
1266 { // -- J S O N | 1266 { // -- J S O N |
1267 Handle<String> name = factory->InternalizeUtf8String("JSON"); | 1267 Handle<String> name = factory->InternalizeUtf8String("JSON"); |
1268 Handle<JSFunction> cons = factory->NewFunction(name); | 1268 Handle<JSFunction> cons = factory->NewFunction(name); |
1269 JSFunction::SetInstancePrototype(cons, | 1269 JSFunction::SetInstancePrototype(cons, |
1270 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1270 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1271 cons->SetInstanceClassName(*name); | 1271 cons->shared()->set_instance_class_name(*name); |
1272 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1272 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
1273 DCHECK(json_object->IsJSObject()); | 1273 DCHECK(json_object->IsJSObject()); |
1274 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1274 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
1275 } | 1275 } |
1276 | 1276 |
1277 { // -- M a t h | 1277 { // -- M a t h |
1278 Handle<String> name = factory->InternalizeUtf8String("Math"); | 1278 Handle<String> name = factory->InternalizeUtf8String("Math"); |
1279 Handle<JSFunction> cons = factory->NewFunction(name); | 1279 Handle<JSFunction> cons = factory->NewFunction(name); |
1280 JSFunction::SetInstancePrototype( | 1280 JSFunction::SetInstancePrototype( |
1281 cons, | 1281 cons, |
1282 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 1282 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
1283 cons->SetInstanceClassName(*name); | 1283 cons->shared()->set_instance_class_name(*name); |
1284 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); | 1284 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); |
1285 DCHECK(json_object->IsJSObject()); | 1285 DCHECK(json_object->IsJSObject()); |
1286 JSObject::AddProperty(global, name, json_object, DONT_ENUM); | 1286 JSObject::AddProperty(global, name, json_object, DONT_ENUM); |
1287 } | 1287 } |
1288 | 1288 |
1289 { // -- A r r a y B u f f e r | 1289 { // -- A r r a y B u f f e r |
1290 Handle<JSFunction> array_buffer_fun = | 1290 Handle<JSFunction> array_buffer_fun = |
1291 InstallFunction( | 1291 InstallFunction( |
1292 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, | 1292 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, |
1293 JSArrayBuffer::kSizeWithInternalFields, | 1293 JSArrayBuffer::kSizeWithInternalFields, |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 Handle<JSGlobalObject> global( | 2176 Handle<JSGlobalObject> global( |
2177 JSGlobalObject::cast(native_context()->global_object())); | 2177 JSGlobalObject::cast(native_context()->global_object())); |
2178 Isolate* isolate = global->GetIsolate(); | 2178 Isolate* isolate = global->GetIsolate(); |
2179 Factory* factory = isolate->factory(); | 2179 Factory* factory = isolate->factory(); |
2180 | 2180 |
2181 Handle<String> name = factory->InternalizeUtf8String("SIMD"); | 2181 Handle<String> name = factory->InternalizeUtf8String("SIMD"); |
2182 Handle<JSFunction> cons = factory->NewFunction(name); | 2182 Handle<JSFunction> cons = factory->NewFunction(name); |
2183 JSFunction::SetInstancePrototype( | 2183 JSFunction::SetInstancePrototype( |
2184 cons, | 2184 cons, |
2185 Handle<Object>(native_context()->initial_object_prototype(), isolate)); | 2185 Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
2186 cons->SetInstanceClassName(*name); | 2186 cons->shared()->set_instance_class_name(*name); |
2187 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); | 2187 Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); |
2188 DCHECK(simd_object->IsJSObject()); | 2188 DCHECK(simd_object->IsJSObject()); |
2189 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); | 2189 JSObject::AddProperty(global, name, simd_object, DONT_ENUM); |
2190 | 2190 |
2191 // Install SIMD type functions. Set the instance class names since | 2191 // Install SIMD type functions. Set the instance class names since |
2192 // InstallFunction only does this when we install on the JSGlobalObject. | 2192 // InstallFunction only does this when we install on the JSGlobalObject. |
2193 #define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \ | 2193 #define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \ |
2194 Handle<JSFunction> type##_function = InstallFunction( \ | 2194 Handle<JSFunction> type##_function = InstallFunction( \ |
2195 simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \ | 2195 simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \ |
2196 isolate->initial_object_prototype(), Builtins::kIllegal); \ | 2196 isolate->initial_object_prototype(), Builtins::kIllegal); \ |
2197 native_context()->set_##type##_function(*type##_function); \ | 2197 native_context()->set_##type##_function(*type##_function); \ |
2198 type##_function->SetInstanceClassName(*factory->Type##_string()); | 2198 type##_function->shared()->set_instance_class_name(*factory->Type##_string()); |
2199 SIMD128_TYPES(SIMD128_INSTALL_FUNCTION) | 2199 SIMD128_TYPES(SIMD128_INSTALL_FUNCTION) |
2200 #undef SIMD128_INSTALL_FUNCTION | 2200 #undef SIMD128_INSTALL_FUNCTION |
2201 } | 2201 } |
2202 | 2202 |
2203 | 2203 |
2204 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, | 2204 Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target, |
2205 const char* name, | 2205 const char* name, |
2206 ElementsKind elements_kind) { | 2206 ElementsKind elements_kind) { |
2207 // --- I n t e r n a l A r r a y --- | 2207 // --- I n t e r n a l A r r a y --- |
2208 // An array constructor on the builtins object that works like | 2208 // An array constructor on the builtins object that works like |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 } | 3245 } |
3246 | 3246 |
3247 | 3247 |
3248 // Called when the top-level V8 mutex is destroyed. | 3248 // Called when the top-level V8 mutex is destroyed. |
3249 void Bootstrapper::FreeThreadResources() { | 3249 void Bootstrapper::FreeThreadResources() { |
3250 DCHECK(!IsActive()); | 3250 DCHECK(!IsActive()); |
3251 } | 3251 } |
3252 | 3252 |
3253 } // namespace internal | 3253 } // namespace internal |
3254 } // namespace v8 | 3254 } // namespace v8 |
OLD | NEW |