OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 __ CallRuntime(Runtime::kStringCharFromCode); | 1958 __ CallRuntime(Runtime::kStringCharFromCode); |
1959 if (!result_.is(rax)) { | 1959 if (!result_.is(rax)) { |
1960 __ movp(result_, rax); | 1960 __ movp(result_, rax); |
1961 } | 1961 } |
1962 call_helper.AfterCall(masm); | 1962 call_helper.AfterCall(masm); |
1963 __ jmp(&exit_); | 1963 __ jmp(&exit_); |
1964 | 1964 |
1965 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | 1965 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); |
1966 } | 1966 } |
1967 | 1967 |
1968 | |
1969 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, | |
1970 Register dest, | |
1971 Register src, | |
1972 Register count, | |
1973 String::Encoding encoding) { | |
1974 // Nothing to do for zero characters. | |
1975 Label done; | |
1976 __ testl(count, count); | |
1977 __ j(zero, &done, Label::kNear); | |
1978 | |
1979 // Make count the number of bytes to copy. | |
1980 if (encoding == String::TWO_BYTE_ENCODING) { | |
1981 STATIC_ASSERT(2 == sizeof(uc16)); | |
1982 __ addl(count, count); | |
1983 } | |
1984 | |
1985 // Copy remaining characters. | |
1986 Label loop; | |
1987 __ bind(&loop); | |
1988 __ movb(kScratchRegister, Operand(src, 0)); | |
1989 __ movb(Operand(dest, 0), kScratchRegister); | |
1990 __ incp(src); | |
1991 __ incp(dest); | |
1992 __ decl(count); | |
1993 __ j(not_zero, &loop); | |
1994 | |
1995 __ bind(&done); | |
1996 } | |
1997 | |
1998 | |
1999 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 1968 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2000 Register left, | 1969 Register left, |
2001 Register right, | 1970 Register right, |
2002 Register scratch1, | 1971 Register scratch1, |
2003 Register scratch2) { | 1972 Register scratch2) { |
2004 Register length = scratch1; | 1973 Register length = scratch1; |
2005 | 1974 |
2006 // Compare lengths. | 1975 // Compare lengths. |
2007 Label check_zero_length; | 1976 Label check_zero_length; |
2008 __ movp(length, FieldOperand(left, String::kLengthOffset)); | 1977 __ movp(length, FieldOperand(left, String::kLengthOffset)); |
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4334 kStackUnwindSpace, nullptr, return_value_operand, | 4303 kStackUnwindSpace, nullptr, return_value_operand, |
4335 NULL); | 4304 NULL); |
4336 } | 4305 } |
4337 | 4306 |
4338 #undef __ | 4307 #undef __ |
4339 | 4308 |
4340 } // namespace internal | 4309 } // namespace internal |
4341 } // namespace v8 | 4310 } // namespace v8 |
4342 | 4311 |
4343 #endif // V8_TARGET_ARCH_X64 | 4312 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |