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