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

Side by Side Diff: src/handles.cc

Issue 155135: Change a few sites where the Handle<T>(NULL) constructor is used so... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/handles.h ('k') | src/ia32/assembler-ia32.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 JSValue* wrapper = JSValue::cast(*cache); 365 JSValue* wrapper = JSValue::cast(*cache);
366 Proxy* proxy = Script::cast(wrapper->value())->wrapper(); 366 Proxy* proxy = Script::cast(wrapper->value())->wrapper();
367 ASSERT(proxy->proxy() == reinterpret_cast<Address>(cache.location())); 367 ASSERT(proxy->proxy() == reinterpret_cast<Address>(cache.location()));
368 proxy->set_proxy(0); 368 proxy->set_proxy(0);
369 GlobalHandles::Destroy(cache.location()); 369 GlobalHandles::Destroy(cache.location());
370 Counters::script_wrappers.Decrement(); 370 Counters::script_wrappers.Decrement();
371 } 371 }
372 372
373 373
374 Handle<JSValue> GetScriptWrapper(Handle<Script> script) { 374 Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
375 Handle<Object> cache(reinterpret_cast<Object**>(script->wrapper()->proxy())); 375 if (script->wrapper()->proxy() != NULL) {
376 if (!cache.is_null()) {
377 // Return the script wrapper directly from the cache. 376 // Return the script wrapper directly from the cache.
378 return Handle<JSValue>(JSValue::cast(*cache)); 377 return Handle<JSValue>(
378 reinterpret_cast<JSValue**>(script->wrapper()->proxy()));
379 } 379 }
380 380
381 // Construct a new script wrapper. 381 // Construct a new script wrapper.
382 Counters::script_wrappers.Increment(); 382 Counters::script_wrappers.Increment();
383 Handle<JSFunction> constructor = Top::script_function(); 383 Handle<JSFunction> constructor = Top::script_function();
384 Handle<JSValue> result = 384 Handle<JSValue> result =
385 Handle<JSValue>::cast(Factory::NewJSObject(constructor)); 385 Handle<JSValue>::cast(Factory::NewJSObject(constructor));
386 result->set_value(*script); 386 result->set_value(*script);
387 387
388 // Create a new weak global handle and use it to cache the wrapper 388 // Create a new weak global handle and use it to cache the wrapper
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); 741 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map);
742 obj->set_map(*new_map); 742 obj->set_map(*new_map);
743 new_map->set_needs_loading(true); 743 new_map->set_needs_loading(true);
744 // Store the lazy loading info in the constructor field. We'll 744 // Store the lazy loading info in the constructor field. We'll
745 // reestablish the constructor from the fixed array after loading. 745 // reestablish the constructor from the fixed array after loading.
746 new_map->set_constructor(*arr); 746 new_map->set_constructor(*arr);
747 ASSERT(!obj->IsLoaded()); 747 ASSERT(!obj->IsLoaded());
748 } 748 }
749 749
750 } } // namespace v8::internal 750 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698