Chromium Code Reviews| 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 7373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7384 | 7384 |
| 7385 int index; | 7385 int index; |
| 7386 PropertyAttributes attributes; | 7386 PropertyAttributes attributes; |
| 7387 ContextLookupFlags flags = FOLLOW_CHAINS; | 7387 ContextLookupFlags flags = FOLLOW_CHAINS; |
| 7388 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); | 7388 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); |
| 7389 | 7389 |
| 7390 if (index >= 0) { | 7390 if (index >= 0) { |
| 7391 if (holder->IsContext()) { | 7391 if (holder->IsContext()) { |
| 7392 // Ignore if read_only variable. | 7392 // Ignore if read_only variable. |
| 7393 if ((attributes & READ_ONLY) == 0) { | 7393 if ((attributes & READ_ONLY) == 0) { |
| 7394 Handle<Context>::cast(holder)->set(index, *value); | 7394 Handle<Context>::cast(holder)->set(index, *value); |
|
Mads Ager (chromium)
2011/02/09 07:03:36
Do you know that this one cannot fail? Code that i
antonm
2011/02/09 11:38:09
Agree, but in this case I am afraid we cannot use
| |
| 7395 } | 7395 } |
| 7396 } else { | 7396 } else { |
| 7397 ASSERT((attributes & READ_ONLY) == 0); | 7397 ASSERT((attributes & READ_ONLY) == 0); |
| 7398 Handle<JSObject>::cast(holder)->SetElement(index, *value)-> | 7398 Handle<Object> result = |
| 7399 ToObjectUnchecked(); | 7399 SetElement(Handle<JSObject>::cast(holder), index, value); |
| 7400 if (result.is_null()) return Failure::Exception(); | |
| 7400 } | 7401 } |
| 7401 return *value; | 7402 return *value; |
| 7402 } | 7403 } |
| 7403 | 7404 |
| 7404 // Slow case: The property is not in a FixedArray context. | 7405 // Slow case: The property is not in a FixedArray context. |
| 7405 // It is either in an JSObject extension context or it was not found. | 7406 // It is either in an JSObject extension context or it was not found. |
| 7406 Handle<JSObject> context_ext; | 7407 Handle<JSObject> context_ext; |
| 7407 | 7408 |
| 7408 if (!holder.is_null()) { | 7409 if (!holder.is_null()) { |
| 7409 // The property exists in the extension context. | 7410 // The property exists in the extension context. |
| (...skipping 3686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11096 } else { | 11097 } else { |
| 11097 // Handle last resort GC and make sure to allow future allocations | 11098 // Handle last resort GC and make sure to allow future allocations |
| 11098 // to grow the heap without causing GCs (if possible). | 11099 // to grow the heap without causing GCs (if possible). |
| 11099 Counters::gc_last_resort_from_js.Increment(); | 11100 Counters::gc_last_resort_from_js.Increment(); |
| 11100 Heap::CollectAllGarbage(false); | 11101 Heap::CollectAllGarbage(false); |
| 11101 } | 11102 } |
| 11102 } | 11103 } |
| 11103 | 11104 |
| 11104 | 11105 |
| 11105 } } // namespace v8::internal | 11106 } } // namespace v8::internal |
| OLD | NEW |