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 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 // ebx: instance type | 2121 // ebx: instance type |
2122 // ecx: sub string length (smi) | 2122 // ecx: sub string length (smi) |
2123 // edx: from index (smi) | 2123 // edx: from index (smi) |
2124 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, | 2124 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, |
2125 &runtime, RECEIVER_IS_STRING); | 2125 &runtime, RECEIVER_IS_STRING); |
2126 generator.GenerateFast(masm); | 2126 generator.GenerateFast(masm); |
2127 __ ret(3 * kPointerSize); | 2127 __ ret(3 * kPointerSize); |
2128 generator.SkipSlow(masm, &runtime); | 2128 generator.SkipSlow(masm, &runtime); |
2129 } | 2129 } |
2130 | 2130 |
2131 void ToStringStub::Generate(MacroAssembler* masm) { | |
2132 // The ToString stub takes one argument in eax. | |
2133 Label is_number; | |
2134 __ JumpIfSmi(eax, &is_number, Label::kNear); | |
2135 | |
2136 Label not_string; | |
2137 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
2138 // eax: receiver | |
2139 // edi: receiver map | |
2140 __ j(above_equal, ¬_string, Label::kNear); | |
2141 __ Ret(); | |
2142 __ bind(¬_string); | |
2143 | |
2144 Label not_heap_number; | |
2145 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | |
2146 __ j(not_equal, ¬_heap_number, Label::kNear); | |
2147 __ bind(&is_number); | |
2148 NumberToStringStub stub(isolate()); | |
2149 __ TailCallStub(&stub); | |
2150 __ bind(¬_heap_number); | |
2151 | |
2152 Label not_oddball; | |
2153 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
2154 __ j(not_equal, ¬_oddball, Label::kNear); | |
2155 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); | |
2156 __ Ret(); | |
2157 __ bind(¬_oddball); | |
2158 | |
2159 __ pop(ecx); // Pop return address. | |
2160 __ push(eax); // Push argument. | |
2161 __ push(ecx); // Push return address. | |
2162 __ TailCallRuntime(Runtime::kToString); | |
2163 } | |
2164 | |
2165 | 2131 |
2166 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2132 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2167 Register left, | 2133 Register left, |
2168 Register right, | 2134 Register right, |
2169 Register scratch1, | 2135 Register scratch1, |
2170 Register scratch2) { | 2136 Register scratch2) { |
2171 Register length = scratch1; | 2137 Register length = scratch1; |
2172 | 2138 |
2173 // Compare lengths. | 2139 // Compare lengths. |
2174 Label strings_not_equal, check_zero_length; | 2140 Label strings_not_equal, check_zero_length; |
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5261 kStackUnwindSpace, nullptr, return_value_operand, | 5227 kStackUnwindSpace, nullptr, return_value_operand, |
5262 NULL); | 5228 NULL); |
5263 } | 5229 } |
5264 | 5230 |
5265 #undef __ | 5231 #undef __ |
5266 | 5232 |
5267 } // namespace internal | 5233 } // namespace internal |
5268 } // namespace v8 | 5234 } // namespace v8 |
5269 | 5235 |
5270 #endif // V8_TARGET_ARCH_X87 | 5236 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |