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

Side by Side Diff: src/bootstrapper.cc

Issue 9421032: Add a missing check for a failure result. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 | « no previous file | src/elements.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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Hooks the given global proxy into the context. If the context was created 189 // Hooks the given global proxy into the context. If the context was created
190 // by deserialization then this will unhook the global proxy that was 190 // by deserialization then this will unhook the global proxy that was
191 // deserialized, leaving the GC to pick it up. 191 // deserialized, leaving the GC to pick it up.
192 void HookUpGlobalProxy(Handle<GlobalObject> inner_global, 192 void HookUpGlobalProxy(Handle<GlobalObject> inner_global,
193 Handle<JSGlobalProxy> global_proxy); 193 Handle<JSGlobalProxy> global_proxy);
194 // Similarly, we want to use the inner global that has been created by the 194 // Similarly, we want to use the inner global that has been created by the
195 // templates passed through the API. The inner global from the snapshot is 195 // templates passed through the API. The inner global from the snapshot is
196 // detached from the other objects in the snapshot. 196 // detached from the other objects in the snapshot.
197 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); 197 void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
198 // New context initialization. Used for creating a context from scratch. 198 // New context initialization. Used for creating a context from scratch.
199 void InitializeGlobal(Handle<GlobalObject> inner_global, 199 bool InitializeGlobal(Handle<GlobalObject> inner_global,
200 Handle<JSFunction> empty_function); 200 Handle<JSFunction> empty_function);
201 void InitializeExperimentalGlobal(); 201 void InitializeExperimentalGlobal();
202 // Installs the contents of the native .js files on the global objects. 202 // Installs the contents of the native .js files on the global objects.
203 // Used for creating a context from scratch. 203 // Used for creating a context from scratch.
204 void InstallNativeFunctions(); 204 void InstallNativeFunctions();
205 void InstallExperimentalNativeFunctions(); 205 void InstallExperimentalNativeFunctions();
206 bool InstallNatives(); 206 bool InstallNatives();
207 bool InstallExperimentalNatives(); 207 bool InstallExperimentalNatives();
208 void InstallBuiltinFunctionIds(); 208 void InstallBuiltinFunctionIds();
209 void InstallJSFunctionResultCaches(); 209 void InstallJSFunctionResultCaches();
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 attributes); 821 attributes);
822 // Set up the reference from the global object to the builtins object. 822 // Set up the reference from the global object to the builtins object.
823 JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global); 823 JSGlobalObject::cast(*inner_global)->set_builtins(*builtins_global);
824 TransferNamedProperties(inner_global_from_snapshot, inner_global); 824 TransferNamedProperties(inner_global_from_snapshot, inner_global);
825 TransferIndexedProperties(inner_global_from_snapshot, inner_global); 825 TransferIndexedProperties(inner_global_from_snapshot, inner_global);
826 } 826 }
827 827
828 828
829 // This is only called if we are not using snapshots. The equivalent 829 // This is only called if we are not using snapshots. The equivalent
830 // work in the snapshot case is done in HookUpInnerGlobal. 830 // work in the snapshot case is done in HookUpInnerGlobal.
831 void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global, 831 bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
832 Handle<JSFunction> empty_function) { 832 Handle<JSFunction> empty_function) {
833 // --- G l o b a l C o n t e x t --- 833 // --- G l o b a l C o n t e x t ---
834 // Use the empty function as closure (no scope info). 834 // Use the empty function as closure (no scope info).
835 global_context()->set_closure(*empty_function); 835 global_context()->set_closure(*empty_function);
836 global_context()->set_previous(NULL); 836 global_context()->set_previous(NULL);
837 // Set extension and global object. 837 // Set extension and global object.
838 global_context()->set_extension(*inner_global); 838 global_context()->set_extension(*inner_global);
839 global_context()->set_global(*inner_global); 839 global_context()->set_global(*inner_global);
840 // Security setup: Set the security token of the global object to 840 // Security setup: Set the security token of the global object to
841 // its the inner global. This makes the security check between two 841 // its the inner global. This makes the security check between two
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 initial_map->set_prototype(*proto); 1025 initial_map->set_prototype(*proto);
1026 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto), 1026 factory->SetRegExpIrregexpData(Handle<JSRegExp>::cast(proto),
1027 JSRegExp::IRREGEXP, factory->empty_string(), 1027 JSRegExp::IRREGEXP, factory->empty_string(),
1028 JSRegExp::Flags(0), 0); 1028 JSRegExp::Flags(0), 0);
1029 } 1029 }
1030 1030
1031 { // -- J S O N 1031 { // -- J S O N
1032 Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON")); 1032 Handle<String> name = factory->NewStringFromAscii(CStrVector("JSON"));
1033 Handle<JSFunction> cons = factory->NewFunction(name, 1033 Handle<JSFunction> cons = factory->NewFunction(name,
1034 factory->the_hole_value()); 1034 factory->the_hole_value());
1035 cons->SetInstancePrototype(global_context()->initial_object_prototype()); 1035 { MaybeObject* result = cons->SetInstancePrototype(
1036 global_context()->initial_object_prototype());
1037 if (result->IsFailure()) return false;
1038 }
1036 cons->SetInstanceClassName(*name); 1039 cons->SetInstanceClassName(*name);
1037 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED); 1040 Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
1038 ASSERT(json_object->IsJSObject()); 1041 ASSERT(json_object->IsJSObject());
1039 CHECK_NOT_EMPTY_HANDLE(isolate, 1042 CHECK_NOT_EMPTY_HANDLE(isolate,
1040 JSObject::SetLocalPropertyIgnoreAttributes( 1043 JSObject::SetLocalPropertyIgnoreAttributes(
1041 global, name, json_object, DONT_ENUM)); 1044 global, name, json_object, DONT_ENUM));
1042 global_context()->set_json_object(*json_object); 1045 global_context()->set_json_object(*json_object);
1043 } 1046 }
1044 1047
1045 { // --- arguments_boilerplate_ 1048 { // --- arguments_boilerplate_
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 // Initialize the data slot. 1239 // Initialize the data slot.
1237 global_context()->set_data(heap->undefined_value()); 1240 global_context()->set_data(heap->undefined_value());
1238 1241
1239 { 1242 {
1240 // Initialize the random seed slot. 1243 // Initialize the random seed slot.
1241 Handle<ByteArray> zeroed_byte_array( 1244 Handle<ByteArray> zeroed_byte_array(
1242 factory->NewByteArray(kRandomStateSize)); 1245 factory->NewByteArray(kRandomStateSize));
1243 global_context()->set_random_seed(*zeroed_byte_array); 1246 global_context()->set_random_seed(*zeroed_byte_array);
1244 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize); 1247 memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize);
1245 } 1248 }
1249 return true;
1246 } 1250 }
1247 1251
1248 1252
1249 void Genesis::InitializeExperimentalGlobal() { 1253 void Genesis::InitializeExperimentalGlobal() {
1250 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); 1254 Handle<JSObject> global = Handle<JSObject>(global_context()->global());
1251 1255
1252 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no 1256 // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
1253 // longer need to live behind a flag, so functions get added to the snapshot. 1257 // longer need to live behind a flag, so functions get added to the snapshot.
1254 if (FLAG_harmony_collections) { 1258 if (FLAG_harmony_collections) {
1255 { // -- S e t 1259 { // -- S e t
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 if (!ConfigureGlobalObjects(global_template)) return; 2311 if (!ConfigureGlobalObjects(global_template)) return;
2308 } else { 2312 } else {
2309 // We get here if there was no context snapshot. 2313 // We get here if there was no context snapshot.
2310 CreateRoots(); 2314 CreateRoots();
2311 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 2315 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
2312 CreateStrictModeFunctionMaps(empty_function); 2316 CreateStrictModeFunctionMaps(empty_function);
2313 Handle<GlobalObject> inner_global; 2317 Handle<GlobalObject> inner_global;
2314 Handle<JSGlobalProxy> global_proxy = 2318 Handle<JSGlobalProxy> global_proxy =
2315 CreateNewGlobals(global_template, global_object, &inner_global); 2319 CreateNewGlobals(global_template, global_object, &inner_global);
2316 HookUpGlobalProxy(inner_global, global_proxy); 2320 HookUpGlobalProxy(inner_global, global_proxy);
2317 InitializeGlobal(inner_global, empty_function); 2321 if (!InitializeGlobal(inner_global, empty_function)) return;
2318 InstallJSFunctionResultCaches(); 2322 InstallJSFunctionResultCaches();
2319 InitializeNormalizedMapCaches(); 2323 InitializeNormalizedMapCaches();
2320 if (!InstallNatives()) return; 2324 if (!InstallNatives()) return;
2321 2325
2322 MakeFunctionInstancePrototypeWritable(); 2326 MakeFunctionInstancePrototypeWritable();
2323 2327
2324 if (!ConfigureGlobalObjects(global_template)) return; 2328 if (!ConfigureGlobalObjects(global_template)) return;
2325 isolate->counters()->contexts_created_from_scratch()->Increment(); 2329 isolate->counters()->contexts_created_from_scratch()->Increment();
2326 } 2330 }
2327 2331
(...skipping 27 matching lines...) Expand all
2355 return from + sizeof(NestingCounterType); 2359 return from + sizeof(NestingCounterType);
2356 } 2360 }
2357 2361
2358 2362
2359 // Called when the top-level V8 mutex is destroyed. 2363 // Called when the top-level V8 mutex is destroyed.
2360 void Bootstrapper::FreeThreadResources() { 2364 void Bootstrapper::FreeThreadResources() {
2361 ASSERT(!IsActive()); 2365 ASSERT(!IsActive());
2362 } 2366 }
2363 2367
2364 } } // namespace v8::internal 2368 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698