| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 Object); | 273 Object); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, | 277 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, |
| 278 Handle<Object> key) { | 278 Handle<Object> key) { |
| 279 CALL_HEAP_FUNCTION(Runtime::ForceDeleteObjectProperty(object, key), Object); | 279 CALL_HEAP_FUNCTION(Runtime::ForceDeleteObjectProperty(object, key), Object); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 Handle<Object> IgnoreAttributesAndSetLocalProperty( | 283 Handle<Object> SetLocalPropertyIgnoreAttributes( |
| 284 Handle<JSObject> object, | 284 Handle<JSObject> object, |
| 285 Handle<String> key, | 285 Handle<String> key, |
| 286 Handle<Object> value, | 286 Handle<Object> value, |
| 287 PropertyAttributes attributes) { | 287 PropertyAttributes attributes) { |
| 288 CALL_HEAP_FUNCTION(object-> | 288 CALL_HEAP_FUNCTION(object-> |
| 289 IgnoreAttributesAndSetLocalProperty(*key, *value, attributes), Object); | 289 SetLocalPropertyIgnoreAttributes(*key, *value, attributes), Object); |
| 290 } |
| 291 |
| 292 |
| 293 void SetLocalPropertyNoThrow(Handle<JSObject> object, |
| 294 Handle<String> key, |
| 295 Handle<Object> value, |
| 296 PropertyAttributes attributes) { |
| 297 ASSERT(!Top::has_pending_exception()); |
| 298 CHECK(!SetLocalPropertyIgnoreAttributes( |
| 299 object, key, value, attributes).is_null()); |
| 300 CHECK(!Top::has_pending_exception()); |
| 290 } | 301 } |
| 291 | 302 |
| 292 | 303 |
| 293 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, | 304 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, |
| 294 Handle<String> key, | 305 Handle<String> key, |
| 295 Handle<Object> value, | 306 Handle<Object> value, |
| 296 PropertyAttributes attributes) { | 307 PropertyAttributes attributes) { |
| 297 CALL_HEAP_FUNCTION(object->SetPropertyWithInterceptor(*key, | 308 CALL_HEAP_FUNCTION(object->SetPropertyWithInterceptor(*key, |
| 298 *value, | 309 *value, |
| 299 attributes), | 310 attributes), |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 bool has_exception; | 426 bool has_exception; |
| 416 Handle<Object> number = Execution::ToNumber(value, &has_exception); | 427 Handle<Object> number = Execution::ToNumber(value, &has_exception); |
| 417 if (has_exception) return Handle<Object>(); | 428 if (has_exception) return Handle<Object>(); |
| 418 value = number; | 429 value = number; |
| 419 } | 430 } |
| 420 } | 431 } |
| 421 CALL_HEAP_FUNCTION(object->SetElement(index, *value), Object); | 432 CALL_HEAP_FUNCTION(object->SetElement(index, *value), Object); |
| 422 } | 433 } |
| 423 | 434 |
| 424 | 435 |
| 436 Handle<Object> SetOwnElement(Handle<JSObject> object, |
| 437 uint32_t index, |
| 438 Handle<Object> value) { |
| 439 ASSERT(!object->HasPixelElements()); |
| 440 ASSERT(!object->HasExternalArrayElements()); |
| 441 CALL_HEAP_FUNCTION(object->SetElement(index, *value, false), Object); |
| 442 } |
| 443 |
| 444 |
| 425 Handle<JSObject> Copy(Handle<JSObject> obj) { | 445 Handle<JSObject> Copy(Handle<JSObject> obj) { |
| 426 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject); | 446 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject); |
| 427 } | 447 } |
| 428 | 448 |
| 429 | 449 |
| 430 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) { | 450 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) { |
| 431 CALL_HEAP_FUNCTION(obj->DefineAccessor(*info), Object); | 451 CALL_HEAP_FUNCTION(obj->DefineAccessor(*info), Object); |
| 432 } | 452 } |
| 433 | 453 |
| 434 | 454 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, | 812 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, |
| 793 ClearExceptionFlag flag) { | 813 ClearExceptionFlag flag) { |
| 794 return shared->is_compiled() || CompileLazyShared(shared, flag); | 814 return shared->is_compiled() || CompileLazyShared(shared, flag); |
| 795 } | 815 } |
| 796 | 816 |
| 797 | 817 |
| 798 static bool CompileLazyHelper(CompilationInfo* info, | 818 static bool CompileLazyHelper(CompilationInfo* info, |
| 799 ClearExceptionFlag flag) { | 819 ClearExceptionFlag flag) { |
| 800 // Compile the source information to a code object. | 820 // Compile the source information to a code object. |
| 801 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); | 821 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); |
| 822 ASSERT(!Top::has_pending_exception()); |
| 802 bool result = Compiler::CompileLazy(info); | 823 bool result = Compiler::CompileLazy(info); |
| 803 ASSERT(result != Top::has_pending_exception()); | 824 ASSERT(result != Top::has_pending_exception()); |
| 804 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); | 825 if (!result && flag == CLEAR_EXCEPTION) Top::clear_pending_exception(); |
| 805 return result; | 826 return result; |
| 806 } | 827 } |
| 807 | 828 |
| 808 | 829 |
| 809 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, | 830 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, |
| 810 ClearExceptionFlag flag) { | 831 ClearExceptionFlag flag) { |
| 811 CompilationInfo info(shared); | 832 CompilationInfo info(shared); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 if (result) PROFILE(FunctionCreateEvent(*function)); | 878 if (result) PROFILE(FunctionCreateEvent(*function)); |
| 858 return result; | 879 return result; |
| 859 } | 880 } |
| 860 | 881 |
| 861 | 882 |
| 862 OptimizedObjectForAddingMultipleProperties:: | 883 OptimizedObjectForAddingMultipleProperties:: |
| 863 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 884 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
| 864 int expected_additional_properties, | 885 int expected_additional_properties, |
| 865 bool condition) { | 886 bool condition) { |
| 866 object_ = object; | 887 object_ = object; |
| 867 if (condition && object_->HasFastProperties()) { | 888 if (condition && object_->HasFastProperties() && !object->IsJSGlobalProxy()) { |
| 868 // Normalize the properties of object to avoid n^2 behavior | 889 // Normalize the properties of object to avoid n^2 behavior |
| 869 // when extending the object multiple properties. Indicate the number of | 890 // when extending the object multiple properties. Indicate the number of |
| 870 // properties to be added. | 891 // properties to be added. |
| 871 unused_property_fields_ = object->map()->unused_property_fields(); | 892 unused_property_fields_ = object->map()->unused_property_fields(); |
| 872 NormalizeProperties(object_, | 893 NormalizeProperties(object_, |
| 873 KEEP_INOBJECT_PROPERTIES, | 894 KEEP_INOBJECT_PROPERTIES, |
| 874 expected_additional_properties); | 895 expected_additional_properties); |
| 875 has_been_transformed_ = true; | 896 has_been_transformed_ = true; |
| 876 | 897 |
| 877 } else { | 898 } else { |
| 878 has_been_transformed_ = false; | 899 has_been_transformed_ = false; |
| 879 } | 900 } |
| 880 } | 901 } |
| 881 | 902 |
| 882 | 903 |
| 883 OptimizedObjectForAddingMultipleProperties:: | 904 OptimizedObjectForAddingMultipleProperties:: |
| 884 ~OptimizedObjectForAddingMultipleProperties() { | 905 ~OptimizedObjectForAddingMultipleProperties() { |
| 885 // Reoptimize the object to allow fast property access. | 906 // Reoptimize the object to allow fast property access. |
| 886 if (has_been_transformed_) { | 907 if (has_been_transformed_) { |
| 887 TransformToFastProperties(object_, unused_property_fields_); | 908 TransformToFastProperties(object_, unused_property_fields_); |
| 888 } | 909 } |
| 889 } | 910 } |
| 890 | 911 |
| 891 } } // namespace v8::internal | 912 } } // namespace v8::internal |
| OLD | NEW |