| 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 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 // Make sure that we never go back to fast case. | 3924 // Make sure that we never go back to fast case. |
| 3925 dictionary->set_requires_slow_elements(); | 3925 dictionary->set_requires_slow_elements(); |
| 3926 PropertyDetails details = PropertyDetails(attr, NORMAL); | 3926 PropertyDetails details = PropertyDetails(attr, NORMAL); |
| 3927 NumberDictionarySet(dictionary, index, obj_value, details); | 3927 NumberDictionarySet(dictionary, index, obj_value, details); |
| 3928 return *obj_value; | 3928 return *obj_value; |
| 3929 } | 3929 } |
| 3930 | 3930 |
| 3931 LookupResult result; | 3931 LookupResult result; |
| 3932 js_object->LookupRealNamedProperty(*name, &result); | 3932 js_object->LookupRealNamedProperty(*name, &result); |
| 3933 | 3933 |
| 3934 // To be compatible with safari we do not change the value on API objects |
| 3935 // in defineProperty. Firefox disagrees here, and actually changes the value. |
| 3936 if (result.IsProperty() && |
| 3937 (result.type() == CALLBACKS) && |
| 3938 result.GetCallbackObject()->IsAccessorInfo()) { |
| 3939 return isolate->heap()->undefined_value(); |
| 3940 } |
| 3941 |
| 3934 // Take special care when attributes are different and there is already | 3942 // Take special care when attributes are different and there is already |
| 3935 // a property. For simplicity we normalize the property which enables us | 3943 // a property. For simplicity we normalize the property which enables us |
| 3936 // to not worry about changing the instance_descriptor and creating a new | 3944 // to not worry about changing the instance_descriptor and creating a new |
| 3937 // map. The current version of SetObjectProperty does not handle attributes | 3945 // map. The current version of SetObjectProperty does not handle attributes |
| 3938 // correctly in the case where a property is a field and is reset with | 3946 // correctly in the case where a property is a field and is reset with |
| 3939 // new attributes. | 3947 // new attributes. |
| 3940 if (result.IsProperty() && | 3948 if (result.IsProperty() && |
| 3941 (attr != result.GetAttributes() || result.type() == CALLBACKS)) { | 3949 (attr != result.GetAttributes() || result.type() == CALLBACKS)) { |
| 3942 // New attributes - normalize to avoid writing to instance descriptor | 3950 // New attributes - normalize to avoid writing to instance descriptor |
| 3943 if (js_object->IsJSGlobalProxy()) { | 3951 if (js_object->IsJSGlobalProxy()) { |
| (...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8265 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 8273 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, |
| 8266 context, | 8274 context, |
| 8267 NOT_TENURED); | 8275 NOT_TENURED); |
| 8268 return *fun; | 8276 return *fun; |
| 8269 } | 8277 } |
| 8270 | 8278 |
| 8271 | 8279 |
| 8272 static ObjectPair CompileGlobalEval(Isolate* isolate, | 8280 static ObjectPair CompileGlobalEval(Isolate* isolate, |
| 8273 Handle<String> source, | 8281 Handle<String> source, |
| 8274 Handle<Object> receiver, | 8282 Handle<Object> receiver, |
| 8275 StrictModeFlag mode) { | 8283 StrictModeFlag strict_mode) { |
| 8276 // Deal with a normal eval call with a string argument. Compile it | 8284 // Deal with a normal eval call with a string argument. Compile it |
| 8277 // and return the compiled function bound in the local context. | 8285 // and return the compiled function bound in the local context. |
| 8278 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( | 8286 Handle<SharedFunctionInfo> shared = Compiler::CompileEval( |
| 8279 source, | 8287 source, |
| 8280 Handle<Context>(isolate->context()), | 8288 Handle<Context>(isolate->context()), |
| 8281 isolate->context()->IsGlobalContext(), | 8289 isolate->context()->IsGlobalContext(), |
| 8282 mode); | 8290 strict_mode); |
| 8283 if (shared.is_null()) return MakePair(Failure::Exception(), NULL); | 8291 if (shared.is_null()) return MakePair(Failure::Exception(), NULL); |
| 8284 Handle<JSFunction> compiled = | 8292 Handle<JSFunction> compiled = |
| 8285 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 8293 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 8286 shared, Handle<Context>(isolate->context()), NOT_TENURED); | 8294 shared, Handle<Context>(isolate->context()), NOT_TENURED); |
| 8287 return MakePair(*compiled, *receiver); | 8295 return MakePair(*compiled, *receiver); |
| 8288 } | 8296 } |
| 8289 | 8297 |
| 8290 | 8298 |
| 8291 static ObjectPair Runtime_ResolvePossiblyDirectEval( | 8299 static ObjectPair Runtime_ResolvePossiblyDirectEval( |
| 8292 RUNTIME_CALLING_CONVENTION) { | 8300 RUNTIME_CALLING_CONVENTION) { |
| (...skipping 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12164 } else { | 12172 } else { |
| 12165 // Handle last resort GC and make sure to allow future allocations | 12173 // Handle last resort GC and make sure to allow future allocations |
| 12166 // to grow the heap without causing GCs (if possible). | 12174 // to grow the heap without causing GCs (if possible). |
| 12167 COUNTERS->gc_last_resort_from_js()->Increment(); | 12175 COUNTERS->gc_last_resort_from_js()->Increment(); |
| 12168 HEAP->CollectAllGarbage(false); | 12176 HEAP->CollectAllGarbage(false); |
| 12169 } | 12177 } |
| 12170 } | 12178 } |
| 12171 | 12179 |
| 12172 | 12180 |
| 12173 } } // namespace v8::internal | 12181 } } // namespace v8::internal |
| OLD | NEW |