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