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

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

Issue 1412963002: [runtime] Implement %_ToLength via ToLengthStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 __ Ret(); 3115 __ Ret();
3116 __ bind(&not_oddball); 3116 __ bind(&not_oddball);
3117 3117
3118 __ PopReturnAddressTo(rcx); // Pop return address. 3118 __ PopReturnAddressTo(rcx); // Pop return address.
3119 __ Push(rax); // Push argument. 3119 __ Push(rax); // Push argument.
3120 __ PushReturnAddressFrom(rcx); // Push return address. 3120 __ PushReturnAddressFrom(rcx); // Push return address.
3121 __ TailCallRuntime(Runtime::kToNumber, 1, 1); 3121 __ TailCallRuntime(Runtime::kToNumber, 1, 1);
3122 } 3122 }
3123 3123
3124 3124
3125 void ToLengthStub::Generate(MacroAssembler* masm) {
3126 // The ToLength stub takes on argument in rax.
3127 Label not_smi, positive_smi;
3128 __ JumpIfNotSmi(rax, &not_smi, Label::kNear);
3129 STATIC_ASSERT(kSmiTag == 0);
3130 __ testp(rax, rax);
3131 __ j(greater_equal, &positive_smi, Label::kNear);
3132 __ xorl(rax, rax);
3133 __ bind(&positive_smi);
3134 __ Ret();
3135 __ bind(&not_smi);
3136
3137 __ PopReturnAddressTo(rcx); // Pop return address.
3138 __ Push(rax); // Push argument.
3139 __ PushReturnAddressFrom(rcx); // Push return address.
3140 __ TailCallRuntime(Runtime::kToLength, 1, 1);
3141 }
3142
3143
3125 void ToStringStub::Generate(MacroAssembler* masm) { 3144 void ToStringStub::Generate(MacroAssembler* masm) {
3126 // The ToString stub takes one argument in rax. 3145 // The ToString stub takes one argument in rax.
3127 Label is_number; 3146 Label is_number;
3128 __ JumpIfSmi(rax, &is_number, Label::kNear); 3147 __ JumpIfSmi(rax, &is_number, Label::kNear);
3129 3148
3130 Label not_string; 3149 Label not_string;
3131 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); 3150 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi);
3132 // rax: receiver 3151 // rax: receiver
3133 // rdi: receiver map 3152 // rdi: receiver map
3134 __ j(above_equal, &not_string, Label::kNear); 3153 __ j(above_equal, &not_string, Label::kNear);
(...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after
5576 kStackSpace, nullptr, return_value_operand, NULL); 5595 kStackSpace, nullptr, return_value_operand, NULL);
5577 } 5596 }
5578 5597
5579 5598
5580 #undef __ 5599 #undef __
5581 5600
5582 } // namespace internal 5601 } // namespace internal
5583 } // namespace v8 5602 } // namespace v8
5584 5603
5585 #endif // V8_TARGET_ARCH_X64 5604 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698