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

Side by Side Diff: src/bootstrapper.cc

Issue 13799003: Change Context::New not create persistent handles. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adapted cctest initialization to new API. Created 7 years, 8 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/api.cc ('k') | src/debug.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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 v->Synchronize(VisitorSynchronization::kExtensions); 296 v->Synchronize(VisitorSynchronization::kExtensions);
297 } 297 }
298 298
299 299
300 Handle<Context> Bootstrapper::CreateEnvironment( 300 Handle<Context> Bootstrapper::CreateEnvironment(
301 Handle<Object> global_object, 301 Handle<Object> global_object,
302 v8::Handle<v8::ObjectTemplate> global_template, 302 v8::Handle<v8::ObjectTemplate> global_template,
303 v8::ExtensionConfiguration* extensions) { 303 v8::ExtensionConfiguration* extensions) {
304 HandleScope scope(isolate_); 304 HandleScope scope(isolate_);
305 Genesis genesis(isolate_, global_object, global_template, extensions); 305 Genesis genesis(isolate_, global_object, global_template, extensions);
306 if (!genesis.result().is_null()) { 306 Handle<Context> env = genesis.result();
307 Handle<Object> ctx(isolate_->global_handles()->Create(*genesis.result())); 307 if (env.is_null() || !InstallExtensions(env, extensions)) {
308 Handle<Context> env = Handle<Context>::cast(ctx); 308 return Handle<Context>();
309 if (InstallExtensions(env, extensions)) {
310 return env;
311 }
312 } 309 }
313 return Handle<Context>(); 310 return scope.CloseAndEscape(env);
314 } 311 }
315 312
316 313
317 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) { 314 static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) {
318 // object.__proto__ = proto; 315 // object.__proto__ = proto;
319 Factory* factory = object->GetIsolate()->factory(); 316 Factory* factory = object->GetIsolate()->factory();
320 Handle<Map> old_to_map = Handle<Map>(object->map()); 317 Handle<Map> old_to_map = Handle<Map>(object->map());
321 Handle<Map> new_to_map = factory->CopyMap(old_to_map); 318 Handle<Map> new_to_map = factory->CopyMap(old_to_map);
322 new_to_map->set_prototype(*proto); 319 new_to_map->set_prototype(*proto);
323 object->set_map(*new_to_map); 320 object->set_map(*new_to_map);
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 return from + sizeof(NestingCounterType); 2492 return from + sizeof(NestingCounterType);
2496 } 2493 }
2497 2494
2498 2495
2499 // Called when the top-level V8 mutex is destroyed. 2496 // Called when the top-level V8 mutex is destroyed.
2500 void Bootstrapper::FreeThreadResources() { 2497 void Bootstrapper::FreeThreadResources() {
2501 ASSERT(!IsActive()); 2498 ASSERT(!IsActive());
2502 } 2499 }
2503 2500
2504 } } // namespace v8::internal 2501 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698