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

Side by Side Diff: src/runtime.cc

Issue 6386026: Port r6539 to 2.5 branch (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.5/
Patch Set: '' Created 9 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/version.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 729 }
730 } 730 }
731 } 731 }
732 732
733 // Use recursive implementation to also traverse hidden prototypes 733 // Use recursive implementation to also traverse hidden prototypes
734 GetOwnPropertyImplementation(*obj, *name, &result); 734 GetOwnPropertyImplementation(*obj, *name, &result);
735 735
736 if (!result.IsProperty()) { 736 if (!result.IsProperty()) {
737 return Heap::undefined_value(); 737 return Heap::undefined_value();
738 } 738 }
739 if (result.type() == CALLBACKS) {
740 Object* structure = result.GetCallbackObject();
741 if (structure->IsProxy() || structure->IsAccessorInfo()) {
742 // Property that is internally implemented as a callback or
743 // an API defined callback.
744 Object* value;
745 { MaybeObject* maybe_value = obj->GetPropertyWithCallback(
746 *obj, structure, *name, result.holder());
747 if (!maybe_value->ToObject(&value)) return maybe_value;
748 }
749 elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
750 elms->set(VALUE_INDEX, value);
751 elms->set(WRITABLE_INDEX, Heap::ToBoolean(!result.IsReadOnly()));
752 } else if (structure->IsFixedArray()) {
753 // __defineGetter__/__defineSetter__ callback.
754 elms->set(IS_ACCESSOR_INDEX, Heap::true_value());
755 elms->set(GETTER_INDEX, FixedArray::cast(structure)->get(0));
756 elms->set(SETTER_INDEX, FixedArray::cast(structure)->get(1));
757 } else {
758 return Heap::undefined_value();
759 }
760 } else {
761 elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
762 elms->set(VALUE_INDEX, result.GetLazyValue());
763 elms->set(WRITABLE_INDEX, Heap::ToBoolean(!result.IsReadOnly()));
764 }
765 739
766 elms->set(ENUMERABLE_INDEX, Heap::ToBoolean(!result.IsDontEnum())); 740 elms->set(ENUMERABLE_INDEX, Heap::ToBoolean(!result.IsDontEnum()));
767 elms->set(CONFIGURABLE_INDEX, Heap::ToBoolean(!result.IsDontDelete())); 741 elms->set(CONFIGURABLE_INDEX, Heap::ToBoolean(!result.IsDontDelete()));
742
743 bool is_js_accessor = (result.type() == CALLBACKS) &&
744 (result.GetCallbackObject()->IsFixedArray());
745
746 if (is_js_accessor) {
747 // __defineGetter__/__defineSetter__ callback.
748 FixedArray* structure = FixedArray::cast(result.GetCallbackObject());
749 elms->set(IS_ACCESSOR_INDEX, Heap::true_value());
750 elms->set(GETTER_INDEX, structure->get(0));
751 elms->set(SETTER_INDEX, structure->get(1));
752 } else {
753 elms->set(IS_ACCESSOR_INDEX, Heap::false_value());
754 elms->set(WRITABLE_INDEX, Heap::ToBoolean(!result.IsReadOnly()));
755
756 PropertyAttributes attrs;
757 Object* value;
758 { MaybeObject* maybe_value = obj->GetProperty(*obj, &result, *name, &attrs);
759 if (!maybe_value->ToObject(&value)) return maybe_value;
760 }
761 elms->set(VALUE_INDEX, value);
762 }
763
768 return *desc; 764 return *desc;
769 } 765 }
770 766
771 767
772 static MaybeObject* Runtime_PreventExtensions(Arguments args) { 768 static MaybeObject* Runtime_PreventExtensions(Arguments args) {
773 ASSERT(args.length() == 1); 769 ASSERT(args.length() == 1);
774 CONVERT_CHECKED(JSObject, obj, args[0]); 770 CONVERT_CHECKED(JSObject, obj, args[0]);
775 return obj->PreventExtensions(); 771 return obj->PreventExtensions();
776 } 772 }
777 773
(...skipping 9547 matching lines...) Expand 10 before | Expand all | Expand 10 after
10325 } else { 10321 } else {
10326 // Handle last resort GC and make sure to allow future allocations 10322 // Handle last resort GC and make sure to allow future allocations
10327 // to grow the heap without causing GCs (if possible). 10323 // to grow the heap without causing GCs (if possible).
10328 Counters::gc_last_resort_from_js.Increment(); 10324 Counters::gc_last_resort_from_js.Increment();
10329 Heap::CollectAllGarbage(false); 10325 Heap::CollectAllGarbage(false);
10330 } 10326 }
10331 } 10327 }
10332 10328
10333 10329
10334 } } // namespace v8::internal 10330 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698