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/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), | 343 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), |
344 2); | 344 2); |
345 } | 345 } |
346 // Return value is in xmm0. | 346 // Return value is in xmm0. |
347 __ Movsd(double_result, xmm0); | 347 __ Movsd(double_result, xmm0); |
348 | 348 |
349 __ bind(&done); | 349 __ bind(&done); |
350 __ ret(0); | 350 __ ret(0); |
351 } | 351 } |
352 | 352 |
| 353 void RegExpExecStub::Generate(MacroAssembler* masm) { |
| 354 #ifdef V8_INTERPRETED_REGEXP |
| 355 // This case is handled prior to the RegExpExecStub call. |
| 356 __ Abort(kUnexpectedRegExpExecCall); |
| 357 #else // V8_INTERPRETED_REGEXP |
| 358 // Isolates: note we add an additional parameter here (isolate pointer). |
| 359 static const int kRegExpExecuteArguments = 9; |
| 360 int argument_slots_on_stack = |
| 361 masm->ArgumentStackSlotsForCFunctionCall(kRegExpExecuteArguments); |
| 362 __ EnterApiExitFrame(argument_slots_on_stack); |
| 363 |
| 364 // Argument 9: Pass current isolate address. |
| 365 __ LoadAddress(kScratchRegister, |
| 366 ExternalReference::isolate_address(isolate())); |
| 367 __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kRegisterSize), |
| 368 kScratchRegister); |
| 369 |
| 370 // Argument 8: Indicate that this is a direct call from JavaScript. |
| 371 __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kRegisterSize), |
| 372 Immediate(1)); |
| 373 |
| 374 // Argument 7: Start (high end) of backtracking stack memory area. |
| 375 ExternalReference address_of_regexp_stack_memory_address = |
| 376 ExternalReference::address_of_regexp_stack_memory_address(isolate()); |
| 377 ExternalReference address_of_regexp_stack_memory_size = |
| 378 ExternalReference::address_of_regexp_stack_memory_size(isolate()); |
| 379 __ Move(kScratchRegister, address_of_regexp_stack_memory_address); |
| 380 __ movp(r12, Operand(kScratchRegister, 0)); |
| 381 __ Move(kScratchRegister, address_of_regexp_stack_memory_size); |
| 382 __ addp(r12, Operand(kScratchRegister, 0)); |
| 383 __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kRegisterSize), r12); |
| 384 |
| 385 // Argument 6: Set the number of capture registers to zero to force global |
| 386 // regexps to behave as non-global. This does not affect non-global regexps. |
| 387 // Argument 6 is passed in r9 on Linux and on the stack on Windows. |
| 388 #ifdef _WIN64 |
| 389 __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kRegisterSize), |
| 390 Immediate(0)); |
| 391 #else |
| 392 __ Set(r9, 0); |
| 393 #endif |
| 394 |
| 395 // Argument 5: static offsets vector buffer. |
| 396 // Argument 5 passed in r8 on Linux and on the stack on Windows. |
| 397 #ifdef _WIN64 |
| 398 __ LoadAddress( |
| 399 r12, ExternalReference::address_of_static_offsets_vector(isolate())); |
| 400 __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kRegisterSize), r12); |
| 401 #else // _WIN64 |
| 402 __ LoadAddress( |
| 403 r8, ExternalReference::address_of_static_offsets_vector(isolate())); |
| 404 #endif |
| 405 |
| 406 // Argument 2: Previous index. |
| 407 // TODO(jgruber): Ideally, LastIndexRegister would already equal arg_reg_2, |
| 408 // but that makes register allocation fail. |
| 409 __ movp(arg_reg_2, RegExpExecDescriptor::LastIndexRegister()); |
| 410 |
| 411 // Argument 4: End of string data |
| 412 // Argument 3: Start of string data |
| 413 CHECK(arg_reg_4.is(RegExpExecDescriptor::StringEndRegister())); |
| 414 CHECK(arg_reg_3.is(RegExpExecDescriptor::StringStartRegister())); |
| 415 |
| 416 // Argument 1: Original subject string. |
| 417 CHECK(arg_reg_1.is(RegExpExecDescriptor::StringRegister())); |
| 418 |
| 419 __ addp(RegExpExecDescriptor::CodeRegister(), |
| 420 Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 421 __ call(RegExpExecDescriptor::CodeRegister()); |
| 422 |
| 423 __ LeaveApiExitFrame(true); |
| 424 |
| 425 // TODO(jgruber): Don't tag return value once this is supported by stubs. |
| 426 __ Integer32ToSmi(rax, rax); |
| 427 __ ret(0 * kPointerSize); |
| 428 #endif // V8_INTERPRETED_REGEXP |
| 429 } |
| 430 |
| 431 |
353 static int NegativeComparisonResult(Condition cc) { | 432 static int NegativeComparisonResult(Condition cc) { |
354 DCHECK(cc != equal); | 433 DCHECK(cc != equal); |
355 DCHECK((cc == less) || (cc == less_equal) | 434 DCHECK((cc == less) || (cc == less_equal) |
356 || (cc == greater) || (cc == greater_equal)); | 435 || (cc == greater) || (cc == greater_equal)); |
357 return (cc == greater || cc == greater_equal) ? LESS : GREATER; | 436 return (cc == greater || cc == greater_equal) ? LESS : GREATER; |
358 } | 437 } |
359 | 438 |
360 | 439 |
361 static void CheckInputType(MacroAssembler* masm, Register input, | 440 static void CheckInputType(MacroAssembler* masm, Register input, |
362 CompareICState::State expected, Label* fail) { | 441 CompareICState::State expected, Label* fail) { |
(...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 kStackUnwindSpace, nullptr, return_value_operand, | 2975 kStackUnwindSpace, nullptr, return_value_operand, |
2897 NULL); | 2976 NULL); |
2898 } | 2977 } |
2899 | 2978 |
2900 #undef __ | 2979 #undef __ |
2901 | 2980 |
2902 } // namespace internal | 2981 } // namespace internal |
2903 } // namespace v8 | 2982 } // namespace v8 |
2904 | 2983 |
2905 #endif // V8_TARGET_ARCH_X64 | 2984 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |