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 4923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4934 __ j(less, ©_routine); | 4934 __ j(less, ©_routine); |
4935 // Allocate new sliced string. At this point we do not reload the instance | 4935 // Allocate new sliced string. At this point we do not reload the instance |
4936 // type including the string encoding because we simply rely on the info | 4936 // type including the string encoding because we simply rely on the info |
4937 // provided by the original string. It does not matter if the original | 4937 // provided by the original string. It does not matter if the original |
4938 // string's encoding is wrong because we always have to recheck encoding of | 4938 // string's encoding is wrong because we always have to recheck encoding of |
4939 // the newly created string's parent anyways due to externalized strings. | 4939 // the newly created string's parent anyways due to externalized strings. |
4940 Label two_byte_slice, set_slice_header; | 4940 Label two_byte_slice, set_slice_header; |
4941 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); | 4941 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); |
4942 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 4942 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
4943 __ testb(rbx, Immediate(kStringEncodingMask)); | 4943 __ testb(rbx, Immediate(kStringEncodingMask)); |
4944 __ j(zero, &two_byte_slice, Label::kNear); | 4944 // Make long jumps when allocations tracking is on due to |
| 4945 // RecordObjectAllocation inside MacroAssembler::Allocate. |
| 4946 Label::Distance jump_distance = |
| 4947 masm->isolate()->heap_profiler()->is_tracking_allocations() |
| 4948 ? Label::kFar |
| 4949 : Label::kNear; |
| 4950 __ j(zero, &two_byte_slice, jump_distance); |
4945 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); | 4951 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); |
4946 __ jmp(&set_slice_header, Label::kNear); | 4952 __ jmp(&set_slice_header, jump_distance); |
4947 __ bind(&two_byte_slice); | 4953 __ bind(&two_byte_slice); |
4948 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); | 4954 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); |
4949 __ bind(&set_slice_header); | 4955 __ bind(&set_slice_header); |
4950 __ Integer32ToSmi(rcx, rcx); | 4956 __ Integer32ToSmi(rcx, rcx); |
4951 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); | 4957 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); |
4952 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), | 4958 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), |
4953 Immediate(String::kEmptyHashField)); | 4959 Immediate(String::kEmptyHashField)); |
4954 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); | 4960 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); |
4955 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); | 4961 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); |
4956 __ IncrementCounter(counters->sub_string_native(), 1); | 4962 __ IncrementCounter(counters->sub_string_native(), 1); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6546 __ bind(&fast_elements_case); | 6552 __ bind(&fast_elements_case); |
6547 GenerateCase(masm, FAST_ELEMENTS); | 6553 GenerateCase(masm, FAST_ELEMENTS); |
6548 } | 6554 } |
6549 | 6555 |
6550 | 6556 |
6551 #undef __ | 6557 #undef __ |
6552 | 6558 |
6553 } } // namespace v8::internal | 6559 } } // namespace v8::internal |
6554 | 6560 |
6555 #endif // V8_TARGET_ARCH_X64 | 6561 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |