Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 2050853003: [stubs] StringToNumberStub --> StringToNumber builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 __ TailCallStub(&stub); 2584 __ TailCallStub(&stub);
2585 } 2585 }
2586 2586
2587 void NonNumberToNumberStub::Generate(MacroAssembler* masm) { 2587 void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
2588 // The NonNumberToNumber stub takes one argument in r3. 2588 // The NonNumberToNumber stub takes one argument in r3.
2589 __ AssertNotNumber(r3); 2589 __ AssertNotNumber(r3);
2590 2590
2591 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); 2591 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE);
2592 // r3: receiver 2592 // r3: receiver
2593 // r4: receiver instance type 2593 // r4: receiver instance type
2594 StringToNumberStub stub(masm->isolate()); 2594 __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET, lt);
2595 __ TailCallStub(&stub, lt);
2596 2595
2597 Label not_oddball; 2596 Label not_oddball;
2598 __ cmpi(r4, Operand(ODDBALL_TYPE)); 2597 __ cmpi(r4, Operand(ODDBALL_TYPE));
2599 __ bne(&not_oddball); 2598 __ bne(&not_oddball);
2600 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); 2599 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset));
2601 __ blr(); 2600 __ blr();
2602 __ bind(&not_oddball); 2601 __ bind(&not_oddball);
2603 2602
2604 __ push(r3); // Push argument. 2603 __ push(r3); // Push argument.
2605 __ TailCallRuntime(Runtime::kToNumber); 2604 __ TailCallRuntime(Runtime::kToNumber);
2606 } 2605 }
2607 2606
2608 void StringToNumberStub::Generate(MacroAssembler* masm) {
2609 // The StringToNumber stub takes one argument in r3.
2610 __ AssertString(r3);
2611
2612 // Check if string has a cached array index.
2613 Label runtime;
2614 __ lwz(r5, FieldMemOperand(r3, String::kHashFieldOffset));
2615 __ And(r0, r5, Operand(String::kContainsCachedArrayIndexMask), SetRC);
2616 __ bne(&runtime, cr0);
2617 __ IndexFromHash(r5, r3);
2618 __ blr();
2619
2620 __ bind(&runtime);
2621 __ push(r3); // Push argument.
2622 __ TailCallRuntime(Runtime::kStringToNumber);
2623 }
2624
2625 void ToStringStub::Generate(MacroAssembler* masm) { 2607 void ToStringStub::Generate(MacroAssembler* masm) {
2626 // The ToString stub takes one argument in r3. 2608 // The ToString stub takes one argument in r3.
2627 Label is_number; 2609 Label is_number;
2628 __ JumpIfSmi(r3, &is_number); 2610 __ JumpIfSmi(r3, &is_number);
2629 2611
2630 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE); 2612 __ CompareObjectType(r3, r4, r4, FIRST_NONSTRING_TYPE);
2631 // r3: receiver 2613 // r3: receiver
2632 // r4: receiver instance type 2614 // r4: receiver instance type
2633 __ Ret(lt); 2615 __ Ret(lt);
2634 2616
(...skipping 3057 matching lines...) Expand 10 before | Expand all | Expand 10 after
5692 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5674 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5693 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5675 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5694 kStackUnwindSpace, NULL, return_value_operand, NULL); 5676 kStackUnwindSpace, NULL, return_value_operand, NULL);
5695 } 5677 }
5696 5678
5697 #undef __ 5679 #undef __
5698 } // namespace internal 5680 } // namespace internal
5699 } // namespace v8 5681 } // namespace v8
5700 5682
5701 #endif // V8_TARGET_ARCH_PPC 5683 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698