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 5067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5078 name = Handle<Name>::cast(key); | 5078 name = Handle<Name>::cast(key); |
5079 } else { | 5079 } else { |
5080 // Call-back into JavaScript to convert the key to a string. | 5080 // Call-back into JavaScript to convert the key to a string. |
5081 bool has_pending_exception = false; | 5081 bool has_pending_exception = false; |
5082 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 5082 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); |
5083 if (has_pending_exception) return Failure::Exception(); | 5083 if (has_pending_exception) return Failure::Exception(); |
5084 name = Handle<String>::cast(converted); | 5084 name = Handle<String>::cast(converted); |
5085 } | 5085 } |
5086 | 5086 |
5087 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); | 5087 if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
5088 return receiver->DeleteProperty(*name, mode); | 5088 Handle<Object> result = JSReceiver::DeleteProperty(receiver, name, mode); |
| 5089 RETURN_IF_EMPTY_HANDLE(isolate, result); |
| 5090 return *result; |
5089 } | 5091 } |
5090 | 5092 |
5091 | 5093 |
5092 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) { | 5094 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) { |
5093 SealHandleScope shs(isolate); | 5095 SealHandleScope shs(isolate); |
5094 RUNTIME_ASSERT(args.length() == 4 || args.length() == 5); | 5096 RUNTIME_ASSERT(args.length() == 4 || args.length() == 5); |
5095 | 5097 |
5096 Handle<Object> object = args.at<Object>(0); | 5098 Handle<Object> object = args.at<Object>(0); |
5097 Handle<Object> key = args.at<Object>(1); | 5099 Handle<Object> key = args.at<Object>(1); |
5098 Handle<Object> value = args.at<Object>(2); | 5100 Handle<Object> value = args.at<Object>(2); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5284 (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5286 (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
5285 attributes = static_cast<PropertyAttributes>(unchecked_value); | 5287 attributes = static_cast<PropertyAttributes>(unchecked_value); |
5286 } | 5288 } |
5287 | 5289 |
5288 return object-> | 5290 return object-> |
5289 SetLocalPropertyIgnoreAttributes(name, args[2], attributes); | 5291 SetLocalPropertyIgnoreAttributes(name, args[2], attributes); |
5290 } | 5292 } |
5291 | 5293 |
5292 | 5294 |
5293 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { | 5295 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeleteProperty) { |
5294 SealHandleScope shs(isolate); | 5296 HandleScope scope(isolate); |
5295 ASSERT(args.length() == 3); | 5297 ASSERT(args.length() == 3); |
5296 | 5298 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
5297 CONVERT_ARG_CHECKED(JSReceiver, object, 0); | 5299 CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
5298 CONVERT_ARG_CHECKED(Name, key, 1); | |
5299 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); | 5300 CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode, 2); |
5300 return object->DeleteProperty(key, (strict_mode == kStrictMode) | 5301 JSReceiver::DeleteMode delete_mode = (strict_mode == kStrictMode) |
5301 ? JSReceiver::STRICT_DELETION | 5302 ? JSReceiver::STRICT_DELETION : JSReceiver::NORMAL_DELETION; |
5302 : JSReceiver::NORMAL_DELETION); | 5303 Handle<Object> result = JSReceiver::DeleteProperty(object, key, delete_mode); |
| 5304 RETURN_IF_EMPTY_HANDLE(isolate, result); |
| 5305 return *result; |
5303 } | 5306 } |
5304 | 5307 |
5305 | 5308 |
5306 static Object* HasLocalPropertyImplementation(Isolate* isolate, | 5309 static Object* HasLocalPropertyImplementation(Isolate* isolate, |
5307 Handle<JSObject> object, | 5310 Handle<JSObject> object, |
5308 Handle<Name> key) { | 5311 Handle<Name> key) { |
5309 if (object->HasLocalProperty(*key)) return isolate->heap()->true_value(); | 5312 if (object->HasLocalProperty(*key)) return isolate->heap()->true_value(); |
5310 // Handle hidden prototypes. If there's a hidden prototype above this thing | 5313 // Handle hidden prototypes. If there's a hidden prototype above this thing |
5311 // then we have to check it for properties, because they are supposed to | 5314 // then we have to check it for properties, because they are supposed to |
5312 // look like they are on this object. | 5315 // look like they are on this object. |
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8827 | 8830 |
8828 // If the slot was found in a context, it should be DONT_DELETE. | 8831 // If the slot was found in a context, it should be DONT_DELETE. |
8829 if (holder->IsContext()) { | 8832 if (holder->IsContext()) { |
8830 return isolate->heap()->false_value(); | 8833 return isolate->heap()->false_value(); |
8831 } | 8834 } |
8832 | 8835 |
8833 // The slot was found in a JSObject, either a context extension object, | 8836 // The slot was found in a JSObject, either a context extension object, |
8834 // the global object, or the subject of a with. Try to delete it | 8837 // the global object, or the subject of a with. Try to delete it |
8835 // (respecting DONT_DELETE). | 8838 // (respecting DONT_DELETE). |
8836 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 8839 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
8837 return object->DeleteProperty(*name, JSReceiver::NORMAL_DELETION); | 8840 Handle<Object> result = JSReceiver::DeleteProperty(object, name); |
| 8841 RETURN_IF_EMPTY_HANDLE(isolate, result); |
| 8842 return *result; |
8838 } | 8843 } |
8839 | 8844 |
8840 | 8845 |
8841 // A mechanism to return a pair of Object pointers in registers (if possible). | 8846 // A mechanism to return a pair of Object pointers in registers (if possible). |
8842 // How this is achieved is calling convention-dependent. | 8847 // How this is achieved is calling convention-dependent. |
8843 // All currently supported x86 compiles uses calling conventions that are cdecl | 8848 // All currently supported x86 compiles uses calling conventions that are cdecl |
8844 // variants where a 64-bit value is returned in two 32-bit registers | 8849 // variants where a 64-bit value is returned in two 32-bit registers |
8845 // (edx:eax on ia32, r1:r0 on ARM). | 8850 // (edx:eax on ia32, r1:r0 on ARM). |
8846 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. | 8851 // In AMD-64 calling convention a struct of two pointers is returned in rdx:rax. |
8847 // In Win64 calling convention, a struct of two pointers is returned in memory, | 8852 // In Win64 calling convention, a struct of two pointers is returned in memory, |
(...skipping 5099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13947 // Handle last resort GC and make sure to allow future allocations | 13952 // Handle last resort GC and make sure to allow future allocations |
13948 // to grow the heap without causing GCs (if possible). | 13953 // to grow the heap without causing GCs (if possible). |
13949 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13954 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13950 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13955 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13951 "Runtime::PerformGC"); | 13956 "Runtime::PerformGC"); |
13952 } | 13957 } |
13953 } | 13958 } |
13954 | 13959 |
13955 | 13960 |
13956 } } // namespace v8::internal | 13961 } } // namespace v8::internal |
OLD | NEW |