| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5096 return handle(*result_internal, isolate); | 5096 return handle(*result_internal, isolate); |
| 5097 } | 5097 } |
| 5098 } | 5098 } |
| 5099 Handle<Object> result = | 5099 Handle<Object> result = |
| 5100 DeletePropertyPostInterceptor(object, name, NORMAL_DELETION); | 5100 DeletePropertyPostInterceptor(object, name, NORMAL_DELETION); |
| 5101 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5101 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 5102 return result; | 5102 return result; |
| 5103 } | 5103 } |
| 5104 | 5104 |
| 5105 | 5105 |
| 5106 // TODO(mstarzinger): Temporary wrapper until handlified. | |
| 5107 static Handle<Object> AccessorDelete(Handle<JSObject> object, | |
| 5108 uint32_t index, | |
| 5109 JSObject::DeleteMode mode) { | |
| 5110 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 5111 object->GetElementsAccessor()->Delete(*object, | |
| 5112 index, | |
| 5113 mode), | |
| 5114 Object); | |
| 5115 } | |
| 5116 | |
| 5117 | |
| 5118 Handle<Object> JSObject::DeleteElementWithInterceptor(Handle<JSObject> object, | 5106 Handle<Object> JSObject::DeleteElementWithInterceptor(Handle<JSObject> object, |
| 5119 uint32_t index) { | 5107 uint32_t index) { |
| 5120 Isolate* isolate = object->GetIsolate(); | 5108 Isolate* isolate = object->GetIsolate(); |
| 5121 Factory* factory = isolate->factory(); | 5109 Factory* factory = isolate->factory(); |
| 5122 | 5110 |
| 5123 // Make sure that the top context does not change when doing | 5111 // Make sure that the top context does not change when doing |
| 5124 // callbacks or interceptor calls. | 5112 // callbacks or interceptor calls. |
| 5125 AssertNoContextChange ncc(isolate); | 5113 AssertNoContextChange ncc(isolate); |
| 5126 | 5114 |
| 5127 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); | 5115 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); |
| 5128 if (interceptor->deleter()->IsUndefined()) return factory->false_value(); | 5116 if (interceptor->deleter()->IsUndefined()) return factory->false_value(); |
| 5129 v8::IndexedPropertyDeleterCallback deleter = | 5117 v8::IndexedPropertyDeleterCallback deleter = |
| 5130 v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter()); | 5118 v8::ToCData<v8::IndexedPropertyDeleterCallback>(interceptor->deleter()); |
| 5131 LOG(isolate, | 5119 LOG(isolate, |
| 5132 ApiIndexedPropertyAccess("interceptor-indexed-delete", *object, index)); | 5120 ApiIndexedPropertyAccess("interceptor-indexed-delete", *object, index)); |
| 5133 PropertyCallbackArguments args( | 5121 PropertyCallbackArguments args( |
| 5134 isolate, interceptor->data(), *object, *object); | 5122 isolate, interceptor->data(), *object, *object); |
| 5135 v8::Handle<v8::Boolean> result = args.Call(deleter, index); | 5123 v8::Handle<v8::Boolean> result = args.Call(deleter, index); |
| 5136 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5124 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 5137 if (!result.IsEmpty()) { | 5125 if (!result.IsEmpty()) { |
| 5138 ASSERT(result->IsBoolean()); | 5126 ASSERT(result->IsBoolean()); |
| 5139 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 5127 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 5140 result_internal->VerifyApiCallResultType(); | 5128 result_internal->VerifyApiCallResultType(); |
| 5141 // Rebox CustomArguments::kReturnValueOffset before returning. | 5129 // Rebox CustomArguments::kReturnValueOffset before returning. |
| 5142 return handle(*result_internal, isolate); | 5130 return handle(*result_internal, isolate); |
| 5143 } | 5131 } |
| 5144 Handle<Object> delete_result = AccessorDelete(object, index, NORMAL_DELETION); | 5132 Handle<Object> delete_result = object->GetElementsAccessor()->Delete( |
| 5133 object, index, NORMAL_DELETION); |
| 5145 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 5134 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 5146 return delete_result; | 5135 return delete_result; |
| 5147 } | 5136 } |
| 5148 | 5137 |
| 5149 | 5138 |
| 5150 Handle<Object> JSObject::DeleteElement(Handle<JSObject> object, | 5139 Handle<Object> JSObject::DeleteElement(Handle<JSObject> object, |
| 5151 uint32_t index, | 5140 uint32_t index, |
| 5152 DeleteMode mode) { | 5141 DeleteMode mode) { |
| 5153 Isolate* isolate = object->GetIsolate(); | 5142 Isolate* isolate = object->GetIsolate(); |
| 5154 Factory* factory = isolate->factory(); | 5143 Factory* factory = isolate->factory(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5194 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 5183 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 5195 } | 5184 } |
| 5196 } | 5185 } |
| 5197 } | 5186 } |
| 5198 | 5187 |
| 5199 // Skip interceptor if forcing deletion. | 5188 // Skip interceptor if forcing deletion. |
| 5200 Handle<Object> result; | 5189 Handle<Object> result; |
| 5201 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { | 5190 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { |
| 5202 result = DeleteElementWithInterceptor(object, index); | 5191 result = DeleteElementWithInterceptor(object, index); |
| 5203 } else { | 5192 } else { |
| 5204 result = AccessorDelete(object, index, mode); | 5193 result = object->GetElementsAccessor()->Delete(object, index, mode); |
| 5205 } | 5194 } |
| 5206 | 5195 |
| 5207 if (should_enqueue_change_record && !HasLocalElement(object, index)) { | 5196 if (should_enqueue_change_record && !HasLocalElement(object, index)) { |
| 5208 Handle<String> name = factory->Uint32ToString(index); | 5197 Handle<String> name = factory->Uint32ToString(index); |
| 5209 EnqueueChangeRecord(object, "delete", name, old_value); | 5198 EnqueueChangeRecord(object, "delete", name, old_value); |
| 5210 } | 5199 } |
| 5211 | 5200 |
| 5212 return result; | 5201 return result; |
| 5213 } | 5202 } |
| 5214 | 5203 |
| (...skipping 11263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16478 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16467 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16479 static const char* error_messages_[] = { | 16468 static const char* error_messages_[] = { |
| 16480 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16469 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16481 }; | 16470 }; |
| 16482 #undef ERROR_MESSAGES_TEXTS | 16471 #undef ERROR_MESSAGES_TEXTS |
| 16483 return error_messages_[reason]; | 16472 return error_messages_[reason]; |
| 16484 } | 16473 } |
| 16485 | 16474 |
| 16486 | 16475 |
| 16487 } } // namespace v8::internal | 16476 } } // namespace v8::internal |
| OLD | NEW |