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 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); | 2267 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); |
2268 __ Ret(); | 2268 __ Ret(); |
2269 __ bind(¬_oddball); | 2269 __ bind(¬_oddball); |
2270 | 2270 |
2271 __ PopReturnAddressTo(rcx); // Pop return address. | 2271 __ PopReturnAddressTo(rcx); // Pop return address. |
2272 __ Push(rax); // Push argument. | 2272 __ Push(rax); // Push argument. |
2273 __ PushReturnAddressFrom(rcx); // Push return address. | 2273 __ PushReturnAddressFrom(rcx); // Push return address. |
2274 __ TailCallRuntime(Runtime::kToString); | 2274 __ TailCallRuntime(Runtime::kToString); |
2275 } | 2275 } |
2276 | 2276 |
2277 void ToNameStub::Generate(MacroAssembler* masm) { | |
2278 // The ToName stub takes one argument in rax. | |
2279 Label is_number; | |
2280 __ JumpIfSmi(rax, &is_number, Label::kNear); | |
2281 | |
2282 Label not_name; | |
2283 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE); | |
2284 __ CmpObjectType(rax, LAST_NAME_TYPE, rdi); | |
2285 // rax: receiver | |
2286 // rdi: receiver map | |
2287 __ j(above, ¬_name, Label::kNear); | |
2288 __ Ret(); | |
2289 __ bind(¬_name); | |
2290 | |
2291 Label not_heap_number; | |
2292 __ CompareRoot(rdi, Heap::kHeapNumberMapRootIndex); | |
2293 __ j(not_equal, ¬_heap_number, Label::kNear); | |
2294 __ bind(&is_number); | |
2295 NumberToStringStub stub(isolate()); | |
2296 __ TailCallStub(&stub); | |
2297 __ bind(¬_heap_number); | |
2298 | |
2299 Label not_oddball; | |
2300 __ CmpInstanceType(rdi, ODDBALL_TYPE); | |
2301 __ j(not_equal, ¬_oddball, Label::kNear); | |
2302 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); | |
2303 __ Ret(); | |
2304 __ bind(¬_oddball); | |
2305 | |
2306 __ PopReturnAddressTo(rcx); // Pop return address. | |
2307 __ Push(rax); // Push argument. | |
2308 __ PushReturnAddressFrom(rcx); // Push return address. | |
2309 __ TailCallRuntime(Runtime::kToName); | |
2310 } | |
2311 | |
2312 | 2277 |
2313 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2278 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
2314 Register left, | 2279 Register left, |
2315 Register right, | 2280 Register right, |
2316 Register scratch1, | 2281 Register scratch1, |
2317 Register scratch2) { | 2282 Register scratch2) { |
2318 Register length = scratch1; | 2283 Register length = scratch1; |
2319 | 2284 |
2320 // Compare lengths. | 2285 // Compare lengths. |
2321 Label check_zero_length; | 2286 Label check_zero_length; |
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5204 kStackUnwindSpace, nullptr, return_value_operand, | 5169 kStackUnwindSpace, nullptr, return_value_operand, |
5205 NULL); | 5170 NULL); |
5206 } | 5171 } |
5207 | 5172 |
5208 #undef __ | 5173 #undef __ |
5209 | 5174 |
5210 } // namespace internal | 5175 } // namespace internal |
5211 } // namespace v8 | 5176 } // namespace v8 |
5212 | 5177 |
5213 #endif // V8_TARGET_ARCH_X64 | 5178 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |