| 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 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 __ IndexFromHash(rax, rax); | 2592 __ IndexFromHash(rax, rax); |
| 2593 __ Ret(); | 2593 __ Ret(); |
| 2594 | 2594 |
| 2595 __ bind(&runtime); | 2595 __ bind(&runtime); |
| 2596 __ PopReturnAddressTo(rcx); // Pop return address. | 2596 __ PopReturnAddressTo(rcx); // Pop return address. |
| 2597 __ Push(rax); // Push argument. | 2597 __ Push(rax); // Push argument. |
| 2598 __ PushReturnAddressFrom(rcx); // Push return address. | 2598 __ PushReturnAddressFrom(rcx); // Push return address. |
| 2599 __ TailCallRuntime(Runtime::kStringToNumber); | 2599 __ TailCallRuntime(Runtime::kStringToNumber); |
| 2600 } | 2600 } |
| 2601 | 2601 |
| 2602 void ToLengthStub::Generate(MacroAssembler* masm) { | |
| 2603 // The ToLength stub takes on argument in rax. | |
| 2604 Label not_smi, positive_smi; | |
| 2605 __ JumpIfNotSmi(rax, ¬_smi, Label::kNear); | |
| 2606 STATIC_ASSERT(kSmiTag == 0); | |
| 2607 __ testp(rax, rax); | |
| 2608 __ j(greater_equal, &positive_smi, Label::kNear); | |
| 2609 __ xorl(rax, rax); | |
| 2610 __ bind(&positive_smi); | |
| 2611 __ Ret(); | |
| 2612 __ bind(¬_smi); | |
| 2613 | |
| 2614 __ PopReturnAddressTo(rcx); // Pop return address. | |
| 2615 __ Push(rax); // Push argument. | |
| 2616 __ PushReturnAddressFrom(rcx); // Push return address. | |
| 2617 __ TailCallRuntime(Runtime::kToLength); | |
| 2618 } | |
| 2619 | |
| 2620 | |
| 2621 void ToStringStub::Generate(MacroAssembler* masm) { | 2602 void ToStringStub::Generate(MacroAssembler* masm) { |
| 2622 // The ToString stub takes one argument in rax. | 2603 // The ToString stub takes one argument in rax. |
| 2623 Label is_number; | 2604 Label is_number; |
| 2624 __ JumpIfSmi(rax, &is_number, Label::kNear); | 2605 __ JumpIfSmi(rax, &is_number, Label::kNear); |
| 2625 | 2606 |
| 2626 Label not_string; | 2607 Label not_string; |
| 2627 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); | 2608 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); |
| 2628 // rax: receiver | 2609 // rax: receiver |
| 2629 // rdi: receiver map | 2610 // rdi: receiver map |
| 2630 __ j(above_equal, ¬_string, Label::kNear); | 2611 __ j(above_equal, ¬_string, Label::kNear); |
| (...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5583 NULL); | 5564 NULL); |
| 5584 } | 5565 } |
| 5585 | 5566 |
| 5586 | 5567 |
| 5587 #undef __ | 5568 #undef __ |
| 5588 | 5569 |
| 5589 } // namespace internal | 5570 } // namespace internal |
| 5590 } // namespace v8 | 5571 } // namespace v8 |
| 5591 | 5572 |
| 5592 #endif // V8_TARGET_ARCH_X64 | 5573 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |