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 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 __ lea(r8, Operand(rbx, times_pointer_size, kParameterMapHeaderSize)); | 2656 __ lea(r8, Operand(rbx, times_pointer_size, kParameterMapHeaderSize)); |
2657 __ bind(&no_parameter_map); | 2657 __ bind(&no_parameter_map); |
2658 | 2658 |
2659 // 2. Backing store. | 2659 // 2. Backing store. |
2660 __ lea(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize)); | 2660 __ lea(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize)); |
2661 | 2661 |
2662 // 3. Arguments object. | 2662 // 3. Arguments object. |
2663 __ addq(r8, Immediate(Heap::kArgumentsObjectSize)); | 2663 __ addq(r8, Immediate(Heap::kArgumentsObjectSize)); |
2664 | 2664 |
2665 // Do the allocation of all three objects in one go. | 2665 // Do the allocation of all three objects in one go. |
2666 __ AllocateInNewSpace(r8, rax, rdx, rdi, &runtime, TAG_OBJECT); | 2666 __ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT); |
2667 | 2667 |
2668 // rax = address of new object(s) (tagged) | 2668 // rax = address of new object(s) (tagged) |
2669 // rcx = argument count (untagged) | 2669 // rcx = argument count (untagged) |
2670 // Get the arguments boilerplate from the current native context into rdi. | 2670 // Get the arguments boilerplate from the current native context into rdi. |
2671 Label has_mapped_parameters, copy; | 2671 Label has_mapped_parameters, copy; |
2672 __ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2672 __ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2673 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); | 2673 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); |
2674 __ testq(rbx, rbx); | 2674 __ testq(rbx, rbx); |
2675 __ j(not_zero, &has_mapped_parameters, Label::kNear); | 2675 __ j(not_zero, &has_mapped_parameters, Label::kNear); |
2676 | 2676 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 // the arguments object and the elements array. | 2874 // the arguments object and the elements array. |
2875 Label add_arguments_object; | 2875 Label add_arguments_object; |
2876 __ bind(&try_allocate); | 2876 __ bind(&try_allocate); |
2877 __ testq(rcx, rcx); | 2877 __ testq(rcx, rcx); |
2878 __ j(zero, &add_arguments_object, Label::kNear); | 2878 __ j(zero, &add_arguments_object, Label::kNear); |
2879 __ lea(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize)); | 2879 __ lea(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize)); |
2880 __ bind(&add_arguments_object); | 2880 __ bind(&add_arguments_object); |
2881 __ addq(rcx, Immediate(Heap::kArgumentsObjectSizeStrict)); | 2881 __ addq(rcx, Immediate(Heap::kArgumentsObjectSizeStrict)); |
2882 | 2882 |
2883 // Do the allocation of both objects in one go. | 2883 // Do the allocation of both objects in one go. |
2884 __ AllocateInNewSpace(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT); | 2884 __ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT); |
2885 | 2885 |
2886 // Get the arguments boilerplate from the current native context. | 2886 // Get the arguments boilerplate from the current native context. |
2887 __ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2887 __ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2888 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); | 2888 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); |
2889 const int offset = | 2889 const int offset = |
2890 Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX); | 2890 Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX); |
2891 __ movq(rdi, Operand(rdi, offset)); | 2891 __ movq(rdi, Operand(rdi, offset)); |
2892 | 2892 |
2893 // Copy the JS object part. | 2893 // Copy the JS object part. |
2894 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { | 2894 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3407 __ JumpIfNotSmi(r8, &slowcase); | 3407 __ JumpIfNotSmi(r8, &slowcase); |
3408 __ SmiToInteger32(rbx, r8); | 3408 __ SmiToInteger32(rbx, r8); |
3409 __ cmpl(rbx, Immediate(kMaxInlineLength)); | 3409 __ cmpl(rbx, Immediate(kMaxInlineLength)); |
3410 __ j(above, &slowcase); | 3410 __ j(above, &slowcase); |
3411 // Smi-tagging is equivalent to multiplying by 2. | 3411 // Smi-tagging is equivalent to multiplying by 2. |
3412 STATIC_ASSERT(kSmiTag == 0); | 3412 STATIC_ASSERT(kSmiTag == 0); |
3413 STATIC_ASSERT(kSmiTagSize == 1); | 3413 STATIC_ASSERT(kSmiTagSize == 1); |
3414 // Allocate RegExpResult followed by FixedArray with size in rbx. | 3414 // Allocate RegExpResult followed by FixedArray with size in rbx. |
3415 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] | 3415 // JSArray: [Map][empty properties][Elements][Length-smi][index][input] |
3416 // Elements: [Map][Length][..elements..] | 3416 // Elements: [Map][Length][..elements..] |
3417 __ AllocateInNewSpace(JSRegExpResult::kSize + FixedArray::kHeaderSize, | 3417 __ Allocate(JSRegExpResult::kSize + FixedArray::kHeaderSize, |
3418 times_pointer_size, | 3418 times_pointer_size, |
3419 rbx, // In: Number of elements. | 3419 rbx, // In: Number of elements. |
3420 rax, // Out: Start of allocation (tagged). | 3420 rax, // Out: Start of allocation (tagged). |
3421 rcx, // Out: End of allocation. | 3421 rcx, // Out: End of allocation. |
3422 rdx, // Scratch register | 3422 rdx, // Scratch register |
3423 &slowcase, | 3423 &slowcase, |
3424 TAG_OBJECT); | 3424 TAG_OBJECT); |
3425 // rax: Start of allocated area, object-tagged. | 3425 // rax: Start of allocated area, object-tagged. |
3426 // rbx: Number of array elements as int32. | 3426 // rbx: Number of array elements as int32. |
3427 // r8: Number of array elements as smi. | 3427 // r8: Number of array elements as smi. |
3428 | 3428 |
3429 // Set JSArray map to global.regexp_result_map(). | 3429 // Set JSArray map to global.regexp_result_map(). |
3430 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); | 3430 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); |
3431 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); | 3431 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); |
3432 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); | 3432 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); |
3433 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx); | 3433 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx); |
3434 | 3434 |
(...skipping 3447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6882 #endif | 6882 #endif |
6883 | 6883 |
6884 __ Ret(); | 6884 __ Ret(); |
6885 } | 6885 } |
6886 | 6886 |
6887 #undef __ | 6887 #undef __ |
6888 | 6888 |
6889 } } // namespace v8::internal | 6889 } } // namespace v8::internal |
6890 | 6890 |
6891 #endif // V8_TARGET_ARCH_X64 | 6891 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |