| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // IncrementalMarking. | 269 // IncrementalMarking. |
| 270 int size_delta = to_trim * entry_size; | 270 int size_delta = to_trim * entry_size; |
| 271 if (heap->marking()->TransferMark(elms->address(), | 271 if (heap->marking()->TransferMark(elms->address(), |
| 272 elms->address() + size_delta)) { | 272 elms->address() + size_delta)) { |
| 273 MemoryChunk::IncrementLiveBytesFromMutator(elms->address(), -size_delta); | 273 MemoryChunk::IncrementLiveBytesFromMutator(elms->address(), -size_delta); |
| 274 } | 274 } |
| 275 | 275 |
| 276 FixedArrayBase* new_elms = FixedArrayBase::cast(HeapObject::FromAddress( | 276 FixedArrayBase* new_elms = FixedArrayBase::cast(HeapObject::FromAddress( |
| 277 elms->address() + size_delta)); | 277 elms->address() + size_delta)); |
| 278 HeapProfiler* profiler = heap->isolate()->heap_profiler(); | 278 HeapProfiler* profiler = heap->isolate()->heap_profiler(); |
| 279 if (profiler->is_profiling()) { | 279 if (profiler->is_tracking_object_moves()) { |
| 280 profiler->ObjectMoveEvent(elms->address(), | 280 profiler->ObjectMoveEvent(elms->address(), |
| 281 new_elms->address(), | 281 new_elms->address(), |
| 282 new_elms->Size()); | 282 new_elms->Size()); |
| 283 if (profiler->is_tracking_allocations()) { | |
| 284 // Report filler object as a new allocation. | |
| 285 // Otherwise it will become an untracked object. | |
| 286 profiler->NewObjectEvent(elms->address(), elms->Size()); | |
| 287 } | |
| 288 } | 283 } |
| 289 return new_elms; | 284 return new_elms; |
| 290 } | 285 } |
| 291 | 286 |
| 292 | 287 |
| 293 static bool ArrayPrototypeHasNoElements(Heap* heap, | 288 static bool ArrayPrototypeHasNoElements(Heap* heap, |
| 294 Context* native_context, | 289 Context* native_context, |
| 295 JSObject* array_proto) { | 290 JSObject* array_proto) { |
| 296 // This method depends on non writability of Object and Array prototype | 291 // This method depends on non writability of Object and Array prototype |
| 297 // fields. | 292 // fields. |
| 298 if (array_proto->elements() != heap->empty_fixed_array()) return false; | 293 if (array_proto->elements() != heap->empty_fixed_array()) return false; |
| 299 // Object.prototype | 294 // Object.prototype |
| 300 Object* proto = array_proto->GetPrototype(); | 295 Object* proto = array_proto->GetPrototype(); |
| 301 if (proto == heap->null_value()) return false; | 296 if (proto == heap->null_value()) return false; |
| 302 array_proto = JSObject::cast(proto); | 297 array_proto = JSObject::cast(proto); |
| 303 if (array_proto != native_context->initial_object_prototype()) return false; | 298 if (array_proto != native_context->initial_object_prototype()) return false; |
| 304 if (array_proto->elements() != heap->empty_fixed_array()) return false; | 299 if (array_proto->elements() != heap->empty_fixed_array()) return false; |
| 305 return array_proto->GetPrototype()->IsNull(); | 300 return array_proto->GetPrototype()->IsNull(); |
| 306 } | 301 } |
| 307 | 302 |
| 308 | 303 |
| 309 MUST_USE_RESULT | 304 MUST_USE_RESULT |
| 310 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 305 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
| 311 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { | 306 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { |
| 312 if (!receiver->IsJSArray()) return NULL; | 307 if (!receiver->IsJSArray()) return NULL; |
| 313 JSArray* array = JSArray::cast(receiver); | 308 JSArray* array = JSArray::cast(receiver); |
| 314 if (array->map()->is_observed()) return NULL; | 309 if (array->map()->is_observed()) return NULL; |
| 310 if (!array->map()->is_extensible()) return NULL; |
| 315 HeapObject* elms = array->elements(); | 311 HeapObject* elms = array->elements(); |
| 316 Map* map = elms->map(); | 312 Map* map = elms->map(); |
| 317 if (map == heap->fixed_array_map()) { | 313 if (map == heap->fixed_array_map()) { |
| 318 if (args == NULL || array->HasFastObjectElements()) return elms; | 314 if (args == NULL || array->HasFastObjectElements()) return elms; |
| 319 } else if (map == heap->fixed_cow_array_map()) { | 315 } else if (map == heap->fixed_cow_array_map()) { |
| 320 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 316 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
| 321 if (args == NULL || array->HasFastObjectElements() || | 317 if (args == NULL || array->HasFastObjectElements() || |
| 322 !maybe_writable_result->To(&elms)) { | 318 !maybe_writable_result->To(&elms)) { |
| 323 return maybe_writable_result; | 319 return maybe_writable_result; |
| 324 } | 320 } |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 StoreIC::GenerateMiss(masm); | 1405 StoreIC::GenerateMiss(masm); |
| 1410 } | 1406 } |
| 1411 | 1407 |
| 1412 | 1408 |
| 1413 static void Generate_StoreIC_Normal(MacroAssembler* masm) { | 1409 static void Generate_StoreIC_Normal(MacroAssembler* masm) { |
| 1414 StoreIC::GenerateNormal(masm); | 1410 StoreIC::GenerateNormal(masm); |
| 1415 } | 1411 } |
| 1416 | 1412 |
| 1417 | 1413 |
| 1418 static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { | 1414 static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) { |
| 1419 StoreIC::GenerateMegamorphic(masm, kNonStrictMode); | 1415 StoreIC::GenerateMegamorphic(masm, |
| 1416 StoreIC::ComputeExtraICState(kNonStrictMode)); |
| 1420 } | 1417 } |
| 1421 | 1418 |
| 1422 | 1419 |
| 1423 static void Generate_StoreIC_Megamorphic_Strict(MacroAssembler* masm) { | 1420 static void Generate_StoreIC_Megamorphic_Strict(MacroAssembler* masm) { |
| 1424 StoreIC::GenerateMegamorphic(masm, kStrictMode); | 1421 StoreIC::GenerateMegamorphic(masm, |
| 1422 StoreIC::ComputeExtraICState(kStrictMode)); |
| 1425 } | 1423 } |
| 1426 | 1424 |
| 1427 | 1425 |
| 1428 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) { | |
| 1429 StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode); | |
| 1430 } | |
| 1431 | |
| 1432 | |
| 1433 static void Generate_StoreIC_GlobalProxy_Strict(MacroAssembler* masm) { | |
| 1434 StoreIC::GenerateRuntimeSetProperty(masm, kStrictMode); | |
| 1435 } | |
| 1436 | |
| 1437 | |
| 1438 static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { | 1426 static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { |
| 1439 StoreStubCompiler::GenerateStoreViaSetter(masm, Handle<JSFunction>()); | 1427 StoreStubCompiler::GenerateStoreViaSetter(masm, Handle<JSFunction>()); |
| 1440 } | 1428 } |
| 1441 | 1429 |
| 1442 | 1430 |
| 1443 static void Generate_StoreIC_Generic(MacroAssembler* masm) { | 1431 static void Generate_StoreIC_Generic(MacroAssembler* masm) { |
| 1444 StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode); | 1432 StoreIC::GenerateRuntimeSetProperty(masm, kNonStrictMode); |
| 1445 } | 1433 } |
| 1446 | 1434 |
| 1447 | 1435 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1801 } | 1789 } |
| 1802 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1790 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1803 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1791 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1804 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1792 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1805 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1793 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1806 #undef DEFINE_BUILTIN_ACCESSOR_C | 1794 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1807 #undef DEFINE_BUILTIN_ACCESSOR_A | 1795 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1808 | 1796 |
| 1809 | 1797 |
| 1810 } } // namespace v8::internal | 1798 } } // namespace v8::internal |
| OLD | NEW |