OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 8802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8813 ASSERT(holder->IsContext()); | 8813 ASSERT(holder->IsContext()); |
8814 // If the "property" we were looking for is a local variable, the | 8814 // If the "property" we were looking for is a local variable, the |
8815 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3. | 8815 // receiver is the global object; see ECMA-262, 3rd., 10.1.6 and 10.2.3. |
8816 // | 8816 // |
8817 // Use the hole as the receiver to signal that the receiver is implicit | 8817 // Use the hole as the receiver to signal that the receiver is implicit |
8818 // and that the global receiver should be used (as distinguished from an | 8818 // and that the global receiver should be used (as distinguished from an |
8819 // explicit receiver that happens to be a global object). | 8819 // explicit receiver that happens to be a global object). |
8820 Handle<Object> receiver = isolate->factory()->the_hole_value(); | 8820 Handle<Object> receiver = isolate->factory()->the_hole_value(); |
8821 Object* value = Context::cast(*holder)->get(index); | 8821 Object* value = Context::cast(*holder)->get(index); |
8822 // Check for uninitialized bindings. | 8822 // Check for uninitialized bindings. |
8823 if (binding_flags == MUTABLE_CHECK_INITIALIZED && value->IsTheHole()) { | 8823 switch (binding_flags) { |
8824 Handle<Object> reference_error = | 8824 case MUTABLE_CHECK_INITIALIZED: |
8825 isolate->factory()->NewReferenceError("not_defined", | 8825 case IMMUTABLE_CHECK_INITIALIZED_HARMONY: |
8826 HandleVector(&name, 1)); | 8826 if (value->IsTheHole()) { |
8827 return MakePair(isolate->Throw(*reference_error), NULL); | 8827 Handle<Object> reference_error = |
8828 } else { | 8828 isolate->factory()->NewReferenceError("not_defined", |
8829 return MakePair(Unhole(isolate->heap(), value, attributes), *receiver); | 8829 HandleVector(&name, 1)); |
| 8830 return MakePair(isolate->Throw(*reference_error), NULL); |
| 8831 } |
| 8832 // FALLTHROUGH |
| 8833 case MUTABLE_IS_INITIALIZED: |
| 8834 case IMMUTABLE_IS_INITIALIZED: |
| 8835 case IMMUTABLE_IS_INITIALIZED_HARMONY: |
| 8836 ASSERT(!value->IsTheHole()); |
| 8837 return MakePair(value, *receiver); |
| 8838 case IMMUTABLE_CHECK_INITIALIZED: |
| 8839 return MakePair(Unhole(isolate->heap(), value, attributes), *receiver); |
| 8840 case MISSING_BINDING: |
| 8841 UNREACHABLE(); |
8830 } | 8842 } |
8831 } | 8843 } |
8832 | 8844 |
8833 // Otherwise, if the slot was found the holder is a context extension | 8845 // Otherwise, if the slot was found the holder is a context extension |
8834 // object, subject of a with, or a global object. We read the named | 8846 // object, subject of a with, or a global object. We read the named |
8835 // property from it. | 8847 // property from it. |
8836 if (!holder.is_null()) { | 8848 if (!holder.is_null()) { |
8837 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 8849 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
8838 ASSERT(object->HasProperty(*name)); | 8850 ASSERT(object->HasProperty(*name)); |
8839 // GetProperty below can cause GC. | 8851 // GetProperty below can cause GC. |
(...skipping 4506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13346 } else { | 13358 } else { |
13347 // Handle last resort GC and make sure to allow future allocations | 13359 // Handle last resort GC and make sure to allow future allocations |
13348 // to grow the heap without causing GCs (if possible). | 13360 // to grow the heap without causing GCs (if possible). |
13349 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13361 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13362 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13351 } | 13363 } |
13352 } | 13364 } |
13353 | 13365 |
13354 | 13366 |
13355 } } // namespace v8::internal | 13367 } } // namespace v8::internal |
OLD | NEW |