| 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 5172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5183 } | 5183 } |
| 5184 | 5184 |
| 5185 Handle<Object> old_value; | 5185 Handle<Object> old_value; |
| 5186 bool should_enqueue_change_record = false; | 5186 bool should_enqueue_change_record = false; |
| 5187 if (object->map()->is_observed()) { | 5187 if (object->map()->is_observed()) { |
| 5188 should_enqueue_change_record = HasLocalElement(object, index); | 5188 should_enqueue_change_record = HasLocalElement(object, index); |
| 5189 if (should_enqueue_change_record) { | 5189 if (should_enqueue_change_record) { |
| 5190 if (object->GetLocalElementAccessorPair(index) != NULL) { | 5190 if (object->GetLocalElementAccessorPair(index) != NULL) { |
| 5191 old_value = Handle<Object>::cast(factory->the_hole_value()); | 5191 old_value = Handle<Object>::cast(factory->the_hole_value()); |
| 5192 } else { | 5192 } else { |
| 5193 old_value = Object::GetElement(isolate, object, index); | 5193 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); |
| 5194 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | |
| 5195 } | 5194 } |
| 5196 } | 5195 } |
| 5197 } | 5196 } |
| 5198 | 5197 |
| 5199 // Skip interceptor if forcing deletion. | 5198 // Skip interceptor if forcing deletion. |
| 5200 Handle<Object> result; | 5199 Handle<Object> result; |
| 5201 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { | 5200 if (object->HasIndexedInterceptor() && mode != FORCE_DELETION) { |
| 5202 result = DeleteElementWithInterceptor(object, index); | 5201 result = DeleteElementWithInterceptor(object, index); |
| 5203 } else { | 5202 } else { |
| 5204 result = AccessorDelete(object, index, mode); | 5203 result = AccessorDelete(object, index, mode); |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6353 bool is_element = name->AsArrayIndex(&index); | 6352 bool is_element = name->AsArrayIndex(&index); |
| 6354 | 6353 |
| 6355 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 6354 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 6356 bool is_observed = object->map()->is_observed() && | 6355 bool is_observed = object->map()->is_observed() && |
| 6357 *name != isolate->heap()->hidden_string(); | 6356 *name != isolate->heap()->hidden_string(); |
| 6358 bool preexists = false; | 6357 bool preexists = false; |
| 6359 if (is_observed) { | 6358 if (is_observed) { |
| 6360 if (is_element) { | 6359 if (is_element) { |
| 6361 preexists = HasLocalElement(object, index); | 6360 preexists = HasLocalElement(object, index); |
| 6362 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { | 6361 if (preexists && object->GetLocalElementAccessorPair(index) == NULL) { |
| 6363 old_value = Object::GetElement(isolate, object, index); | 6362 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); |
| 6364 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | |
| 6365 } | 6363 } |
| 6366 } else { | 6364 } else { |
| 6367 LookupResult lookup(isolate); | 6365 LookupResult lookup(isolate); |
| 6368 object->LocalLookup(*name, &lookup, true); | 6366 object->LocalLookup(*name, &lookup, true); |
| 6369 preexists = lookup.IsProperty(); | 6367 preexists = lookup.IsProperty(); |
| 6370 if (preexists && lookup.IsDataProperty()) { | 6368 if (preexists && lookup.IsDataProperty()) { |
| 6371 old_value = Object::GetProperty(object, name); | 6369 old_value = Object::GetProperty(object, name); |
| 6372 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | 6370 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); |
| 6373 } | 6371 } |
| 6374 } | 6372 } |
| (...skipping 4961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11336 List<Handle<Object> >* old_values, | 11334 List<Handle<Object> >* old_values, |
| 11337 List<uint32_t>* indices) { | 11335 List<uint32_t>* indices) { |
| 11338 PropertyAttributes attributes = | 11336 PropertyAttributes attributes = |
| 11339 JSReceiver::GetLocalElementAttribute(object, index); | 11337 JSReceiver::GetLocalElementAttribute(object, index); |
| 11340 ASSERT(attributes != ABSENT); | 11338 ASSERT(attributes != ABSENT); |
| 11341 if (attributes == DONT_DELETE) return false; | 11339 if (attributes == DONT_DELETE) return false; |
| 11342 Handle<Object> value; | 11340 Handle<Object> value; |
| 11343 if (object->GetLocalElementAccessorPair(index) != NULL) { | 11341 if (object->GetLocalElementAccessorPair(index) != NULL) { |
| 11344 value = Handle<Object>::cast(isolate->factory()->the_hole_value()); | 11342 value = Handle<Object>::cast(isolate->factory()->the_hole_value()); |
| 11345 } else { | 11343 } else { |
| 11346 value = Object::GetElement(isolate, object, index); | 11344 value = Object::GetElementNoExceptionThrown(isolate, object, index); |
| 11347 CHECK_NOT_EMPTY_HANDLE(isolate, value); | |
| 11348 } | 11345 } |
| 11349 old_values->Add(value); | 11346 old_values->Add(value); |
| 11350 indices->Add(index); | 11347 indices->Add(index); |
| 11351 return true; | 11348 return true; |
| 11352 } | 11349 } |
| 11353 | 11350 |
| 11354 static void EnqueueSpliceRecord(Handle<JSArray> object, | 11351 static void EnqueueSpliceRecord(Handle<JSArray> object, |
| 11355 uint32_t index, | 11352 uint32_t index, |
| 11356 Handle<JSArray> deleted, | 11353 Handle<JSArray> deleted, |
| 11357 uint32_t add_count) { | 11354 uint32_t add_count) { |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12557 } | 12554 } |
| 12558 | 12555 |
| 12559 PropertyAttributes old_attributes = | 12556 PropertyAttributes old_attributes = |
| 12560 JSReceiver::GetLocalElementAttribute(object, index); | 12557 JSReceiver::GetLocalElementAttribute(object, index); |
| 12561 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 12558 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 12562 Handle<Object> old_length_handle; | 12559 Handle<Object> old_length_handle; |
| 12563 Handle<Object> new_length_handle; | 12560 Handle<Object> new_length_handle; |
| 12564 | 12561 |
| 12565 if (old_attributes != ABSENT) { | 12562 if (old_attributes != ABSENT) { |
| 12566 if (object->GetLocalElementAccessorPair(index) == NULL) { | 12563 if (object->GetLocalElementAccessorPair(index) == NULL) { |
| 12567 old_value = Object::GetElement(isolate, object, index); | 12564 old_value = Object::GetElementNoExceptionThrown(isolate, object, index); |
| 12568 CHECK_NOT_EMPTY_HANDLE(isolate, old_value); | |
| 12569 } | 12565 } |
| 12570 } else if (object->IsJSArray()) { | 12566 } else if (object->IsJSArray()) { |
| 12571 // Store old array length in case adding an element grows the array. | 12567 // Store old array length in case adding an element grows the array. |
| 12572 old_length_handle = handle(Handle<JSArray>::cast(object)->length(), | 12568 old_length_handle = handle(Handle<JSArray>::cast(object)->length(), |
| 12573 isolate); | 12569 isolate); |
| 12574 } | 12570 } |
| 12575 | 12571 |
| 12576 // Check for lookup interceptor | 12572 // Check for lookup interceptor |
| 12577 Handle<Object> result = object->HasIndexedInterceptor() | 12573 Handle<Object> result = object->HasIndexedInterceptor() |
| 12578 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode, | 12574 ? SetElementWithInterceptor(object, index, value, attributes, strict_mode, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 12604 EndPerformSplice(Handle<JSArray>::cast(object)); | 12600 EndPerformSplice(Handle<JSArray>::cast(object)); |
| 12605 Handle<JSArray> deleted = isolate->factory()->NewJSArray(0); | 12601 Handle<JSArray> deleted = isolate->factory()->NewJSArray(0); |
| 12606 EnqueueSpliceRecord(Handle<JSArray>::cast(object), old_length, deleted, | 12602 EnqueueSpliceRecord(Handle<JSArray>::cast(object), old_length, deleted, |
| 12607 new_length - old_length); | 12603 new_length - old_length); |
| 12608 } else { | 12604 } else { |
| 12609 EnqueueChangeRecord(object, "add", name, old_value); | 12605 EnqueueChangeRecord(object, "add", name, old_value); |
| 12610 } | 12606 } |
| 12611 } else if (old_value->IsTheHole()) { | 12607 } else if (old_value->IsTheHole()) { |
| 12612 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 12608 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
| 12613 } else { | 12609 } else { |
| 12614 Handle<Object> new_value = Object::GetElement(isolate, object, index); | 12610 Handle<Object> new_value = |
| 12615 CHECK_NOT_EMPTY_HANDLE(isolate, new_value); | 12611 Object::GetElementNoExceptionThrown(isolate, object, index); |
| 12616 bool value_changed = !old_value->SameValue(*new_value); | 12612 bool value_changed = !old_value->SameValue(*new_value); |
| 12617 if (old_attributes != new_attributes) { | 12613 if (old_attributes != new_attributes) { |
| 12618 if (!value_changed) old_value = isolate->factory()->the_hole_value(); | 12614 if (!value_changed) old_value = isolate->factory()->the_hole_value(); |
| 12619 EnqueueChangeRecord(object, "reconfigure", name, old_value); | 12615 EnqueueChangeRecord(object, "reconfigure", name, old_value); |
| 12620 } else if (value_changed) { | 12616 } else if (value_changed) { |
| 12621 EnqueueChangeRecord(object, "update", name, old_value); | 12617 EnqueueChangeRecord(object, "update", name, old_value); |
| 12622 } | 12618 } |
| 12623 } | 12619 } |
| 12624 | 12620 |
| 12625 return result; | 12621 return result; |
| (...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16478 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16474 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16479 static const char* error_messages_[] = { | 16475 static const char* error_messages_[] = { |
| 16480 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16476 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16481 }; | 16477 }; |
| 16482 #undef ERROR_MESSAGES_TEXTS | 16478 #undef ERROR_MESSAGES_TEXTS |
| 16483 return error_messages_[reason]; | 16479 return error_messages_[reason]; |
| 16484 } | 16480 } |
| 16485 | 16481 |
| 16486 | 16482 |
| 16487 } } // namespace v8::internal | 16483 } } // namespace v8::internal |
| OLD | NEW |