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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 __ mov_b(scratch, Operand(src, 0)); | 1900 __ mov_b(scratch, Operand(src, 0)); |
1901 __ mov_b(Operand(dest, 0), scratch); | 1901 __ mov_b(Operand(dest, 0), scratch); |
1902 __ inc(src); | 1902 __ inc(src); |
1903 __ inc(dest); | 1903 __ inc(dest); |
1904 __ dec(count); | 1904 __ dec(count); |
1905 __ j(not_zero, &loop); | 1905 __ j(not_zero, &loop); |
1906 | 1906 |
1907 __ bind(&done); | 1907 __ bind(&done); |
1908 } | 1908 } |
1909 | 1909 |
1910 void ToStringStub::Generate(MacroAssembler* masm) { | |
1911 // The ToString stub takes one argument in eax. | |
1912 Label is_number; | |
1913 __ JumpIfSmi(eax, &is_number, Label::kNear); | |
1914 | |
1915 Label not_string; | |
1916 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
1917 // eax: receiver | |
1918 // edi: receiver map | |
1919 __ j(above_equal, ¬_string, Label::kNear); | |
1920 __ Ret(); | |
1921 __ bind(¬_string); | |
1922 | |
1923 Label not_heap_number; | |
1924 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | |
1925 __ j(not_equal, ¬_heap_number, Label::kNear); | |
1926 __ bind(&is_number); | |
1927 NumberToStringStub stub(isolate()); | |
1928 __ TailCallStub(&stub); | |
1929 __ bind(¬_heap_number); | |
1930 | |
1931 Label not_oddball; | |
1932 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
1933 __ j(not_equal, ¬_oddball, Label::kNear); | |
1934 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); | |
1935 __ Ret(); | |
1936 __ bind(¬_oddball); | |
1937 | |
1938 __ pop(ecx); // Pop return address. | |
1939 __ push(eax); // Push argument. | |
1940 __ push(ecx); // Push return address. | |
1941 __ TailCallRuntime(Runtime::kToString); | |
1942 } | |
1943 | |
1944 | 1910 |
1945 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 1911 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
1946 Register left, | 1912 Register left, |
1947 Register right, | 1913 Register right, |
1948 Register scratch1, | 1914 Register scratch1, |
1949 Register scratch2) { | 1915 Register scratch2) { |
1950 Register length = scratch1; | 1916 Register length = scratch1; |
1951 | 1917 |
1952 // Compare lengths. | 1918 // Compare lengths. |
1953 Label strings_not_equal, check_zero_length; | 1919 Label strings_not_equal, check_zero_length; |
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5040 kStackUnwindSpace, nullptr, return_value_operand, | 5006 kStackUnwindSpace, nullptr, return_value_operand, |
5041 NULL); | 5007 NULL); |
5042 } | 5008 } |
5043 | 5009 |
5044 #undef __ | 5010 #undef __ |
5045 | 5011 |
5046 } // namespace internal | 5012 } // namespace internal |
5047 } // namespace v8 | 5013 } // namespace v8 |
5048 | 5014 |
5049 #endif // V8_TARGET_ARCH_X87 | 5015 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |