| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 i += kDoubleSize; | 390 i += kDoubleSize; |
| 391 } | 391 } |
| 392 ASSERT(i == elements_size); | 392 ASSERT(i == elements_size); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { | 397 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| 398 // Stack layout on entry: | 398 // Stack layout on entry: |
| 399 // | 399 // |
| 400 // [rsp + kPointerSize]: constant elements. | 400 // [rsp + kPointerSize]: flags (ignored) |
| 401 // [rsp + (2 * kPointerSize)]: literal index. | 401 // [rsp + (2 * kPointerSize)]: constant elements. |
| 402 // [rsp + (3 * kPointerSize)]: literals array. | 402 // [rsp + (3 * kPointerSize)]: literal index. |
| 403 // [rsp + (4 * kPointerSize)]: literals array. |
| 403 | 404 |
| 404 // Load boilerplate object into rcx and check if we need to create a | 405 // Load boilerplate object into rcx and check if we need to create a |
| 405 // boilerplate. | 406 // boilerplate. |
| 406 __ movq(rcx, Operand(rsp, 3 * kPointerSize)); | 407 __ movq(rcx, Operand(rsp, 4 * kPointerSize)); |
| 407 __ movq(rax, Operand(rsp, 2 * kPointerSize)); | 408 __ movq(rax, Operand(rsp, 3 * kPointerSize)); |
| 408 SmiIndex index = masm->SmiToIndex(rax, rax, kPointerSizeLog2); | 409 SmiIndex index = masm->SmiToIndex(rax, rax, kPointerSizeLog2); |
| 409 __ movq(rcx, | 410 __ movq(rcx, |
| 410 FieldOperand(rcx, index.reg, index.scale, FixedArray::kHeaderSize)); | 411 FieldOperand(rcx, index.reg, index.scale, FixedArray::kHeaderSize)); |
| 411 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); | 412 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); |
| 412 Label slow_case; | 413 Label slow_case; |
| 413 __ j(equal, &slow_case); | 414 __ j(equal, &slow_case); |
| 414 | 415 |
| 415 FastCloneShallowArrayStub::Mode mode = mode_; | 416 FastCloneShallowArrayStub::Mode mode = mode_; |
| 416 // rcx is boilerplate object. | 417 // rcx is boilerplate object. |
| 417 Factory* factory = masm->isolate()->factory(); | 418 Factory* factory = masm->isolate()->factory(); |
| 418 if (mode == CLONE_ANY_ELEMENTS) { | 419 if (mode == CLONE_ANY_ELEMENTS) { |
| 419 Label double_elements, check_fast_elements; | 420 Label double_elements, check_fast_elements; |
| 420 __ movq(rbx, FieldOperand(rcx, JSArray::kElementsOffset)); | 421 __ movq(rbx, FieldOperand(rcx, JSArray::kElementsOffset)); |
| 421 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), | 422 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), |
| 422 factory->fixed_cow_array_map()); | 423 factory->fixed_cow_array_map()); |
| 423 __ j(not_equal, &check_fast_elements); | 424 __ j(not_equal, &check_fast_elements); |
| 424 GenerateFastCloneShallowArrayCommon(masm, 0, COPY_ON_WRITE_ELEMENTS, | 425 GenerateFastCloneShallowArrayCommon(masm, 0, COPY_ON_WRITE_ELEMENTS, |
| 425 allocation_site_mode_, | 426 allocation_site_mode_, |
| 426 &slow_case); | 427 &slow_case); |
| 427 __ ret(3 * kPointerSize); | 428 __ ret(4 * kPointerSize); |
| 428 | 429 |
| 429 __ bind(&check_fast_elements); | 430 __ bind(&check_fast_elements); |
| 430 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), | 431 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), |
| 431 factory->fixed_array_map()); | 432 factory->fixed_array_map()); |
| 432 __ j(not_equal, &double_elements); | 433 __ j(not_equal, &double_elements); |
| 433 GenerateFastCloneShallowArrayCommon(masm, length_, CLONE_ELEMENTS, | 434 GenerateFastCloneShallowArrayCommon(masm, length_, CLONE_ELEMENTS, |
| 434 allocation_site_mode_, | 435 allocation_site_mode_, |
| 435 &slow_case); | 436 &slow_case); |
| 436 __ ret(3 * kPointerSize); | 437 __ ret(4 * kPointerSize); |
| 437 | 438 |
| 438 __ bind(&double_elements); | 439 __ bind(&double_elements); |
| 439 mode = CLONE_DOUBLE_ELEMENTS; | 440 mode = CLONE_DOUBLE_ELEMENTS; |
| 440 // Fall through to generate the code to handle double elements. | 441 // Fall through to generate the code to handle double elements. |
| 441 } | 442 } |
| 442 | 443 |
| 443 if (FLAG_debug_code) { | 444 if (FLAG_debug_code) { |
| 444 const char* message; | 445 const char* message; |
| 445 Heap::RootListIndex expected_map_index; | 446 Heap::RootListIndex expected_map_index; |
| 446 if (mode == CLONE_ELEMENTS) { | 447 if (mode == CLONE_ELEMENTS) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 458 __ movq(rcx, FieldOperand(rcx, JSArray::kElementsOffset)); | 459 __ movq(rcx, FieldOperand(rcx, JSArray::kElementsOffset)); |
| 459 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 460 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
| 460 expected_map_index); | 461 expected_map_index); |
| 461 __ Assert(equal, message); | 462 __ Assert(equal, message); |
| 462 __ pop(rcx); | 463 __ pop(rcx); |
| 463 } | 464 } |
| 464 | 465 |
| 465 GenerateFastCloneShallowArrayCommon(masm, length_, mode, | 466 GenerateFastCloneShallowArrayCommon(masm, length_, mode, |
| 466 allocation_site_mode_, | 467 allocation_site_mode_, |
| 467 &slow_case); | 468 &slow_case); |
| 468 __ ret(3 * kPointerSize); | 469 __ ret(4 * kPointerSize); |
| 469 | 470 |
| 470 __ bind(&slow_case); | 471 __ bind(&slow_case); |
| 471 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 472 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 4, 1); |
| 472 } | 473 } |
| 473 | 474 |
| 474 | 475 |
| 475 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { | 476 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { |
| 476 // Stack layout on entry: | 477 // Stack layout on entry: |
| 477 // | 478 // |
| 478 // [rsp + kPointerSize]: object literal flags. | 479 // [rsp + kPointerSize]: object literal flags. |
| 479 // [rsp + (2 * kPointerSize)]: constant properties. | 480 // [rsp + (2 * kPointerSize)]: constant properties. |
| 480 // [rsp + (3 * kPointerSize)]: literal index. | 481 // [rsp + (3 * kPointerSize)]: literal index. |
| 481 // [rsp + (4 * kPointerSize)]: literals array. | 482 // [rsp + (4 * kPointerSize)]: literals array. |
| (...skipping 6211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6693 #endif | 6694 #endif |
| 6694 | 6695 |
| 6695 __ Ret(); | 6696 __ Ret(); |
| 6696 } | 6697 } |
| 6697 | 6698 |
| 6698 #undef __ | 6699 #undef __ |
| 6699 | 6700 |
| 6700 } } // namespace v8::internal | 6701 } } // namespace v8::internal |
| 6701 | 6702 |
| 6702 #endif // V8_TARGET_ARCH_X64 | 6703 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |