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 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4425 if (!holder.is_null()) { | 4425 if (!holder.is_null()) { |
4426 // The property exists in the extension context. | 4426 // The property exists in the extension context. |
4427 context_ext = Handle<JSObject>::cast(holder); | 4427 context_ext = Handle<JSObject>::cast(holder); |
4428 } else { | 4428 } else { |
4429 // The property was not found. It needs to be stored in the global context. | 4429 // The property was not found. It needs to be stored in the global context. |
4430 ASSERT(attributes == ABSENT); | 4430 ASSERT(attributes == ABSENT); |
4431 attributes = NONE; | 4431 attributes = NONE; |
4432 context_ext = Handle<JSObject>(Top::context()->global()); | 4432 context_ext = Handle<JSObject>(Top::context()->global()); |
4433 } | 4433 } |
4434 | 4434 |
4435 // Set the property, but ignore if read_only variable. | 4435 // Set the property, but ignore if read_only variable on the context |
4436 if ((attributes & READ_ONLY) == 0) { | 4436 // extension object itself. |
| 4437 if ((attributes & READ_ONLY) == 0 || |
| 4438 (context_ext->GetLocalPropertyAttribute(*name) == ABSENT)) { |
4437 Handle<Object> set = SetProperty(context_ext, name, value, attributes); | 4439 Handle<Object> set = SetProperty(context_ext, name, value, attributes); |
4438 if (set.is_null()) { | 4440 if (set.is_null()) { |
4439 // Failure::Exception is converted to a null handle in the | 4441 // Failure::Exception is converted to a null handle in the |
4440 // handle-based methods such as SetProperty. We therefore need | 4442 // handle-based methods such as SetProperty. We therefore need |
4441 // to convert null handles back to exceptions. | 4443 // to convert null handles back to exceptions. |
4442 ASSERT(Top::has_pending_exception()); | 4444 ASSERT(Top::has_pending_exception()); |
4443 return Failure::Exception(); | 4445 return Failure::Exception(); |
4444 } | 4446 } |
4445 } | 4447 } |
4446 return *value; | 4448 return *value; |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6890 } else { | 6892 } else { |
6891 // Handle last resort GC and make sure to allow future allocations | 6893 // Handle last resort GC and make sure to allow future allocations |
6892 // to grow the heap without causing GCs (if possible). | 6894 // to grow the heap without causing GCs (if possible). |
6893 Counters::gc_last_resort_from_js.Increment(); | 6895 Counters::gc_last_resort_from_js.Increment(); |
6894 Heap::CollectAllGarbage(); | 6896 Heap::CollectAllGarbage(); |
6895 } | 6897 } |
6896 } | 6898 } |
6897 | 6899 |
6898 | 6900 |
6899 } } // namespace v8::internal | 6901 } } // namespace v8::internal |
OLD | NEW |