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 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4219 __ j(less, ©_routine); | 4219 __ j(less, ©_routine); |
4220 // Allocate new sliced string. At this point we do not reload the instance | 4220 // Allocate new sliced string. At this point we do not reload the instance |
4221 // type including the string encoding because we simply rely on the info | 4221 // type including the string encoding because we simply rely on the info |
4222 // provided by the original string. It does not matter if the original | 4222 // provided by the original string. It does not matter if the original |
4223 // string's encoding is wrong because we always have to recheck encoding of | 4223 // string's encoding is wrong because we always have to recheck encoding of |
4224 // the newly created string's parent anyways due to externalized strings. | 4224 // the newly created string's parent anyways due to externalized strings. |
4225 Label two_byte_slice, set_slice_header; | 4225 Label two_byte_slice, set_slice_header; |
4226 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); | 4226 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); |
4227 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 4227 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
4228 __ testb(rbx, Immediate(kStringEncodingMask)); | 4228 __ testb(rbx, Immediate(kStringEncodingMask)); |
4229 __ j(zero, &two_byte_slice, Label::kNear); | 4229 // Make long jumps when allocations tracking is on due to |
| 4230 // RecordObjectAllocation inside MacroAssembler::Allocate. |
| 4231 Label::Distance jump_distance = |
| 4232 masm->isolate()->heap_profiler()->is_tracking_allocations() |
| 4233 ? Label::kFar |
| 4234 : Label::kNear; |
| 4235 __ j(zero, &two_byte_slice, jump_distance); |
4230 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); | 4236 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); |
4231 __ jmp(&set_slice_header, Label::kNear); | 4237 __ jmp(&set_slice_header, jump_distance); |
4232 __ bind(&two_byte_slice); | 4238 __ bind(&two_byte_slice); |
4233 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); | 4239 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); |
4234 __ bind(&set_slice_header); | 4240 __ bind(&set_slice_header); |
4235 __ Integer32ToSmi(rcx, rcx); | 4241 __ Integer32ToSmi(rcx, rcx); |
4236 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); | 4242 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); |
4237 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), | 4243 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), |
4238 Immediate(String::kEmptyHashField)); | 4244 Immediate(String::kEmptyHashField)); |
4239 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); | 4245 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); |
4240 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); | 4246 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); |
4241 __ IncrementCounter(counters->sub_string_native(), 1); | 4247 __ IncrementCounter(counters->sub_string_native(), 1); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5831 __ bind(&fast_elements_case); | 5837 __ bind(&fast_elements_case); |
5832 GenerateCase(masm, FAST_ELEMENTS); | 5838 GenerateCase(masm, FAST_ELEMENTS); |
5833 } | 5839 } |
5834 | 5840 |
5835 | 5841 |
5836 #undef __ | 5842 #undef __ |
5837 | 5843 |
5838 } } // namespace v8::internal | 5844 } } // namespace v8::internal |
5839 | 5845 |
5840 #endif // V8_TARGET_ARCH_X64 | 5846 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |