| 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 5056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5067 } | 5067 } |
| 5068 } | 5068 } |
| 5069 | 5069 |
| 5070 | 5070 |
| 5071 // DefineAccessor takes an optional final argument which is the | 5071 // DefineAccessor takes an optional final argument which is the |
| 5072 // property attributes (eg, DONT_ENUM, DONT_DELETE). IMPORTANT: due | 5072 // property attributes (eg, DONT_ENUM, DONT_DELETE). IMPORTANT: due |
| 5073 // to the way accessors are implemented, it is set for both the getter | 5073 // to the way accessors are implemented, it is set for both the getter |
| 5074 // and setter on the first call to DefineAccessor and ignored on | 5074 // and setter on the first call to DefineAccessor and ignored on |
| 5075 // subsequent calls. | 5075 // subsequent calls. |
| 5076 static Object* Runtime_DefineAccessor(Arguments args) { | 5076 static Object* Runtime_DefineAccessor(Arguments args) { |
| 5077 RUNTIME_ASSERT(4 <= args.length() && args.length() <= 6); | 5077 RUNTIME_ASSERT(args.length() == 4 || args.length() == 5); |
| 5078 // Compute attributes. | 5078 // Compute attributes. |
| 5079 PropertyAttributes attributes = NONE; | 5079 PropertyAttributes attributes = NONE; |
| 5080 if (args.length() >= 5) { | 5080 if (args.length() == 5) { |
| 5081 CONVERT_CHECKED(Smi, attrs, args[4]); | 5081 CONVERT_CHECKED(Smi, attrs, args[4]); |
| 5082 int value = attrs->value(); | 5082 int value = attrs->value(); |
| 5083 // Only attribute bits should be set. | 5083 // Only attribute bits should be set. |
| 5084 ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5084 ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
| 5085 attributes = static_cast<PropertyAttributes>(value); | 5085 attributes = static_cast<PropertyAttributes>(value); |
| 5086 } | 5086 } |
| 5087 | 5087 |
| 5088 bool never_used = (args.length() == 6) && (args[5] == Heap::true_value()); | |
| 5089 | |
| 5090 CONVERT_CHECKED(JSObject, obj, args[0]); | 5088 CONVERT_CHECKED(JSObject, obj, args[0]); |
| 5091 CONVERT_CHECKED(String, name, args[1]); | 5089 CONVERT_CHECKED(String, name, args[1]); |
| 5092 CONVERT_CHECKED(Smi, flag, args[2]); | 5090 CONVERT_CHECKED(Smi, flag, args[2]); |
| 5093 CONVERT_CHECKED(JSFunction, fun, args[3]); | 5091 CONVERT_CHECKED(JSFunction, fun, args[3]); |
| 5094 return obj->DefineAccessor(name, | 5092 return obj->DefineAccessor(name, flag->value() == 0, fun, attributes); |
| 5095 flag->value() == 0, | |
| 5096 fun, | |
| 5097 attributes, | |
| 5098 never_used); | |
| 5099 } | 5093 } |
| 5100 | 5094 |
| 5101 | 5095 |
| 5102 static Object* Runtime_LookupAccessor(Arguments args) { | 5096 static Object* Runtime_LookupAccessor(Arguments args) { |
| 5103 ASSERT(args.length() == 3); | 5097 ASSERT(args.length() == 3); |
| 5104 CONVERT_CHECKED(JSObject, obj, args[0]); | 5098 CONVERT_CHECKED(JSObject, obj, args[0]); |
| 5105 CONVERT_CHECKED(String, name, args[1]); | 5099 CONVERT_CHECKED(String, name, args[1]); |
| 5106 CONVERT_CHECKED(Smi, flag, args[2]); | 5100 CONVERT_CHECKED(Smi, flag, args[2]); |
| 5107 return obj->LookupAccessor(name, flag->value() == 0); | 5101 return obj->LookupAccessor(name, flag->value() == 0); |
| 5108 } | 5102 } |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6727 } else { | 6721 } else { |
| 6728 // Handle last resort GC and make sure to allow future allocations | 6722 // Handle last resort GC and make sure to allow future allocations |
| 6729 // to grow the heap without causing GCs (if possible). | 6723 // to grow the heap without causing GCs (if possible). |
| 6730 Counters::gc_last_resort_from_js.Increment(); | 6724 Counters::gc_last_resort_from_js.Increment(); |
| 6731 Heap::CollectAllGarbage(); | 6725 Heap::CollectAllGarbage(); |
| 6732 } | 6726 } |
| 6733 } | 6727 } |
| 6734 | 6728 |
| 6735 | 6729 |
| 6736 } } // namespace v8::internal | 6730 } } // namespace v8::internal |
| OLD | NEW |