OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4262 // Steps 9c & 12 - replace an existing data property with an accessor property. | 4262 // Steps 9c & 12 - replace an existing data property with an accessor property. |
4263 // Step 12 - update an existing accessor property with an accessor or generic | 4263 // Step 12 - update an existing accessor property with an accessor or generic |
4264 // descriptor. | 4264 // descriptor. |
4265 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) { | 4265 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) { |
4266 ASSERT(args.length() == 5); | 4266 ASSERT(args.length() == 5); |
4267 HandleScope scope(isolate); | 4267 HandleScope scope(isolate); |
4268 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 4268 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
4269 CONVERT_CHECKED(String, name, args[1]); | 4269 CONVERT_CHECKED(String, name, args[1]); |
4270 CONVERT_CHECKED(Smi, flag_setter, args[2]); | 4270 CONVERT_CHECKED(Smi, flag_setter, args[2]); |
4271 Object* fun = args[3]; | 4271 Object* fun = args[3]; |
4272 RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); | 4272 RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); |
4273 CONVERT_CHECKED(Smi, flag_attr, args[4]); | 4273 CONVERT_CHECKED(Smi, flag_attr, args[4]); |
4274 int unchecked = flag_attr->value(); | 4274 int unchecked = flag_attr->value(); |
4275 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 4275 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
4276 RUNTIME_ASSERT(!obj->IsNull()); | 4276 RUNTIME_ASSERT(!obj->IsNull()); |
4277 LookupResult result; | 4277 LookupResult result; |
4278 obj->LocalLookupRealNamedProperty(name, &result); | 4278 obj->LocalLookupRealNamedProperty(name, &result); |
4279 | 4279 |
4280 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 4280 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
4281 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION | 4281 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION |
4282 // delete it to avoid running into trouble in DefineAccessor, which | 4282 // delete it to avoid running into trouble in DefineAccessor, which |
(...skipping 8947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13230 } else { | 13230 } else { |
13231 // Handle last resort GC and make sure to allow future allocations | 13231 // Handle last resort GC and make sure to allow future allocations |
13232 // to grow the heap without causing GCs (if possible). | 13232 // to grow the heap without causing GCs (if possible). |
13233 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13233 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13234 isolate->heap()->CollectAllGarbage(false); | 13234 isolate->heap()->CollectAllGarbage(false); |
13235 } | 13235 } |
13236 } | 13236 } |
13237 | 13237 |
13238 | 13238 |
13239 } } // namespace v8::internal | 13239 } } // namespace v8::internal |
OLD | NEW |