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

Side by Side Diff: src/bootstrapper.cc

Issue 139973004: A64: Synchronize with r15814. (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/builtins.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Hooks the given global proxy into the context. If the context was created 193 // Hooks the given global proxy into the context. If the context was created
194 // by deserialization then this will unhook the global proxy that was 194 // by deserialization then this will unhook the global proxy that was
195 // deserialized, leaving the GC to pick it up. 195 // deserialized, leaving the GC to pick it up.
196 void HookUpGlobalProxy(Handle<GlobalObject> inner_global, 196 void HookUpGlobalProxy(Handle<GlobalObject> inner_global,
197 Handle<JSGlobalProxy> global_proxy); 197 Handle<JSGlobalProxy> global_proxy);
198 // Similarly, we want to use the inner global that has been created by the 198 // Similarly, we want to use the inner global that has been created by the
199 // templates passed through the API. The inner global from the snapshot is 199 // templates passed through the API. The inner global from the snapshot is
200 // detached from the other objects in the snapshot. 200 // detached from the other objects in the snapshot.
201 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); 201 void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
202 // New context initialization. Used for creating a context from scratch. 202 // New context initialization. Used for creating a context from scratch.
203 bool InitializeGlobal(Handle<GlobalObject> inner_global, 203 void InitializeGlobal(Handle<GlobalObject> inner_global,
204 Handle<JSFunction> empty_function); 204 Handle<JSFunction> empty_function);
205 void InitializeExperimentalGlobal(); 205 void InitializeExperimentalGlobal();
206 // Installs the contents of the native .js files on the global objects. 206 // Installs the contents of the native .js files on the global objects.
207 // Used for creating a context from scratch. 207 // Used for creating a context from scratch.
208 void InstallNativeFunctions(); 208 void InstallNativeFunctions();
209 void InstallExperimentalNativeFunctions(); 209 void InstallExperimentalNativeFunctions();
210 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, 210 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
211 const char* name, 211 const char* name,
212 ElementsKind elements_kind); 212 ElementsKind elements_kind);
213 bool InstallNatives(); 213 bool InstallNatives();
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 attributes); 822 attributes);
823 // Set up the reference from the global object to the builtins object. 823 // Set up the reference from the global object to the builtins object.
824 JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global); 824 JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
825 TransferNamedProperties(inner_global_from_snapshot, inner_global); 825 TransferNamedProperties(inner_global_from_snapshot, inner_global);
826 TransferIndexedProperties(inner_global_from_snapshot, inner_global); 826 TransferIndexedProperties(inner_global_from_snapshot, inner_global);
827 } 827 }
828 828
829 829
830 // This is only called if we are not using snapshots. The equivalent 830 // This is only called if we are not using snapshots. The equivalent
831 // work in the snapshot case is done in HookUpInnerGlobal. 831 // work in the snapshot case is done in HookUpInnerGlobal.
832 bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global, 832 void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
833 Handle<JSFunction> empty_function) { 833 Handle<JSFunction> empty_function) {
834 // --- G l o b a l C o n t e x t --- 834 // --- G l o b a l C o n t e x t ---
835 // Use the empty function as closure (no scope info). 835 // Use the empty function as closure (no scope info).
836 native_context()->set_closure(*empty_function); 836 native_context()->set_closure(*empty_function);
837 native_context()->set_previous(NULL); 837 native_context()->set_previous(NULL);
838 // Set extension and global object. 838 // Set extension and global object.
839 native_context()->set_extension(*inner_global); 839 native_context()->set_extension(*inner_global);
840 native_context()->set_global_object(*inner_global); 840 native_context()->set_global_object(*inner_global);
841 // Security setup: Set the security token of the global object to 841 // Security setup: Set the security token of the global object to
842 // its the inner global. This makes the security check between two 842 // its the inner global. This makes the security check between two
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 initial_map->set_prototype(*proto); 1046 initial_map->set_prototype(*proto);
1047 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto), 1047 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto),
1048 JSRegExp::IRREGEXP, factory->empty_string(), 1048 JSRegExp::IRREGEXP, factory->empty_string(),
1049 JSRegExp::Flags(0), 0); 1049 JSRegExp::Flags(0), 0);
1050 } 1050 }
1051 1051
1052 { // -- J S O N 1052 { // -- J S O N
1053 Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON")); 1053 Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON"));
1054 Handle<JSFunction> cons = factory->NewFunction(name, 1054 Handle<JSFunction> cons = factory->NewFunction(name,
1055 factory->the_hole_value()); 1055 factory->the_hole_value());
1056 { MaybeObject* result = cons->SetInstancePrototype( 1056 JSFunction::SetInstancePrototype(cons,
1057 native_context()->initial_object_prototype()); 1057 Handle<Object>(native_context()->initial_object_prototype(), isolate));
1058 if (result->IsFailure()) return false;
1059 }
1060 cons->SetInstanceClassName(*name); 1058 cons->SetInstanceClassName(*name);
1061 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); 1059 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
1062 ASSERT(json_object->IsJSObject()); 1060 ASSERT(json_object->IsJSObject());
1063 CHECK_NOT_EMPTY_HANDLE(isolate, 1061 CHECK_NOT_EMPTY_HANDLE(isolate,
1064 JSObject::SetLocalPropertyIgnoreAttributes( 1062 JSObject::SetLocalPropertyIgnoreAttributes(
1065 global, name, json_object, DONT_ENUM)); 1063 global, name, json_object, DONT_ENUM));
1066 native_context()->set_json_object(*json_object); 1064 native_context()->set_json_object(*json_object);
1067 } 1065 }
1068 1066
1069 { // --- arguments_boilerplate_ 1067 { // --- arguments_boilerplate_
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 Handle<FixedArray> embedder_data = factory->NewFixedArray(2); 1268 Handle<FixedArray> embedder_data = factory->NewFixedArray(2);
1271 native_context()->set_embedder_data(*embedder_data); 1269 native_context()->set_embedder_data(*embedder_data);
1272 1270
1273 { 1271 {
1274 // Initialize the random seed slot. 1272 // Initialize the random seed slot.
1275 Handle<ByteArray> zeroed_byte_array( 1273 Handle<ByteArray> zeroed_byte_array(
1276 factory->NewByteArray(kRandomStateSize)); 1274 factory->NewByteArray(kRandomStateSize));
1277 native_context()->set_random_seed(*zeroed_byte_array); 1275 native_context()->set_random_seed(*zeroed_byte_array);
1278 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize); 1276 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize);
1279 } 1277 }
1280 return true;
1281 } 1278 }
1282 1279
1283 1280
1284 Handle<JSFunction> Genesis::InstallTypedArray( 1281 Handle<JSFunction> Genesis::InstallTypedArray(
1285 const char* name, ElementsKind elementsKind) { 1282 const char* name, ElementsKind elementsKind) {
1286 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1283 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1287 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, 1284 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
1288 JSTypedArray::kSize, isolate()->initial_object_prototype(), 1285 JSTypedArray::kSize, isolate()->initial_object_prototype(),
1289 Builtins::kIllegal, false, true); 1286 Builtins::kIllegal, false, true);
1290 1287
(...skipping 29 matching lines...) Expand all
1320 { // -- M a p 1317 { // -- M a p
1321 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize, 1318 InstallFunction(global, "Map", JS_MAP_TYPE, JSMap::kSize,
1322 isolate()->initial_object_prototype(), 1319 isolate()->initial_object_prototype(),
1323 Builtins::kIllegal, true, true); 1320 Builtins::kIllegal, true, true);
1324 } 1321 }
1325 { // -- W e a k M a p 1322 { // -- W e a k M a p
1326 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize, 1323 InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
1327 isolate()->initial_object_prototype(), 1324 isolate()->initial_object_prototype(),
1328 Builtins::kIllegal, true, true); 1325 Builtins::kIllegal, true, true);
1329 } 1326 }
1327 { // -- W e a k S e t
1328 InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
1329 isolate()->initial_object_prototype(),
1330 Builtins::kIllegal, true, true);
1331 }
1330 } 1332 }
1331 1333
1332 if (FLAG_harmony_array_buffer) { 1334 if (FLAG_harmony_array_buffer) {
1333 // -- A r r a y B u f f e r 1335 // -- A r r a y B u f f e r
1334 Handle<JSFunction> array_buffer_fun = 1336 Handle<JSFunction> array_buffer_fun =
1335 InstallFunction( 1337 InstallFunction(
1336 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE, 1338 global, "ArrayBuffer", JS_ARRAY_BUFFER_TYPE,
1337 JSArrayBuffer::kSizeWithInternalFields, 1339 JSArrayBuffer::kSizeWithInternalFields,
1338 isolate()->initial_object_prototype(), 1340 isolate()->initial_object_prototype(),
1339 Builtins::kIllegal, true, true); 1341 Builtins::kIllegal, true, true);
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 if (!ConfigureGlobalObjects(global_template)) return; 2627 if (!ConfigureGlobalObjects(global_template)) return;
2626 } else { 2628 } else {
2627 // We get here if there was no context snapshot. 2629 // We get here if there was no context snapshot.
2628 CreateRoots(); 2630 CreateRoots();
2629 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 2631 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
2630 CreateStrictModeFunctionMaps(empty_function); 2632 CreateStrictModeFunctionMaps(empty_function);
2631 Handle<GlobalObject> inner_global; 2633 Handle<GlobalObject> inner_global;
2632 Handle<JSGlobalProxy> global_proxy = 2634 Handle<JSGlobalProxy> global_proxy =
2633 CreateNewGlobals(global_template, global_object, &inner_global); 2635 CreateNewGlobals(global_template, global_object, &inner_global);
2634 HookUpGlobalProxy(inner_global, global_proxy); 2636 HookUpGlobalProxy(inner_global, global_proxy);
2635 if (!InitializeGlobal(inner_global, empty_function)) return; 2637 InitializeGlobal(inner_global, empty_function);
2636 InstallJSFunctionResultCaches(); 2638 InstallJSFunctionResultCaches();
2637 InitializeNormalizedMapCaches(); 2639 InitializeNormalizedMapCaches();
2638 if (!InstallNatives()) return; 2640 if (!InstallNatives()) return;
2639 2641
2640 MakeFunctionInstancePrototypeWritable(); 2642 MakeFunctionInstancePrototypeWritable();
2641 2643
2642 if (!FLAG_disable_native_files) { 2644 if (!FLAG_disable_native_files) {
2643 if (!ConfigureGlobalObjects(global_template)) return; 2645 if (!ConfigureGlobalObjects(global_template)) return;
2644 isolate->counters()->contexts_created_from_scratch()->Increment(); 2646 isolate->counters()->contexts_created_from_scratch()->Increment();
2645 } 2647 }
(...skipping 29 matching lines...) Expand all
2675 return from + sizeof(NestingCounterType); 2677 return from + sizeof(NestingCounterType);
2676 } 2678 }
2677 2679
2678 2680
2679 // Called when the top-level V8 mutex is destroyed. 2681 // Called when the top-level V8 mutex is destroyed.
2680 void Bootstrapper::FreeThreadResources() { 2682 void Bootstrapper::FreeThreadResources() {
2681 ASSERT(!IsActive()); 2683 ASSERT(!IsActive());
2682 } 2684 }
2683 2685
2684 } } // namespace v8::internal 2686 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698