| OLD | NEW | 
|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3481 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3492     int index = Smi::cast(args[1])->value(); | 3492     int index = Smi::cast(args[1])->value(); | 
| 3493     Handle<Object> result = GetCharAt(str, index); | 3493     Handle<Object> result = GetCharAt(str, index); | 
| 3494     return *result; | 3494     return *result; | 
| 3495   } | 3495   } | 
| 3496 | 3496 | 
| 3497   // Fall back to GetObjectProperty. | 3497   // Fall back to GetObjectProperty. | 
| 3498   return Runtime::GetObjectProperty(args.at<Object>(0), | 3498   return Runtime::GetObjectProperty(args.at<Object>(0), | 
| 3499                                     args.at<Object>(1)); | 3499                                     args.at<Object>(1)); | 
| 3500 } | 3500 } | 
| 3501 | 3501 | 
| 3502 // Implements part of 8.12.9 DefineOwnProperty. | 3502 | 
| 3503 // There are 3 cases that lead here: |  | 
| 3504 // Step 4b - define a new accessor property. |  | 
| 3505 // Steps 9c & 12 - replace an existing data property with an accessor property. |  | 
| 3506 // Step 12 - update an existing accessor property with an accessor or generic |  | 
| 3507 //           descriptor. |  | 
| 3508 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { | 3503 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { | 
| 3509   ASSERT(args.length() == 5); | 3504   ASSERT(args.length() == 5); | 
| 3510   HandleScope scope; | 3505   HandleScope scope; | 
| 3511   CONVERT_ARG_CHECKED(JSObject, obj, 0); | 3506   CONVERT_ARG_CHECKED(JSObject, obj, 0); | 
| 3512   CONVERT_CHECKED(String, name, args[1]); | 3507   CONVERT_CHECKED(String, name, args[1]); | 
| 3513   CONVERT_CHECKED(Smi, flag_setter, args[2]); | 3508   CONVERT_CHECKED(Smi, flag_setter, args[2]); | 
| 3514   Object* fun = args[3]; | 3509   Object* fun = args[3]; | 
| 3515   RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); | 3510   RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); | 
| 3516   CONVERT_CHECKED(Smi, flag_attr, args[4]); | 3511   CONVERT_CHECKED(Smi, flag_attr, args[4]); | 
| 3517   int unchecked = flag_attr->value(); | 3512   int unchecked = flag_attr->value(); | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 3529        || result.type() == CONSTANT_FUNCTION)) { | 3524        || result.type() == CONSTANT_FUNCTION)) { | 
| 3530     Object* ok; | 3525     Object* ok; | 
| 3531     { MaybeObject* maybe_ok = | 3526     { MaybeObject* maybe_ok = | 
| 3532           obj->DeleteProperty(name, JSObject::NORMAL_DELETION); | 3527           obj->DeleteProperty(name, JSObject::NORMAL_DELETION); | 
| 3533       if (!maybe_ok->ToObject(&ok)) return maybe_ok; | 3528       if (!maybe_ok->ToObject(&ok)) return maybe_ok; | 
| 3534     } | 3529     } | 
| 3535   } | 3530   } | 
| 3536   return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); | 3531   return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); | 
| 3537 } | 3532 } | 
| 3538 | 3533 | 
| 3539 // Implements part of 8.12.9 DefineOwnProperty. |  | 
| 3540 // There are 3 cases that lead here: |  | 
| 3541 // Step 4a - define a new data property. |  | 
| 3542 // Steps 9b & 12 - replace an existing accessor property with a data property. |  | 
| 3543 // Step 12 - update an existing data property with a data or generic |  | 
| 3544 //           descriptor. |  | 
| 3545 static MaybeObject* Runtime_DefineOrRedefineDataProperty(Arguments args) { | 3534 static MaybeObject* Runtime_DefineOrRedefineDataProperty(Arguments args) { | 
| 3546   ASSERT(args.length() == 4); | 3535   ASSERT(args.length() == 4); | 
| 3547   HandleScope scope; | 3536   HandleScope scope; | 
| 3548   CONVERT_ARG_CHECKED(JSObject, js_object, 0); | 3537   CONVERT_ARG_CHECKED(JSObject, js_object, 0); | 
| 3549   CONVERT_ARG_CHECKED(String, name, 1); | 3538   CONVERT_ARG_CHECKED(String, name, 1); | 
| 3550   Handle<Object> obj_value = args.at<Object>(2); | 3539   Handle<Object> obj_value = args.at<Object>(2); | 
| 3551 | 3540 | 
| 3552   CONVERT_CHECKED(Smi, flag, args[3]); | 3541   CONVERT_CHECKED(Smi, flag, args[3]); | 
| 3553   int unchecked = flag->value(); | 3542   int unchecked = flag->value(); | 
| 3554   RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 3543   RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 
| (...skipping 7284 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10839   } else { | 10828   } else { | 
| 10840     // Handle last resort GC and make sure to allow future allocations | 10829     // Handle last resort GC and make sure to allow future allocations | 
| 10841     // to grow the heap without causing GCs (if possible). | 10830     // to grow the heap without causing GCs (if possible). | 
| 10842     Counters::gc_last_resort_from_js.Increment(); | 10831     Counters::gc_last_resort_from_js.Increment(); | 
| 10843     Heap::CollectAllGarbage(false); | 10832     Heap::CollectAllGarbage(false); | 
| 10844   } | 10833   } | 
| 10845 } | 10834 } | 
| 10846 | 10835 | 
| 10847 | 10836 | 
| 10848 } }  // namespace v8::internal | 10837 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|