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/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 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 __ Ret(); | 3221 __ Ret(); |
3222 __ bind(¬_oddball); | 3222 __ bind(¬_oddball); |
3223 | 3223 |
3224 __ PopReturnAddressTo(rcx); // Pop return address. | 3224 __ PopReturnAddressTo(rcx); // Pop return address. |
3225 __ Push(rax); // Push argument. | 3225 __ Push(rax); // Push argument. |
3226 __ PushReturnAddressFrom(rcx); // Push return address. | 3226 __ PushReturnAddressFrom(rcx); // Push return address. |
3227 __ TailCallRuntime(Runtime::kToNumber, 1, 1); | 3227 __ TailCallRuntime(Runtime::kToNumber, 1, 1); |
3228 } | 3228 } |
3229 | 3229 |
3230 | 3230 |
| 3231 void ToStringStub::Generate(MacroAssembler* masm) { |
| 3232 // The ToString stub takes one argument in rax. |
| 3233 Label is_number; |
| 3234 __ JumpIfSmi(rax, &is_number, Label::kNear); |
| 3235 |
| 3236 Label not_string; |
| 3237 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); |
| 3238 // rax: receiver |
| 3239 // rdi: receiver map |
| 3240 __ j(above_equal, ¬_string, Label::kNear); |
| 3241 __ Ret(); |
| 3242 __ bind(¬_string); |
| 3243 |
| 3244 Label not_heap_number; |
| 3245 __ CompareRoot(rax, Heap::kHeapNumberMapRootIndex); |
| 3246 __ j(not_equal, ¬_heap_number, Label::kNear); |
| 3247 __ bind(&is_number); |
| 3248 NumberToStringStub stub(isolate()); |
| 3249 __ TailCallStub(&stub); |
| 3250 __ bind(¬_heap_number); |
| 3251 |
| 3252 Label not_oddball; |
| 3253 __ CmpInstanceType(rdi, ODDBALL_TYPE); |
| 3254 __ j(not_equal, ¬_oddball, Label::kNear); |
| 3255 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); |
| 3256 __ Ret(); |
| 3257 __ bind(¬_oddball); |
| 3258 |
| 3259 __ PopReturnAddressTo(rcx); // Pop return address. |
| 3260 __ Push(rax); // Push argument. |
| 3261 __ PushReturnAddressFrom(rcx); // Push return address. |
| 3262 __ TailCallRuntime(Runtime::kToString, 1, 1); |
| 3263 } |
| 3264 |
| 3265 |
3231 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 3266 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
3232 Register left, | 3267 Register left, |
3233 Register right, | 3268 Register right, |
3234 Register scratch1, | 3269 Register scratch1, |
3235 Register scratch2) { | 3270 Register scratch2) { |
3236 Register length = scratch1; | 3271 Register length = scratch1; |
3237 | 3272 |
3238 // Compare lengths. | 3273 // Compare lengths. |
3239 Label check_zero_length; | 3274 Label check_zero_length; |
3240 __ movp(length, FieldOperand(left, String::kLengthOffset)); | 3275 __ movp(length, FieldOperand(left, String::kLengthOffset)); |
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5477 kStackSpace, nullptr, return_value_operand, NULL); | 5512 kStackSpace, nullptr, return_value_operand, NULL); |
5478 } | 5513 } |
5479 | 5514 |
5480 | 5515 |
5481 #undef __ | 5516 #undef __ |
5482 | 5517 |
5483 } // namespace internal | 5518 } // namespace internal |
5484 } // namespace v8 | 5519 } // namespace v8 |
5485 | 5520 |
5486 #endif // V8_TARGET_ARCH_X64 | 5521 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |