| OLD | NEW |
| 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 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 int unchecked = flag_attr->value(); | 2888 int unchecked = flag_attr->value(); |
| 2889 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 2889 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 2890 RUNTIME_ASSERT(!obj->IsNull()); | 2890 RUNTIME_ASSERT(!obj->IsNull()); |
| 2891 LookupResult result; | 2891 LookupResult result; |
| 2892 obj->LocalLookupRealNamedProperty(name, &result); | 2892 obj->LocalLookupRealNamedProperty(name, &result); |
| 2893 | 2893 |
| 2894 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 2894 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
| 2895 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION | 2895 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION |
| 2896 // delete it to avoid running into trouble in DefineAccessor, which | 2896 // delete it to avoid running into trouble in DefineAccessor, which |
| 2897 // handles this incorrectly if the property is readonly (does nothing) | 2897 // handles this incorrectly if the property is readonly (does nothing) |
| 2898 if (result.IsValid() && | 2898 if (result.IsProperty() && |
| 2899 (result.type() == FIELD || result.type() == NORMAL | 2899 (result.type() == FIELD || result.type() == NORMAL |
| 2900 || result.type() == CONSTANT_FUNCTION)) { | 2900 || result.type() == CONSTANT_FUNCTION)) { |
| 2901 obj->DeleteProperty(name, JSObject::NORMAL_DELETION); | 2901 obj->DeleteProperty(name, JSObject::NORMAL_DELETION); |
| 2902 } | 2902 } |
| 2903 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); | 2903 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); |
| 2904 } | 2904 } |
| 2905 | 2905 |
| 2906 static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) { | 2906 static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) { |
| 2907 ASSERT(args.length() == 4); | 2907 ASSERT(args.length() == 4); |
| 2908 HandleScope scope; | 2908 HandleScope scope; |
| (...skipping 5273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8182 } else { | 8182 } else { |
| 8183 // Handle last resort GC and make sure to allow future allocations | 8183 // Handle last resort GC and make sure to allow future allocations |
| 8184 // to grow the heap without causing GCs (if possible). | 8184 // to grow the heap without causing GCs (if possible). |
| 8185 Counters::gc_last_resort_from_js.Increment(); | 8185 Counters::gc_last_resort_from_js.Increment(); |
| 8186 Heap::CollectAllGarbage(false); | 8186 Heap::CollectAllGarbage(false); |
| 8187 } | 8187 } |
| 8188 } | 8188 } |
| 8189 | 8189 |
| 8190 | 8190 |
| 8191 } } // namespace v8::internal | 8191 } } // namespace v8::internal |
| OLD | NEW |