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 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 __ movb(kScratchRegister, Operand(src, 0)); | 2004 __ movb(kScratchRegister, Operand(src, 0)); |
2005 __ movb(Operand(dest, 0), kScratchRegister); | 2005 __ movb(Operand(dest, 0), kScratchRegister); |
2006 __ incp(src); | 2006 __ incp(src); |
2007 __ incp(dest); | 2007 __ incp(dest); |
2008 __ decl(count); | 2008 __ decl(count); |
2009 __ j(not_zero, &loop); | 2009 __ j(not_zero, &loop); |
2010 | 2010 |
2011 __ bind(&done); | 2011 __ bind(&done); |
2012 } | 2012 } |
2013 | 2013 |
2014 void ToStringStub::Generate(MacroAssembler* masm) { | |
2015 // The ToString stub takes one argument in rax. | |
2016 Label is_number; | |
2017 __ JumpIfSmi(rax, &is_number, Label::kNear); | |
2018 | |
2019 Label not_string; | |
2020 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); | |
2021 // rax: receiver | |
2022 // rdi: receiver map | |
2023 __ j(above_equal, ¬_string, Label::kNear); | |
2024 __ Ret(); | |
2025 __ bind(¬_string); | |
2026 | |
2027 Label not_heap_number; | |
2028 __ CompareRoot(rdi, Heap::kHeapNumberMapRootIndex); | |
2029 __ j(not_equal, ¬_heap_number, Label::kNear); | |
2030 __ bind(&is_number); | |
2031 NumberToStringStub stub(isolate()); | |
2032 __ TailCallStub(&stub); | |
2033 __ bind(¬_heap_number); | |
2034 | |
2035 Label not_oddball; | |
2036 __ CmpInstanceType(rdi, ODDBALL_TYPE); | |
2037 __ j(not_equal, ¬_oddball, Label::kNear); | |
2038 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); | |
2039 __ Ret(); | |
2040 __ bind(¬_oddball); | |
2041 | |
2042 __ PopReturnAddressTo(rcx); // Pop return address. | |
2043 __ Push(rax); // Push argument. | |
2044 __ PushReturnAddressFrom(rcx); // Push return address. | |
2045 __ TailCallRuntime(Runtime::kToString); | |
2046 } | |
2047 | |
2048 | 2014 |
2049 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2015 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2050 Register left, | 2016 Register left, |
2051 Register right, | 2017 Register right, |
2052 Register scratch1, | 2018 Register scratch1, |
2053 Register scratch2) { | 2019 Register scratch2) { |
2054 Register length = scratch1; | 2020 Register length = scratch1; |
2055 | 2021 |
2056 // Compare lengths. | 2022 // Compare lengths. |
2057 Label check_zero_length; | 2023 Label check_zero_length; |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4929 kStackUnwindSpace, nullptr, return_value_operand, | 4895 kStackUnwindSpace, nullptr, return_value_operand, |
4930 NULL); | 4896 NULL); |
4931 } | 4897 } |
4932 | 4898 |
4933 #undef __ | 4899 #undef __ |
4934 | 4900 |
4935 } // namespace internal | 4901 } // namespace internal |
4936 } // namespace v8 | 4902 } // namespace v8 |
4937 | 4903 |
4938 #endif // V8_TARGET_ARCH_X64 | 4904 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |