| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 #endif | 244 #endif |
| 245 | 245 |
| 246 #undef __ | 246 #undef __ |
| 247 | 247 |
| 248 // ------------------------------------------------------------------------- | 248 // ------------------------------------------------------------------------- |
| 249 // Code generators | 249 // Code generators |
| 250 | 250 |
| 251 #define __ ACCESS_MASM(masm) | 251 #define __ ACCESS_MASM(masm) |
| 252 | 252 |
| 253 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( | 253 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
| 254 MacroAssembler* masm) { | 254 MacroAssembler* masm, AllocationSiteMode mode, |
| 255 Label* allocation_site_info_found) { |
| 255 // ----------- S t a t e ------------- | 256 // ----------- S t a t e ------------- |
| 256 // -- rax : value | 257 // -- rax : value |
| 257 // -- rbx : target map | 258 // -- rbx : target map |
| 258 // -- rcx : key | 259 // -- rcx : key |
| 259 // -- rdx : receiver | 260 // -- rdx : receiver |
| 260 // -- rsp[0] : return address | 261 // -- rsp[0] : return address |
| 261 // ----------------------------------- | 262 // ----------------------------------- |
| 263 if (mode == TRACK_ALLOCATION_SITE) { |
| 264 ASSERT(allocation_site_info_found != NULL); |
| 265 masm->TestJSArrayForAllocationSiteInfo(rdx, rdi, |
| 266 allocation_site_info_found); |
| 267 } |
| 268 |
| 262 // Set transitioned map. | 269 // Set transitioned map. |
| 263 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), rbx); | 270 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), rbx); |
| 264 __ RecordWriteField(rdx, | 271 __ RecordWriteField(rdx, |
| 265 HeapObject::kMapOffset, | 272 HeapObject::kMapOffset, |
| 266 rbx, | 273 rbx, |
| 267 rdi, | 274 rdi, |
| 268 kDontSaveFPRegs, | 275 kDontSaveFPRegs, |
| 269 EMIT_REMEMBERED_SET, | 276 EMIT_REMEMBERED_SET, |
| 270 OMIT_SMI_CHECK); | 277 OMIT_SMI_CHECK); |
| 271 } | 278 } |
| 272 | 279 |
| 273 | 280 |
| 274 void ElementsTransitionGenerator::GenerateSmiToDouble( | 281 void ElementsTransitionGenerator::GenerateSmiToDouble( |
| 275 MacroAssembler* masm, Label* fail) { | 282 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 276 // ----------- S t a t e ------------- | 283 // ----------- S t a t e ------------- |
| 277 // -- rax : value | 284 // -- rax : value |
| 278 // -- rbx : target map | 285 // -- rbx : target map |
| 279 // -- rcx : key | 286 // -- rcx : key |
| 280 // -- rdx : receiver | 287 // -- rdx : receiver |
| 281 // -- rsp[0] : return address | 288 // -- rsp[0] : return address |
| 282 // ----------------------------------- | 289 // ----------------------------------- |
| 283 // The fail label is not actually used since we do not allocate. | 290 // The fail label is not actually used since we do not allocate. |
| 284 Label allocated, new_backing_store, only_change_map, done; | 291 Label allocated, new_backing_store, only_change_map, done; |
| 285 | 292 |
| 286 if (FLAG_track_allocation_sites) { | 293 if (mode == TRACK_ALLOCATION_SITE) { |
| 287 masm->TestJSArrayForAllocationSiteInfo(rdx, rdi, fail); | 294 masm->TestJSArrayForAllocationSiteInfo(rdx, rdi, fail); |
| 288 } | 295 } |
| 289 | 296 |
| 290 // Check for empty arrays, which only require a map transition and no changes | 297 // Check for empty arrays, which only require a map transition and no changes |
| 291 // to the backing store. | 298 // to the backing store. |
| 292 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 299 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 293 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); | 300 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); |
| 294 __ j(equal, &only_change_map); | 301 __ j(equal, &only_change_map); |
| 295 | 302 |
| 296 // Check backing store for COW-ness. For COW arrays we have to | 303 // Check backing store for COW-ness. For COW arrays we have to |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 __ movq(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), r15); | 398 __ movq(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), r15); |
| 392 __ bind(&entry); | 399 __ bind(&entry); |
| 393 __ decq(r9); | 400 __ decq(r9); |
| 394 __ j(not_sign, &loop); | 401 __ j(not_sign, &loop); |
| 395 | 402 |
| 396 __ bind(&done); | 403 __ bind(&done); |
| 397 } | 404 } |
| 398 | 405 |
| 399 | 406 |
| 400 void ElementsTransitionGenerator::GenerateDoubleToObject( | 407 void ElementsTransitionGenerator::GenerateDoubleToObject( |
| 401 MacroAssembler* masm, Label* fail) { | 408 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 402 // ----------- S t a t e ------------- | 409 // ----------- S t a t e ------------- |
| 403 // -- rax : value | 410 // -- rax : value |
| 404 // -- rbx : target map | 411 // -- rbx : target map |
| 405 // -- rcx : key | 412 // -- rcx : key |
| 406 // -- rdx : receiver | 413 // -- rdx : receiver |
| 407 // -- rsp[0] : return address | 414 // -- rsp[0] : return address |
| 408 // ----------------------------------- | 415 // ----------------------------------- |
| 409 Label loop, entry, convert_hole, gc_required, only_change_map; | 416 Label loop, entry, convert_hole, gc_required, only_change_map; |
| 410 | 417 |
| 418 if (mode == TRACK_ALLOCATION_SITE) { |
| 419 masm->TestJSArrayForAllocationSiteInfo(rdx, rdi, fail); |
| 420 } |
| 421 |
| 411 // Check for empty arrays, which only require a map transition and no changes | 422 // Check for empty arrays, which only require a map transition and no changes |
| 412 // to the backing store. | 423 // to the backing store. |
| 413 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 424 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 414 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); | 425 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); |
| 415 __ j(equal, &only_change_map); | 426 __ j(equal, &only_change_map); |
| 416 | 427 |
| 417 __ push(rax); | 428 __ push(rax); |
| 418 | 429 |
| 419 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 430 __ movq(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 420 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); | 431 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 CodePatcher patcher(sequence, young_length); | 773 CodePatcher patcher(sequence, young_length); |
| 763 patcher.masm()->call(stub->instruction_start()); | 774 patcher.masm()->call(stub->instruction_start()); |
| 764 patcher.masm()->nop(); | 775 patcher.masm()->nop(); |
| 765 } | 776 } |
| 766 } | 777 } |
| 767 | 778 |
| 768 | 779 |
| 769 } } // namespace v8::internal | 780 } } // namespace v8::internal |
| 770 | 781 |
| 771 #endif // V8_TARGET_ARCH_X64 | 782 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |