| 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 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 bool is_var = value->IsUndefined(); | 2056 bool is_var = value->IsUndefined(); |
| 2057 bool is_const = value->IsTheHole(); | 2057 bool is_const = value->IsTheHole(); |
| 2058 bool is_function = value->IsSharedFunctionInfo(); | 2058 bool is_function = value->IsSharedFunctionInfo(); |
| 2059 ASSERT(is_var + is_const + is_function == 1); | 2059 ASSERT(is_var + is_const + is_function == 1); |
| 2060 | 2060 |
| 2061 if (is_var || is_const) { | 2061 if (is_var || is_const) { |
| 2062 // Lookup the property in the global object, and don't set the | 2062 // Lookup the property in the global object, and don't set the |
| 2063 // value of the variable if the property is already there. | 2063 // value of the variable if the property is already there. |
| 2064 // Do the lookup locally only, see ES5 erratum. | 2064 // Do the lookup locally only, see ES5 erratum. |
| 2065 LookupResult lookup(isolate); | 2065 LookupResult lookup(isolate); |
| 2066 if (FLAG_es52_globals) { | 2066 global->LocalLookup(*name, &lookup, true); |
| 2067 global->LocalLookup(*name, &lookup, true); | |
| 2068 } else { | |
| 2069 global->Lookup(*name, &lookup); | |
| 2070 } | |
| 2071 if (lookup.IsFound()) { | 2067 if (lookup.IsFound()) { |
| 2072 // We found an existing property. Unless it was an interceptor | 2068 // We found an existing property. Unless it was an interceptor |
| 2073 // that claims the property is absent, skip this declaration. | 2069 // that claims the property is absent, skip this declaration. |
| 2074 if (!lookup.IsInterceptor()) continue; | 2070 if (!lookup.IsInterceptor()) continue; |
| 2075 PropertyAttributes attributes = global->GetPropertyAttribute(*name); | 2071 PropertyAttributes attributes = global->GetPropertyAttribute(*name); |
| 2076 if (attributes != ABSENT) continue; | 2072 if (attributes != ABSENT) continue; |
| 2077 // Fall-through and introduce the absent property by using | 2073 // Fall-through and introduce the absent property by using |
| 2078 // SetProperty. | 2074 // SetProperty. |
| 2079 } | 2075 } |
| 2080 } else if (is_function) { | 2076 } else if (is_function) { |
| (...skipping 12884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14965 // Handle last resort GC and make sure to allow future allocations | 14961 // Handle last resort GC and make sure to allow future allocations |
| 14966 // to grow the heap without causing GCs (if possible). | 14962 // to grow the heap without causing GCs (if possible). |
| 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14963 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14964 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14969 "Runtime::PerformGC"); | 14965 "Runtime::PerformGC"); |
| 14970 } | 14966 } |
| 14971 } | 14967 } |
| 14972 | 14968 |
| 14973 | 14969 |
| 14974 } } // namespace v8::internal | 14970 } } // namespace v8::internal |
| OLD | NEW |