| 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 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 // ebx: instance type | 2279 // ebx: instance type |
| 2280 // ecx: sub string length (smi) | 2280 // ecx: sub string length (smi) |
| 2281 // edx: from index (smi) | 2281 // edx: from index (smi) |
| 2282 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, | 2282 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, |
| 2283 &runtime, RECEIVER_IS_STRING); | 2283 &runtime, RECEIVER_IS_STRING); |
| 2284 generator.GenerateFast(masm); | 2284 generator.GenerateFast(masm); |
| 2285 __ ret(3 * kPointerSize); | 2285 __ ret(3 * kPointerSize); |
| 2286 generator.SkipSlow(masm, &runtime); | 2286 generator.SkipSlow(masm, &runtime); |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 void ToStringStub::Generate(MacroAssembler* masm) { | |
| 2290 // The ToString stub takes one argument in eax. | |
| 2291 Label is_number; | |
| 2292 __ JumpIfSmi(eax, &is_number, Label::kNear); | |
| 2293 | |
| 2294 Label not_string; | |
| 2295 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | |
| 2296 // eax: receiver | |
| 2297 // edi: receiver map | |
| 2298 __ j(above_equal, ¬_string, Label::kNear); | |
| 2299 __ Ret(); | |
| 2300 __ bind(¬_string); | |
| 2301 | |
| 2302 Label not_heap_number; | |
| 2303 __ CompareMap(eax, masm->isolate()->factory()->heap_number_map()); | |
| 2304 __ j(not_equal, ¬_heap_number, Label::kNear); | |
| 2305 __ bind(&is_number); | |
| 2306 NumberToStringStub stub(isolate()); | |
| 2307 __ TailCallStub(&stub); | |
| 2308 __ bind(¬_heap_number); | |
| 2309 | |
| 2310 Label not_oddball; | |
| 2311 __ CmpInstanceType(edi, ODDBALL_TYPE); | |
| 2312 __ j(not_equal, ¬_oddball, Label::kNear); | |
| 2313 __ mov(eax, FieldOperand(eax, Oddball::kToStringOffset)); | |
| 2314 __ Ret(); | |
| 2315 __ bind(¬_oddball); | |
| 2316 | |
| 2317 __ pop(ecx); // Pop return address. | |
| 2318 __ push(eax); // Push argument. | |
| 2319 __ push(ecx); // Push return address. | |
| 2320 __ TailCallRuntime(Runtime::kToString); | |
| 2321 } | |
| 2322 | |
| 2323 | 2289 |
| 2324 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2290 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
| 2325 Register left, | 2291 Register left, |
| 2326 Register right, | 2292 Register right, |
| 2327 Register scratch1, | 2293 Register scratch1, |
| 2328 Register scratch2) { | 2294 Register scratch2) { |
| 2329 Register length = scratch1; | 2295 Register length = scratch1; |
| 2330 | 2296 |
| 2331 // Compare lengths. | 2297 // Compare lengths. |
| 2332 Label strings_not_equal, check_zero_length; | 2298 Label strings_not_equal, check_zero_length; |
| (...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5470 kStackUnwindSpace, nullptr, return_value_operand, | 5436 kStackUnwindSpace, nullptr, return_value_operand, |
| 5471 NULL); | 5437 NULL); |
| 5472 } | 5438 } |
| 5473 | 5439 |
| 5474 #undef __ | 5440 #undef __ |
| 5475 | 5441 |
| 5476 } // namespace internal | 5442 } // namespace internal |
| 5477 } // namespace v8 | 5443 } // namespace v8 |
| 5478 | 5444 |
| 5479 #endif // V8_TARGET_ARCH_IA32 | 5445 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |