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

Side by Side Diff: src/runtime.cc

Issue 4164002: Port some GC fixes from the bleeding edge to the 2.2 branch. These are:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.2/
Patch Set: Created 10 years, 1 month 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/objects.cc ('k') | 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 4004 matching lines...) Expand 10 before | Expand all | Expand 10 after
4015 // Check if this is an element. 4015 // Check if this is an element.
4016 uint32_t index; 4016 uint32_t index;
4017 bool is_element = name->AsArrayIndex(&index); 4017 bool is_element = name->AsArrayIndex(&index);
4018 4018
4019 // Special case for elements if any of the flags are true. 4019 // Special case for elements if any of the flags are true.
4020 // If elements are in fast case we always implicitly assume that: 4020 // If elements are in fast case we always implicitly assume that:
4021 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. 4021 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false.
4022 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) && 4022 if (((unchecked & (DONT_DELETE | DONT_ENUM | READ_ONLY)) != 0) &&
4023 is_element) { 4023 is_element) {
4024 // Normalize the elements to enable attributes on the property. 4024 // Normalize the elements to enable attributes on the property.
4025 js_object->NormalizeElements(); 4025 NormalizeElements(js_object);
4026 NumberDictionary* dictionary = js_object->element_dictionary(); 4026 Handle<NumberDictionary> dictionary(js_object->element_dictionary());
4027 // Make sure that we never go back to fast case. 4027 // Make sure that we never go back to fast case.
4028 dictionary->set_requires_slow_elements(); 4028 dictionary->set_requires_slow_elements();
4029 PropertyDetails details = PropertyDetails(attr, NORMAL); 4029 PropertyDetails details = PropertyDetails(attr, NORMAL);
4030 dictionary->Set(index, *obj_value, details); 4030 NumberDictionarySet(dictionary, index, obj_value, details);
4031 } 4031 }
4032 4032
4033 LookupResult result; 4033 LookupResult result;
4034 js_object->LocalLookupRealNamedProperty(*name, &result); 4034 js_object->LocalLookupRealNamedProperty(*name, &result);
4035 4035
4036 // Take special care when attributes are different and there is already 4036 // Take special care when attributes are different and there is already
4037 // a property. For simplicity we normalize the property which enables us 4037 // a property. For simplicity we normalize the property which enables us
4038 // to not worry about changing the instance_descriptor and creating a new 4038 // to not worry about changing the instance_descriptor and creating a new
4039 // map. The current version of SetObjectProperty does not handle attributes 4039 // map. The current version of SetObjectProperty does not handle attributes
4040 // correctly in the case where a property is a field and is reset with 4040 // correctly in the case where a property is a field and is reset with
4041 // new attributes. 4041 // new attributes.
4042 if (result.IsProperty() && attr != result.GetAttributes()) { 4042 if (result.IsProperty() && attr != result.GetAttributes()) {
4043 // New attributes - normalize to avoid writing to instance descriptor 4043 // New attributes - normalize to avoid writing to instance descriptor
4044 js_object->NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 4044 NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
4045 // Use IgnoreAttributes version since a readonly property may be 4045 // Use IgnoreAttributes version since a readonly property may be
4046 // overridden and SetProperty does not allow this. 4046 // overridden and SetProperty does not allow this.
4047 return js_object->IgnoreAttributesAndSetLocalProperty(*name, 4047 return js_object->IgnoreAttributesAndSetLocalProperty(*name,
4048 *obj_value, 4048 *obj_value,
4049 attr); 4049 attr);
4050 } 4050 }
4051 4051
4052 return Runtime::SetObjectProperty(js_object, name, obj_value, attr); 4052 return Runtime::SetObjectProperty(js_object, name, obj_value, attr);
4053 } 4053 }
4054 4054
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
4631 } 4631 }
4632 4632
4633 4633
4634 static Object* Runtime_ToSlowProperties(Arguments args) { 4634 static Object* Runtime_ToSlowProperties(Arguments args) {
4635 HandleScope scope; 4635 HandleScope scope;
4636 4636
4637 ASSERT(args.length() == 1); 4637 ASSERT(args.length() == 1);
4638 Handle<Object> object = args.at<Object>(0); 4638 Handle<Object> object = args.at<Object>(0);
4639 if (object->IsJSObject()) { 4639 if (object->IsJSObject()) {
4640 Handle<JSObject> js_object = Handle<JSObject>::cast(object); 4640 Handle<JSObject> js_object = Handle<JSObject>::cast(object);
4641 js_object->NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 4641 NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
4642 } 4642 }
4643 return *object; 4643 return *object;
4644 } 4644 }
4645 4645
4646 4646
4647 static Object* Runtime_ToBool(Arguments args) { 4647 static Object* Runtime_ToBool(Arguments args) {
4648 NoHandleAllocation ha; 4648 NoHandleAllocation ha;
4649 ASSERT(args.length() == 1); 4649 ASSERT(args.length() == 1);
4650 4650
4651 return args[0]->ToBoolean(); 4651 return args[0]->ToBoolean();
(...skipping 5902 matching lines...) Expand 10 before | Expand all | Expand 10 after
10554 } else { 10554 } else {
10555 // Handle last resort GC and make sure to allow future allocations 10555 // Handle last resort GC and make sure to allow future allocations
10556 // to grow the heap without causing GCs (if possible). 10556 // to grow the heap without causing GCs (if possible).
10557 Counters::gc_last_resort_from_js.Increment(); 10557 Counters::gc_last_resort_from_js.Increment();
10558 Heap::CollectAllGarbage(false); 10558 Heap::CollectAllGarbage(false);
10559 } 10559 }
10560 } 10560 }
10561 10561
10562 10562
10563 } } // namespace v8::internal 10563 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698