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 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2376 __ IndexFromHash(eax, eax); | 2376 __ IndexFromHash(eax, eax); |
2377 __ Ret(); | 2377 __ Ret(); |
2378 | 2378 |
2379 __ bind(&runtime); | 2379 __ bind(&runtime); |
2380 __ PopReturnAddressTo(ecx); // Pop return address. | 2380 __ PopReturnAddressTo(ecx); // Pop return address. |
2381 __ Push(eax); // Push argument. | 2381 __ Push(eax); // Push argument. |
2382 __ PushReturnAddressFrom(ecx); // Push return address. | 2382 __ PushReturnAddressFrom(ecx); // Push return address. |
2383 __ TailCallRuntime(Runtime::kStringToNumber); | 2383 __ TailCallRuntime(Runtime::kStringToNumber); |
2384 } | 2384 } |
2385 | 2385 |
2386 void ToLengthStub::Generate(MacroAssembler* masm) { | |
2387 // The ToLength stub takes on argument in eax. | |
2388 Label not_smi, positive_smi; | |
2389 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | |
2390 STATIC_ASSERT(kSmiTag == 0); | |
2391 __ test(eax, eax); | |
2392 __ j(greater_equal, &positive_smi, Label::kNear); | |
2393 __ xor_(eax, eax); | |
2394 __ bind(&positive_smi); | |
2395 __ Ret(); | |
2396 __ bind(¬_smi); | |
2397 | |
2398 __ pop(ecx); // Pop return address. | |
2399 __ push(eax); // Push argument. | |
2400 __ push(ecx); // Push return address. | |
2401 __ TailCallRuntime(Runtime::kToLength); | |
2402 } | |
2403 | |
2404 | |
2405 void ToStringStub::Generate(MacroAssembler* masm) { | 2386 void ToStringStub::Generate(MacroAssembler* masm) { |
2406 // The ToString stub takes one argument in eax. | 2387 // The ToString stub takes one argument in eax. |
2407 Label is_number; | 2388 Label is_number; |
2408 __ JumpIfSmi(eax, &is_number, Label::kNear); | 2389 __ JumpIfSmi(eax, &is_number, Label::kNear); |
2409 | 2390 |
2410 Label not_string; | 2391 Label not_string; |
2411 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); | 2392 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edi); |
2412 // eax: receiver | 2393 // eax: receiver |
2413 // edi: receiver map | 2394 // edi: receiver map |
2414 __ j(above_equal, ¬_string, Label::kNear); | 2395 __ j(above_equal, ¬_string, Label::kNear); |
(...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5526 return_value_operand, NULL); | 5507 return_value_operand, NULL); |
5527 } | 5508 } |
5528 | 5509 |
5529 | 5510 |
5530 #undef __ | 5511 #undef __ |
5531 | 5512 |
5532 } // namespace internal | 5513 } // namespace internal |
5533 } // namespace v8 | 5514 } // namespace v8 |
5534 | 5515 |
5535 #endif // V8_TARGET_ARCH_X87 | 5516 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |