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

Side by Side Diff: src/handles.cc

Issue 2866008: [Isolates] Move contents of Top into Isolate.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: ensure we're synced Created 10 years, 6 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/handles-inl.h » ('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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 } 344 }
345 } 345 }
346 346
347 // Only attempt to find the hidden properties in the local object and not 347 // Only attempt to find the hidden properties in the local object and not
348 // in the prototype chain. Note that HasLocalProperty() can cause a GC in 348 // in the prototype chain. Note that HasLocalProperty() can cause a GC in
349 // the general case in the presence of interceptors. 349 // the general case in the presence of interceptors.
350 if (!obj->HasHiddenPropertiesObject()) { 350 if (!obj->HasHiddenPropertiesObject()) {
351 // Hidden properties object not found. Allocate a new hidden properties 351 // Hidden properties object not found. Allocate a new hidden properties
352 // object if requested. Otherwise return the undefined value. 352 // object if requested. Otherwise return the undefined value.
353 if (create_if_needed) { 353 if (create_if_needed) {
354 Handle<Object> hidden_obj = Factory::NewJSObject(Top::object_function()); 354 Handle<Object> hidden_obj =
355 Factory::NewJSObject(Isolate::Current()->object_function());
355 CALL_HEAP_FUNCTION(obj->SetHiddenPropertiesObject(*hidden_obj), Object); 356 CALL_HEAP_FUNCTION(obj->SetHiddenPropertiesObject(*hidden_obj), Object);
356 } else { 357 } else {
357 return Factory::undefined_value(); 358 return Factory::undefined_value();
358 } 359 }
359 } 360 }
360 return Handle<Object>(obj->GetHiddenPropertiesObject()); 361 return Handle<Object>(obj->GetHiddenPropertiesObject());
361 } 362 }
362 363
363 364
364 Handle<Object> DeleteElement(Handle<JSObject> obj, 365 Handle<Object> DeleteElement(Handle<JSObject> obj,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 438
438 Handle<JSValue> GetScriptWrapper(Handle<Script> script) { 439 Handle<JSValue> GetScriptWrapper(Handle<Script> script) {
439 if (script->wrapper()->proxy() != NULL) { 440 if (script->wrapper()->proxy() != NULL) {
440 // Return the script wrapper directly from the cache. 441 // Return the script wrapper directly from the cache.
441 return Handle<JSValue>( 442 return Handle<JSValue>(
442 reinterpret_cast<JSValue**>(script->wrapper()->proxy())); 443 reinterpret_cast<JSValue**>(script->wrapper()->proxy()));
443 } 444 }
444 445
445 // Construct a new script wrapper. 446 // Construct a new script wrapper.
446 Counters::script_wrappers.Increment(); 447 Counters::script_wrappers.Increment();
447 Handle<JSFunction> constructor = Top::script_function(); 448 Handle<JSFunction> constructor = Isolate::Current()->script_function();
448 Handle<JSValue> result = 449 Handle<JSValue> result =
449 Handle<JSValue>::cast(Factory::NewJSObject(constructor)); 450 Handle<JSValue>::cast(Factory::NewJSObject(constructor));
450 result->set_value(*script); 451 result->set_value(*script);
451 452
452 // Create a new weak global handle and use it to cache the wrapper 453 // Create a new weak global handle and use it to cache the wrapper
453 // for future use. The cache will automatically be cleared by the 454 // for future use. The cache will automatically be cleared by the
454 // garbage collector when it is not used anymore. 455 // garbage collector when it is not used anymore.
455 Handle<Object> handle = GlobalHandles::Create(*result); 456 Handle<Object> handle = GlobalHandles::Create(*result);
456 GlobalHandles::MakeWeak(handle.location(), NULL, &ClearWrapperCache); 457 GlobalHandles::MakeWeak(handle.location(), NULL, &ClearWrapperCache);
457 script->wrapper()->set_proxy(reinterpret_cast<Address>(handle.location())); 458 script->wrapper()->set_proxy(reinterpret_cast<Address>(handle.location()));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 } 617 }
617 return result; 618 return result;
618 } 619 }
619 620
620 621
621 Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSObject> object, 622 Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSObject> object,
622 KeyCollectionType type) { 623 KeyCollectionType type) {
623 Handle<FixedArray> content = Factory::empty_fixed_array(); 624 Handle<FixedArray> content = Factory::empty_fixed_array();
624 Handle<JSObject> arguments_boilerplate = 625 Handle<JSObject> arguments_boilerplate =
625 Handle<JSObject>( 626 Handle<JSObject>(
626 Top::context()->global_context()->arguments_boilerplate()); 627 Isolate::Current()->context()->global_context()->
628 arguments_boilerplate());
627 Handle<JSFunction> arguments_function = 629 Handle<JSFunction> arguments_function =
628 Handle<JSFunction>( 630 Handle<JSFunction>(
629 JSFunction::cast(arguments_boilerplate->map()->constructor())); 631 JSFunction::cast(arguments_boilerplate->map()->constructor()));
630 632
631 // Only collect keys if access is permitted. 633 // Only collect keys if access is permitted.
632 for (Handle<Object> p = object; 634 for (Handle<Object> p = object;
633 *p != HEAP->null_value(); 635 *p != HEAP->null_value();
634 p = Handle<Object>(p->GetPrototype())) { 636 p = Handle<Object>(p->GetPrototype())) {
635 Handle<JSObject> current(JSObject::cast(*p)); 637 Handle<JSObject> current(JSObject::cast(*p));
636 638
637 // Check access rights if required. 639 // Check access rights if required.
638 if (current->IsAccessCheckNeeded() && 640 if (current->IsAccessCheckNeeded() &&
639 !Top::MayNamedAccess(*current, HEAP->undefined_value(), 641 !Isolate::Current()->MayNamedAccess(*current, HEAP->undefined_value(),
640 v8::ACCESS_KEYS)) { 642 v8::ACCESS_KEYS)) {
641 Top::ReportFailedAccessCheck(*current, v8::ACCESS_KEYS); 643 Isolate::Current()->ReportFailedAccessCheck(*current, v8::ACCESS_KEYS);
642 break; 644 break;
643 } 645 }
644 646
645 // Compute the element keys. 647 // Compute the element keys.
646 Handle<FixedArray> element_keys = 648 Handle<FixedArray> element_keys =
647 Factory::NewFixedArray(current->NumberOfEnumElements()); 649 Factory::NewFixedArray(current->NumberOfEnumElements());
648 current->GetEnumElementKeys(*element_keys); 650 current->GetEnumElementKeys(*element_keys);
649 content = UnionOfKeys(content, element_keys); 651 content = UnionOfKeys(content, element_keys);
650 652
651 // Add the element keys from the interceptor. 653 // Add the element keys from the interceptor.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 ClearExceptionFlag flag) { 745 ClearExceptionFlag flag) {
744 return shared->is_compiled() || CompileLazyShared(shared, flag); 746 return shared->is_compiled() || CompileLazyShared(shared, flag);
745 } 747 }
746 748
747 749
748 static bool CompileLazyHelper(CompilationInfo* info, 750 static bool CompileLazyHelper(CompilationInfo* info,
749 ClearExceptionFlag flag) { 751 ClearExceptionFlag flag) {
750 // Compile the source information to a code object. 752 // Compile the source information to a code object.
751 ASSERT(!info->shared_info()->is_compiled()); 753 ASSERT(!info->shared_info()->is_compiled());
752 bool result = Compiler::CompileLazy(info); 754 bool result = Compiler::CompileLazy(info);
753 ASSERT(result != Top::has_pending_exception()); 755 ASSERT(result != Isolate::Current()->has_pending_exception());
754 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); 756 if (!result && flag == CLEAR_EXCEPTION) {
757 Isolate::Current()->clear_pending_exception();
758 }
755 return result; 759 return result;
756 } 760 }
757 761
758 762
759 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 763 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
760 ClearExceptionFlag flag) { 764 ClearExceptionFlag flag) {
761 CompilationInfo info(shared); 765 CompilationInfo info(shared);
762 return CompileLazyHelper(&info, flag); 766 return CompileLazyHelper(&info, flag);
763 } 767 }
764 768
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 816
813 OptimizedObjectForAddingMultipleProperties:: 817 OptimizedObjectForAddingMultipleProperties::
814 ~OptimizedObjectForAddingMultipleProperties() { 818 ~OptimizedObjectForAddingMultipleProperties() {
815 // Reoptimize the object to allow fast property access. 819 // Reoptimize the object to allow fast property access.
816 if (has_been_transformed_) { 820 if (has_been_transformed_) {
817 TransformToFastProperties(object_, unused_property_fields_); 821 TransformToFastProperties(object_, unused_property_fields_);
818 } 822 }
819 } 823 }
820 824
821 } } // namespace v8::internal 825 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698