| 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 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 int index = Smi::cast(args[1])->value(); | 3613 int index = Smi::cast(args[1])->value(); |
| 3614 Handle<Object> result = GetCharAt(str, index); | 3614 Handle<Object> result = GetCharAt(str, index); |
| 3615 return *result; | 3615 return *result; |
| 3616 } | 3616 } |
| 3617 | 3617 |
| 3618 // Fall back to GetObjectProperty. | 3618 // Fall back to GetObjectProperty. |
| 3619 return Runtime::GetObjectProperty(args.at<Object>(0), | 3619 return Runtime::GetObjectProperty(args.at<Object>(0), |
| 3620 args.at<Object>(1)); | 3620 args.at<Object>(1)); |
| 3621 } | 3621 } |
| 3622 | 3622 |
| 3623 | 3623 // Implements part of 8.12.9 DefineOwnProperty. |
| 3624 // There are 3 cases that lead here: |
| 3625 // Step 4b - define a new accessor property. |
| 3626 // Steps 9c & 12 - replace an existing data property with an accessor property. |
| 3627 // Step 12 - update an existing accessor property with an accessor or generic |
| 3628 // descriptor. |
| 3624 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { | 3629 static MaybeObject* Runtime_DefineOrRedefineAccessorProperty(Arguments args) { |
| 3625 ASSERT(args.length() == 5); | 3630 ASSERT(args.length() == 5); |
| 3626 HandleScope scope; | 3631 HandleScope scope; |
| 3627 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 3632 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
| 3628 CONVERT_CHECKED(String, name, args[1]); | 3633 CONVERT_CHECKED(String, name, args[1]); |
| 3629 CONVERT_CHECKED(Smi, flag_setter, args[2]); | 3634 CONVERT_CHECKED(Smi, flag_setter, args[2]); |
| 3630 Object* fun = args[3]; | 3635 Object* fun = args[3]; |
| 3631 RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); | 3636 RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); |
| 3632 CONVERT_CHECKED(Smi, flag_attr, args[4]); | 3637 CONVERT_CHECKED(Smi, flag_attr, args[4]); |
| 3633 int unchecked = flag_attr->value(); | 3638 int unchecked = flag_attr->value(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3645 || result.type() == CONSTANT_FUNCTION)) { | 3650 || result.type() == CONSTANT_FUNCTION)) { |
| 3646 Object* ok; | 3651 Object* ok; |
| 3647 { MaybeObject* maybe_ok = | 3652 { MaybeObject* maybe_ok = |
| 3648 obj->DeleteProperty(name, JSObject::NORMAL_DELETION); | 3653 obj->DeleteProperty(name, JSObject::NORMAL_DELETION); |
| 3649 if (!maybe_ok->ToObject(&ok)) return maybe_ok; | 3654 if (!maybe_ok->ToObject(&ok)) return maybe_ok; |
| 3650 } | 3655 } |
| 3651 } | 3656 } |
| 3652 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); | 3657 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); |
| 3653 } | 3658 } |
| 3654 | 3659 |
| 3660 // Implements part of 8.12.9 DefineOwnProperty. |
| 3661 // There are 3 cases that lead here: |
| 3662 // Step 4a - define a new data property. |
| 3663 // Steps 9b & 12 - replace an existing accessor property with a data property. |
| 3664 // Step 12 - update an existing data property with a data or generic |
| 3665 // descriptor. |
| 3655 static MaybeObject* Runtime_DefineOrRedefineDataProperty(Arguments args) { | 3666 static MaybeObject* Runtime_DefineOrRedefineDataProperty(Arguments args) { |
| 3656 ASSERT(args.length() == 4); | 3667 ASSERT(args.length() == 4); |
| 3657 HandleScope scope; | 3668 HandleScope scope; |
| 3658 CONVERT_ARG_CHECKED(JSObject, js_object, 0); | 3669 CONVERT_ARG_CHECKED(JSObject, js_object, 0); |
| 3659 CONVERT_ARG_CHECKED(String, name, 1); | 3670 CONVERT_ARG_CHECKED(String, name, 1); |
| 3660 Handle<Object> obj_value = args.at<Object>(2); | 3671 Handle<Object> obj_value = args.at<Object>(2); |
| 3661 | 3672 |
| 3662 CONVERT_CHECKED(Smi, flag, args[3]); | 3673 CONVERT_CHECKED(Smi, flag, args[3]); |
| 3663 int unchecked = flag->value(); | 3674 int unchecked = flag->value(); |
| 3664 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 3675 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4297 } | 4308 } |
| 4298 return *object; | 4309 return *object; |
| 4299 } | 4310 } |
| 4300 | 4311 |
| 4301 | 4312 |
| 4302 static MaybeObject* Runtime_ToSlowProperties(Arguments args) { | 4313 static MaybeObject* Runtime_ToSlowProperties(Arguments args) { |
| 4303 HandleScope scope; | 4314 HandleScope scope; |
| 4304 | 4315 |
| 4305 ASSERT(args.length() == 1); | 4316 ASSERT(args.length() == 1); |
| 4306 Handle<Object> object = args.at<Object>(0); | 4317 Handle<Object> object = args.at<Object>(0); |
| 4307 if (object->IsJSObject()) { | 4318 if (object->IsJSObject() && !object->IsJSGlobalProxy()) { |
| 4308 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 4319 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
| 4309 NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0); | 4320 NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0); |
| 4310 } | 4321 } |
| 4311 return *object; | 4322 return *object; |
| 4312 } | 4323 } |
| 4313 | 4324 |
| 4314 | 4325 |
| 4315 static MaybeObject* Runtime_ToBool(Arguments args) { | 4326 static MaybeObject* Runtime_ToBool(Arguments args) { |
| 4316 NoHandleAllocation ha; | 4327 NoHandleAllocation ha; |
| 4317 ASSERT(args.length() == 1); | 4328 ASSERT(args.length() == 1); |
| (...skipping 6733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11051 } else { | 11062 } else { |
| 11052 // Handle last resort GC and make sure to allow future allocations | 11063 // Handle last resort GC and make sure to allow future allocations |
| 11053 // to grow the heap without causing GCs (if possible). | 11064 // to grow the heap without causing GCs (if possible). |
| 11054 Counters::gc_last_resort_from_js.Increment(); | 11065 Counters::gc_last_resort_from_js.Increment(); |
| 11055 Heap::CollectAllGarbage(false); | 11066 Heap::CollectAllGarbage(false); |
| 11056 } | 11067 } |
| 11057 } | 11068 } |
| 11058 | 11069 |
| 11059 | 11070 |
| 11060 } } // namespace v8::internal | 11071 } } // namespace v8::internal |
| OLD | NEW |