| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 // Strict mode handling not needed (const is disallowed in strict mode). | 2101 // Strict mode handling not needed (const is disallowed in strict mode). |
| 2102 if (lookup.IsField()) { | 2102 if (lookup.IsField()) { |
| 2103 FixedArray* properties = global->properties(); | 2103 FixedArray* properties = global->properties(); |
| 2104 int index = lookup.GetFieldIndex().field_index(); | 2104 int index = lookup.GetFieldIndex().field_index(); |
| 2105 if (properties->get(index)->IsTheHole() || !lookup.IsReadOnly()) { | 2105 if (properties->get(index)->IsTheHole() || !lookup.IsReadOnly()) { |
| 2106 properties->set(index, *value); | 2106 properties->set(index, *value); |
| 2107 } | 2107 } |
| 2108 } else if (lookup.IsNormal()) { | 2108 } else if (lookup.IsNormal()) { |
| 2109 if (global->GetNormalizedProperty(&lookup)->IsTheHole() || | 2109 if (global->GetNormalizedProperty(&lookup)->IsTheHole() || |
| 2110 !lookup.IsReadOnly()) { | 2110 !lookup.IsReadOnly()) { |
| 2111 global->SetNormalizedProperty(&lookup, *value); | 2111 HandleScope scope(isolate); |
| 2112 JSObject::SetNormalizedProperty(Handle<JSObject>(global), &lookup, value); |
| 2112 } | 2113 } |
| 2113 } else { | 2114 } else { |
| 2114 // Ignore re-initialization of constants that have already been | 2115 // Ignore re-initialization of constants that have already been |
| 2115 // assigned a function value. | 2116 // assigned a function value. |
| 2116 ASSERT(lookup.IsReadOnly() && lookup.IsConstantFunction()); | 2117 ASSERT(lookup.IsReadOnly() && lookup.IsConstantFunction()); |
| 2117 } | 2118 } |
| 2118 | 2119 |
| 2119 // Use the set value as the result of the operation. | 2120 // Use the set value as the result of the operation. |
| 2120 return *value; | 2121 return *value; |
| 2121 } | 2122 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 ASSERT(lookup.IsReadOnly()); // and it was declared as read-only | 2191 ASSERT(lookup.IsReadOnly()); // and it was declared as read-only |
| 2191 | 2192 |
| 2192 if (lookup.IsField()) { | 2193 if (lookup.IsField()) { |
| 2193 FixedArray* properties = object->properties(); | 2194 FixedArray* properties = object->properties(); |
| 2194 int index = lookup.GetFieldIndex().field_index(); | 2195 int index = lookup.GetFieldIndex().field_index(); |
| 2195 if (properties->get(index)->IsTheHole()) { | 2196 if (properties->get(index)->IsTheHole()) { |
| 2196 properties->set(index, *value); | 2197 properties->set(index, *value); |
| 2197 } | 2198 } |
| 2198 } else if (lookup.IsNormal()) { | 2199 } else if (lookup.IsNormal()) { |
| 2199 if (object->GetNormalizedProperty(&lookup)->IsTheHole()) { | 2200 if (object->GetNormalizedProperty(&lookup)->IsTheHole()) { |
| 2200 object->SetNormalizedProperty(&lookup, *value); | 2201 JSObject::SetNormalizedProperty(object, &lookup, value); |
| 2201 } | 2202 } |
| 2202 } else { | 2203 } else { |
| 2203 // We should not reach here. Any real, named property should be | 2204 // We should not reach here. Any real, named property should be |
| 2204 // either a field or a dictionary slot. | 2205 // either a field or a dictionary slot. |
| 2205 UNREACHABLE(); | 2206 UNREACHABLE(); |
| 2206 } | 2207 } |
| 2207 } else { | 2208 } else { |
| 2208 // The property was found on some other object. Set it if it is not a | 2209 // The property was found on some other object. Set it if it is not a |
| 2209 // read-only property. | 2210 // read-only property. |
| 2210 if ((attributes & READ_ONLY) == 0) { | 2211 if ((attributes & READ_ONLY) == 0) { |
| (...skipping 11734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13945 // Handle last resort GC and make sure to allow future allocations | 13946 // Handle last resort GC and make sure to allow future allocations |
| 13946 // to grow the heap without causing GCs (if possible). | 13947 // to grow the heap without causing GCs (if possible). |
| 13947 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13948 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13948 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13949 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13949 "Runtime::PerformGC"); | 13950 "Runtime::PerformGC"); |
| 13950 } | 13951 } |
| 13951 } | 13952 } |
| 13952 | 13953 |
| 13953 | 13954 |
| 13954 } } // namespace v8::internal | 13955 } } // namespace v8::internal |
| OLD | NEW |