| 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 5720 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5731                                                     isolate); |   5731                                                     isolate); | 
|   5732                             break; |   5732                             break; | 
|   5733                           }, |   5733                           }, | 
|   5734                           return Handle<JSObject>()); |   5734                           return Handle<JSObject>()); | 
|   5735   } else { |   5735   } else { | 
|   5736     copy = object; |   5736     copy = object; | 
|   5737   } |   5737   } | 
|   5738  |   5738  | 
|   5739   ASSERT(copying || copy.is_identical_to(object)); |   5739   ASSERT(copying || copy.is_identical_to(object)); | 
|   5740  |   5740  | 
 |   5741   ElementsKind kind = copy->GetElementsKind(); | 
 |   5742   if (copying && IsFastSmiOrObjectElementsKind(kind) && | 
 |   5743       FixedArray::cast(copy->elements())->map() == | 
 |   5744         isolate->heap()->fixed_cow_array_map()) { | 
 |   5745     isolate->counters()->cow_arrays_created_runtime()->Increment(); | 
 |   5746   } | 
 |   5747  | 
|   5741   if (!shallow) { |   5748   if (!shallow) { | 
|   5742     HandleScope scope(isolate); |   5749     HandleScope scope(isolate); | 
|   5743  |   5750  | 
|   5744     // Deep copy local properties. |   5751     // Deep copy local properties. | 
|   5745     if (copy->HasFastProperties()) { |   5752     if (copy->HasFastProperties()) { | 
|   5746       Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); |   5753       Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); | 
|   5747       int limit = copy->map()->NumberOfOwnDescriptors(); |   5754       int limit = copy->map()->NumberOfOwnDescriptors(); | 
|   5748       for (int i = 0; i < limit; i++) { |   5755       for (int i = 0; i < limit; i++) { | 
|   5749         PropertyDetails details = descriptors->GetDetails(i); |   5756         PropertyDetails details = descriptors->GetDetails(i); | 
|   5750         if (details.type() != FIELD) continue; |   5757         if (details.type() != FIELD) continue; | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5786             CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty( |   5793             CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty( | 
|   5787                 copy, key_string, result, NONE, kNonStrictMode)); |   5794                 copy, key_string, result, NONE, kNonStrictMode)); | 
|   5788           } |   5795           } | 
|   5789         } |   5796         } | 
|   5790       } |   5797       } | 
|   5791     } |   5798     } | 
|   5792  |   5799  | 
|   5793     // Deep copy local elements. |   5800     // Deep copy local elements. | 
|   5794     // Pixel elements cannot be created using an object literal. |   5801     // Pixel elements cannot be created using an object literal. | 
|   5795     ASSERT(!copy->HasExternalArrayElements()); |   5802     ASSERT(!copy->HasExternalArrayElements()); | 
|   5796     switch (copy->GetElementsKind()) { |   5803     switch (kind) { | 
|   5797       case FAST_SMI_ELEMENTS: |   5804       case FAST_SMI_ELEMENTS: | 
|   5798       case FAST_ELEMENTS: |   5805       case FAST_ELEMENTS: | 
|   5799       case FAST_HOLEY_SMI_ELEMENTS: |   5806       case FAST_HOLEY_SMI_ELEMENTS: | 
|   5800       case FAST_HOLEY_ELEMENTS: { |   5807       case FAST_HOLEY_ELEMENTS: { | 
|   5801         Handle<FixedArray> elements(FixedArray::cast(copy->elements())); |   5808         Handle<FixedArray> elements(FixedArray::cast(copy->elements())); | 
|   5802         if (elements->map() == isolate->heap()->fixed_cow_array_map()) { |   5809         if (elements->map() == isolate->heap()->fixed_cow_array_map()) { | 
|   5803           if (copying) { |  | 
|   5804             isolate->counters()->cow_arrays_created_runtime()->Increment(); |  | 
|   5805           } |  | 
|   5806 #ifdef DEBUG |   5810 #ifdef DEBUG | 
|   5807           for (int i = 0; i < elements->length(); i++) { |   5811           for (int i = 0; i < elements->length(); i++) { | 
|   5808             ASSERT(!elements->get(i)->IsJSObject()); |   5812             ASSERT(!elements->get(i)->IsJSObject()); | 
|   5809           } |   5813           } | 
|   5810 #endif |   5814 #endif | 
|   5811         } else { |   5815         } else { | 
|   5812           for (int i = 0; i < elements->length(); i++) { |   5816           for (int i = 0; i < elements->length(); i++) { | 
|   5813             Handle<Object> value(elements->get(i), isolate); |   5817             Handle<Object> value(elements->get(i), isolate); | 
|   5814             ASSERT(value->IsSmi() || |   5818             ASSERT(value->IsSmi() || | 
|   5815                    value->IsTheHole() || |   5819                    value->IsTheHole() || | 
| (...skipping 10832 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  16648 #define ERROR_MESSAGES_TEXTS(C, T) T, |  16652 #define ERROR_MESSAGES_TEXTS(C, T) T, | 
|  16649   static const char* error_messages_[] = { |  16653   static const char* error_messages_[] = { | 
|  16650       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |  16654       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 
|  16651   }; |  16655   }; | 
|  16652 #undef ERROR_MESSAGES_TEXTS |  16656 #undef ERROR_MESSAGES_TEXTS | 
|  16653   return error_messages_[reason]; |  16657   return error_messages_[reason]; | 
|  16654 } |  16658 } | 
|  16655  |  16659  | 
|  16656  |  16660  | 
|  16657 } }  // namespace v8::internal |  16661 } }  // namespace v8::internal | 
| OLD | NEW |