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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1082 // that claims the property is absent. | 1082 // that claims the property is absent. |
1083 | 1083 |
1084 // Check for conflicting re-declarations. We cannot have | 1084 // Check for conflicting re-declarations. We cannot have |
1085 // conflicting types in case of intercepted properties because | 1085 // conflicting types in case of intercepted properties because |
1086 // they are absent. | 1086 // they are absent. |
1087 if (lookup.type() != INTERCEPTOR && | 1087 if (lookup.type() != INTERCEPTOR && |
1088 (lookup.IsReadOnly() || is_const_property)) { | 1088 (lookup.IsReadOnly() || is_const_property)) { |
1089 const char* type = (lookup.IsReadOnly()) ? "const" : "var"; | 1089 const char* type = (lookup.IsReadOnly()) ? "const" : "var"; |
1090 return ThrowRedeclarationError(type, name); | 1090 return ThrowRedeclarationError(type, name); |
1091 } | 1091 } |
1092 SetProperty(global, name, value, attributes); | 1092 Handle<Object> result = SetProperty(global, name, value, attributes); |
1093 if (result.is_null()) return Failure::Exception(); | |
antonm
2011/02/08 13:33:01
I know we do not typically do it, so feel free to
Lasse Reichstein
2011/02/08 13:38:57
And yet, if we had done it here, we would have cau
| |
1093 } else { | 1094 } else { |
1094 // If a property with this name does not already exist on the | 1095 // If a property with this name does not already exist on the |
1095 // global object add the property locally. We take special | 1096 // global object add the property locally. We take special |
1096 // precautions to always add it as a local property even in case | 1097 // precautions to always add it as a local property even in case |
1097 // of callbacks in the prototype chain (this rules out using | 1098 // of callbacks in the prototype chain (this rules out using |
1098 // SetProperty). Also, we must use the handle-based version to | 1099 // SetProperty). Also, we must use the handle-based version to |
1099 // avoid GC issues. | 1100 // avoid GC issues. |
1100 SetLocalPropertyIgnoreAttributes(global, name, value, attributes); | 1101 Handle<Object> result = |
1102 SetLocalPropertyIgnoreAttributes(global, name, value, attributes); | |
1103 if (result.is_null()) return Failure::Exception(); | |
1101 } | 1104 } |
1102 } | 1105 } |
1103 | 1106 |
1104 return Heap::undefined_value(); | 1107 return Heap::undefined_value(); |
1105 } | 1108 } |
1106 | 1109 |
1107 | 1110 |
1108 static MaybeObject* Runtime_DeclareContextSlot(Arguments args) { | 1111 static MaybeObject* Runtime_DeclareContextSlot(Arguments args) { |
1109 HandleScope scope; | 1112 HandleScope scope; |
1110 ASSERT(args.length() == 4); | 1113 ASSERT(args.length() == 4); |
(...skipping 9963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11074 } else { | 11077 } else { |
11075 // Handle last resort GC and make sure to allow future allocations | 11078 // Handle last resort GC and make sure to allow future allocations |
11076 // to grow the heap without causing GCs (if possible). | 11079 // to grow the heap without causing GCs (if possible). |
11077 Counters::gc_last_resort_from_js.Increment(); | 11080 Counters::gc_last_resort_from_js.Increment(); |
11078 Heap::CollectAllGarbage(false); | 11081 Heap::CollectAllGarbage(false); |
11079 } | 11082 } |
11080 } | 11083 } |
11081 | 11084 |
11082 | 11085 |
11083 } } // namespace v8::internal | 11086 } } // namespace v8::internal |
OLD | NEW |