| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 __ CallRuntime(Runtime::kStringCharFromCode); | 2012 __ CallRuntime(Runtime::kStringCharFromCode); |
| 2013 if (!result_.is(eax)) { | 2013 if (!result_.is(eax)) { |
| 2014 __ mov(result_, eax); | 2014 __ mov(result_, eax); |
| 2015 } | 2015 } |
| 2016 call_helper.AfterCall(masm); | 2016 call_helper.AfterCall(masm); |
| 2017 __ jmp(&exit_); | 2017 __ jmp(&exit_); |
| 2018 | 2018 |
| 2019 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 2019 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 | |
| 2023 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | |
| 2024 Register dest, | |
| 2025 Register src, | |
| 2026 Register count, | |
| 2027 Register scratch, | |
| 2028 String::Encoding encoding) { | |
| 2029 DCHECK(!scratch.is(dest)); | |
| 2030 DCHECK(!scratch.is(src)); | |
| 2031 DCHECK(!scratch.is(count)); | |
| 2032 | |
| 2033 // Nothing to do for zero characters. | |
| 2034 Label done; | |
| 2035 __ test(count, count); | |
| 2036 __ j(zero, &done); | |
| 2037 | |
| 2038 // Make count the number of bytes to copy. | |
| 2039 if (encoding == String::TWO_BYTE_ENCODING) { | |
| 2040 __ shl(count, 1); | |
| 2041 } | |
| 2042 | |
| 2043 Label loop; | |
| 2044 __ bind(&loop); | |
| 2045 __ mov_b(scratch, Operand(src, 0)); | |
| 2046 __ mov_b(Operand(dest, 0), scratch); | |
| 2047 __ inc(src); | |
| 2048 __ inc(dest); | |
| 2049 __ dec(count); | |
| 2050 __ j(not_zero, &loop); | |
| 2051 | |
| 2052 __ bind(&done); | |
| 2053 } | |
| 2054 | |
| 2055 | |
| 2056 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2022 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
| 2057 Register left, | 2023 Register left, |
| 2058 Register right, | 2024 Register right, |
| 2059 Register scratch1, | 2025 Register scratch1, |
| 2060 Register scratch2) { | 2026 Register scratch2) { |
| 2061 Register length = scratch1; | 2027 Register length = scratch1; |
| 2062 | 2028 |
| 2063 // Compare lengths. | 2029 // Compare lengths. |
| 2064 Label strings_not_equal, check_zero_length; | 2030 Label strings_not_equal, check_zero_length; |
| 2065 __ mov(length, FieldOperand(left, String::kLengthOffset)); | 2031 __ mov(length, FieldOperand(left, String::kLengthOffset)); |
| (...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4418 kStackUnwindSpace, nullptr, return_value_operand, | 4384 kStackUnwindSpace, nullptr, return_value_operand, |
| 4419 NULL); | 4385 NULL); |
| 4420 } | 4386 } |
| 4421 | 4387 |
| 4422 #undef __ | 4388 #undef __ |
| 4423 | 4389 |
| 4424 } // namespace internal | 4390 } // namespace internal |
| 4425 } // namespace v8 | 4391 } // namespace v8 |
| 4426 | 4392 |
| 4427 #endif // V8_TARGET_ARCH_IA32 | 4393 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |