| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #define __ ACCESS_MASM(masm) | 39 #define __ ACCESS_MASM(masm) |
| 40 | 40 |
| 41 void ToNumberStub::Generate(MacroAssembler* masm) { | 41 void ToNumberStub::Generate(MacroAssembler* masm) { |
| 42 // The ToNumber stub takes one argument in eax. | 42 // The ToNumber stub takes one argument in eax. |
| 43 NearLabel check_heap_number, call_builtin; | 43 NearLabel check_heap_number, call_builtin; |
| 44 __ SmiTest(rax); | 44 __ SmiTest(rax); |
| 45 __ j(not_zero, &check_heap_number); | 45 __ j(not_zero, &check_heap_number); |
| 46 __ Ret(); | 46 __ Ret(); |
| 47 | 47 |
| 48 __ bind(&check_heap_number); | 48 __ bind(&check_heap_number); |
| 49 __ Move(rbx, FACTORY->heap_number_map()); | 49 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), |
| 50 __ cmpq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 50 Heap::kHeapNumberMapRootIndex); |
| 51 __ j(not_equal, &call_builtin); | 51 __ j(not_equal, &call_builtin); |
| 52 __ Ret(); | 52 __ Ret(); |
| 53 | 53 |
| 54 __ bind(&call_builtin); | 54 __ bind(&call_builtin); |
| 55 __ pop(rcx); // Pop return address. | 55 __ pop(rcx); // Pop return address. |
| 56 __ push(rax); | 56 __ push(rax); |
| 57 __ push(rcx); // Push return address. | 57 __ push(rcx); // Push return address. |
| 58 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 58 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // Return and remove the on-stack parameter. | 98 // Return and remove the on-stack parameter. |
| 99 __ ret(1 * kPointerSize); | 99 __ ret(1 * kPointerSize); |
| 100 | 100 |
| 101 // Create a new closure through the slower runtime call. | 101 // Create a new closure through the slower runtime call. |
| 102 __ bind(&gc); | 102 __ bind(&gc); |
| 103 __ pop(rcx); // Temporarily remove return address. | 103 __ pop(rcx); // Temporarily remove return address. |
| 104 __ pop(rdx); | 104 __ pop(rdx); |
| 105 __ push(rsi); | 105 __ push(rsi); |
| 106 __ push(rdx); | 106 __ push(rdx); |
| 107 __ Push(FACTORY->false_value()); | 107 __ PushRoot(Heap::kFalseValueRootIndex); |
| 108 __ push(rcx); // Restore return address. | 108 __ push(rcx); // Restore return address. |
| 109 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); | 109 __ TailCallRuntime(Runtime::kNewClosure, 3, 1); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 void FastNewContextStub::Generate(MacroAssembler* masm) { | 113 void FastNewContextStub::Generate(MacroAssembler* masm) { |
| 114 // Try to allocate the context in new space. | 114 // Try to allocate the context in new space. |
| 115 Label gc; | 115 Label gc; |
| 116 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 116 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 117 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize, | 117 __ AllocateInNewSpace((length * kPointerSize) + FixedArray::kHeaderSize, |
| (...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 // rax: RegExp data (FixedArray) | 2489 // rax: RegExp data (FixedArray) |
| 2490 // rdx: Number of capture registers | 2490 // rdx: Number of capture registers |
| 2491 // Check that the fourth object is a JSArray object. | 2491 // Check that the fourth object is a JSArray object. |
| 2492 __ movq(rdi, Operand(rsp, kLastMatchInfoOffset)); | 2492 __ movq(rdi, Operand(rsp, kLastMatchInfoOffset)); |
| 2493 __ JumpIfSmi(rdi, &runtime); | 2493 __ JumpIfSmi(rdi, &runtime); |
| 2494 __ CmpObjectType(rdi, JS_ARRAY_TYPE, kScratchRegister); | 2494 __ CmpObjectType(rdi, JS_ARRAY_TYPE, kScratchRegister); |
| 2495 __ j(not_equal, &runtime); | 2495 __ j(not_equal, &runtime); |
| 2496 // Check that the JSArray is in fast case. | 2496 // Check that the JSArray is in fast case. |
| 2497 __ movq(rbx, FieldOperand(rdi, JSArray::kElementsOffset)); | 2497 __ movq(rbx, FieldOperand(rdi, JSArray::kElementsOffset)); |
| 2498 __ movq(rdi, FieldOperand(rbx, HeapObject::kMapOffset)); | 2498 __ movq(rdi, FieldOperand(rbx, HeapObject::kMapOffset)); |
| 2499 __ Cmp(rdi, FACTORY->fixed_array_map()); | 2499 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
| 2500 Heap::kFixedArrayMapRootIndex); |
| 2500 __ j(not_equal, &runtime); | 2501 __ j(not_equal, &runtime); |
| 2501 // Check that the last match info has space for the capture registers and the | 2502 // Check that the last match info has space for the capture registers and the |
| 2502 // additional information. Ensure no overflow in add. | 2503 // additional information. Ensure no overflow in add. |
| 2503 STATIC_ASSERT(FixedArray::kMaxLength < kMaxInt - FixedArray::kLengthOffset); | 2504 STATIC_ASSERT(FixedArray::kMaxLength < kMaxInt - FixedArray::kLengthOffset); |
| 2504 __ SmiToInteger32(rdi, FieldOperand(rbx, FixedArray::kLengthOffset)); | 2505 __ SmiToInteger32(rdi, FieldOperand(rbx, FixedArray::kLengthOffset)); |
| 2505 __ addl(rdx, Immediate(RegExpImpl::kLastMatchOverhead)); | 2506 __ addl(rdx, Immediate(RegExpImpl::kLastMatchOverhead)); |
| 2506 __ cmpl(rdx, rdi); | 2507 __ cmpl(rdx, rdi); |
| 2507 __ j(greater, &runtime); | 2508 __ j(greater, &runtime); |
| 2508 | 2509 |
| 2509 // rax: RegExp data (FixedArray) | 2510 // rax: RegExp data (FixedArray) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2524 // Check for flat cons string. | 2525 // Check for flat cons string. |
| 2525 // A flat cons string is a cons string where the second part is the empty | 2526 // A flat cons string is a cons string where the second part is the empty |
| 2526 // string. In that case the subject string is just the first part of the cons | 2527 // string. In that case the subject string is just the first part of the cons |
| 2527 // string. Also in this case the first part of the cons string is known to be | 2528 // string. Also in this case the first part of the cons string is known to be |
| 2528 // a sequential string or an external string. | 2529 // a sequential string or an external string. |
| 2529 STATIC_ASSERT(kExternalStringTag !=0); | 2530 STATIC_ASSERT(kExternalStringTag !=0); |
| 2530 STATIC_ASSERT((kConsStringTag & kExternalStringTag) == 0); | 2531 STATIC_ASSERT((kConsStringTag & kExternalStringTag) == 0); |
| 2531 __ testb(rbx, Immediate(kIsNotStringMask | kExternalStringTag)); | 2532 __ testb(rbx, Immediate(kIsNotStringMask | kExternalStringTag)); |
| 2532 __ j(not_zero, &runtime); | 2533 __ j(not_zero, &runtime); |
| 2533 // String is a cons string. | 2534 // String is a cons string. |
| 2534 __ movq(rdx, FieldOperand(rdi, ConsString::kSecondOffset)); | 2535 __ CompareRoot(FieldOperand(rdi, ConsString::kSecondOffset), |
| 2535 __ Cmp(rdx, FACTORY->empty_string()); | 2536 Heap::kEmptyStringRootIndex); |
| 2536 __ j(not_equal, &runtime); | 2537 __ j(not_equal, &runtime); |
| 2537 __ movq(rdi, FieldOperand(rdi, ConsString::kFirstOffset)); | 2538 __ movq(rdi, FieldOperand(rdi, ConsString::kFirstOffset)); |
| 2538 __ movq(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); | 2539 __ movq(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); |
| 2539 // String is a cons string with empty second part. | 2540 // String is a cons string with empty second part. |
| 2540 // rdi: first part of cons string. | 2541 // rdi: first part of cons string. |
| 2541 // rbx: map of first part of cons string. | 2542 // rbx: map of first part of cons string. |
| 2542 // Is first part a flat two byte string? | 2543 // Is first part a flat two byte string? |
| 2543 __ testb(FieldOperand(rbx, Map::kInstanceTypeOffset), | 2544 __ testb(FieldOperand(rbx, Map::kInstanceTypeOffset), |
| 2544 Immediate(kStringRepresentationMask | kStringEncodingMask)); | 2545 Immediate(kStringRepresentationMask | kStringEncodingMask)); |
| 2545 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); | 2546 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2798 // rbx: Number of array elements as int32. | 2799 // rbx: Number of array elements as int32. |
| 2799 // r8: Number of array elements as smi. | 2800 // r8: Number of array elements as smi. |
| 2800 | 2801 |
| 2801 // Set JSArray map to global.regexp_result_map(). | 2802 // Set JSArray map to global.regexp_result_map(). |
| 2802 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX)); | 2803 __ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX)); |
| 2803 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset)); | 2804 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset)); |
| 2804 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); | 2805 __ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX)); |
| 2805 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx); | 2806 __ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx); |
| 2806 | 2807 |
| 2807 // Set empty properties FixedArray. | 2808 // Set empty properties FixedArray. |
| 2808 __ Move(FieldOperand(rax, JSObject::kPropertiesOffset), | 2809 __ LoadRoot(kScratchRegister, Heap::kEmptyFixedArrayRootIndex); |
| 2809 FACTORY->empty_fixed_array()); | 2810 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), kScratchRegister); |
| 2810 | 2811 |
| 2811 // Set elements to point to FixedArray allocated right after the JSArray. | 2812 // Set elements to point to FixedArray allocated right after the JSArray. |
| 2812 __ lea(rcx, Operand(rax, JSRegExpResult::kSize)); | 2813 __ lea(rcx, Operand(rax, JSRegExpResult::kSize)); |
| 2813 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rcx); | 2814 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rcx); |
| 2814 | 2815 |
| 2815 // Set input, index and length fields from arguments. | 2816 // Set input, index and length fields from arguments. |
| 2816 __ movq(r8, Operand(rsp, kPointerSize * 1)); | 2817 __ movq(r8, Operand(rsp, kPointerSize * 1)); |
| 2817 __ movq(FieldOperand(rax, JSRegExpResult::kInputOffset), r8); | 2818 __ movq(FieldOperand(rax, JSRegExpResult::kInputOffset), r8); |
| 2818 __ movq(r8, Operand(rsp, kPointerSize * 2)); | 2819 __ movq(r8, Operand(rsp, kPointerSize * 2)); |
| 2819 __ movq(FieldOperand(rax, JSRegExpResult::kIndexOffset), r8); | 2820 __ movq(FieldOperand(rax, JSRegExpResult::kIndexOffset), r8); |
| 2820 __ movq(r8, Operand(rsp, kPointerSize * 3)); | 2821 __ movq(r8, Operand(rsp, kPointerSize * 3)); |
| 2821 __ movq(FieldOperand(rax, JSArray::kLengthOffset), r8); | 2822 __ movq(FieldOperand(rax, JSArray::kLengthOffset), r8); |
| 2822 | 2823 |
| 2823 // Fill out the elements FixedArray. | 2824 // Fill out the elements FixedArray. |
| 2824 // rax: JSArray. | 2825 // rax: JSArray. |
| 2825 // rcx: FixedArray. | 2826 // rcx: FixedArray. |
| 2826 // rbx: Number of elements in array as int32. | 2827 // rbx: Number of elements in array as int32. |
| 2827 | 2828 |
| 2828 // Set map. | 2829 // Set map. |
| 2829 __ Move(FieldOperand(rcx, HeapObject::kMapOffset), | 2830 __ LoadRoot(kScratchRegister, Heap::kFixedArrayMapRootIndex); |
| 2830 FACTORY->fixed_array_map()); | 2831 __ movq(FieldOperand(rcx, HeapObject::kMapOffset), kScratchRegister); |
| 2831 // Set length. | 2832 // Set length. |
| 2832 __ Integer32ToSmi(rdx, rbx); | 2833 __ Integer32ToSmi(rdx, rbx); |
| 2833 __ movq(FieldOperand(rcx, FixedArray::kLengthOffset), rdx); | 2834 __ movq(FieldOperand(rcx, FixedArray::kLengthOffset), rdx); |
| 2834 // Fill contents of fixed-array with the-hole. | 2835 // Fill contents of fixed-array with the-hole. |
| 2835 __ Move(rdx, FACTORY->the_hole_value()); | 2836 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); |
| 2836 __ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize)); | 2837 __ lea(rcx, FieldOperand(rcx, FixedArray::kHeaderSize)); |
| 2837 // Fill fixed array elements with hole. | 2838 // Fill fixed array elements with hole. |
| 2838 // rax: JSArray. | 2839 // rax: JSArray. |
| 2839 // rbx: Number of elements in array that remains to be filled, as int32. | 2840 // rbx: Number of elements in array that remains to be filled, as int32. |
| 2840 // rcx: Start of elements in FixedArray. | 2841 // rcx: Start of elements in FixedArray. |
| 2841 // rdx: the hole. | 2842 // rdx: the hole. |
| 2842 Label loop; | 2843 Label loop; |
| 2843 __ testl(rbx, rbx); | 2844 __ testl(rbx, rbx); |
| 2844 __ bind(&loop); | 2845 __ bind(&loop); |
| 2845 __ j(less_equal, &done); // Jump if rcx is negative or zero. | 2846 __ j(less_equal, &done); // Jump if rcx is negative or zero. |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3327 Label* throw_normal_exception, | 3328 Label* throw_normal_exception, |
| 3328 Label* throw_termination_exception, | 3329 Label* throw_termination_exception, |
| 3329 Label* throw_out_of_memory_exception, | 3330 Label* throw_out_of_memory_exception, |
| 3330 bool do_gc, | 3331 bool do_gc, |
| 3331 bool always_allocate_scope) { | 3332 bool always_allocate_scope) { |
| 3332 // rax: result parameter for PerformGC, if any. | 3333 // rax: result parameter for PerformGC, if any. |
| 3333 // rbx: pointer to C function (C callee-saved). | 3334 // rbx: pointer to C function (C callee-saved). |
| 3334 // rbp: frame pointer (restored after C call). | 3335 // rbp: frame pointer (restored after C call). |
| 3335 // rsp: stack pointer (restored after C call). | 3336 // rsp: stack pointer (restored after C call). |
| 3336 // r14: number of arguments including receiver (C callee-saved). | 3337 // r14: number of arguments including receiver (C callee-saved). |
| 3337 // r12: pointer to the first argument (C callee-saved). | 3338 // r15: pointer to the first argument (C callee-saved). |
| 3338 // This pointer is reused in LeaveExitFrame(), so it is stored in a | 3339 // This pointer is reused in LeaveExitFrame(), so it is stored in a |
| 3339 // callee-saved register. | 3340 // callee-saved register. |
| 3340 | 3341 |
| 3341 // Simple results returned in rax (both AMD64 and Win64 calling conventions). | 3342 // Simple results returned in rax (both AMD64 and Win64 calling conventions). |
| 3342 // Complex results must be written to address passed as first argument. | 3343 // Complex results must be written to address passed as first argument. |
| 3343 // AMD64 calling convention: a struct of two pointers in rax+rdx | 3344 // AMD64 calling convention: a struct of two pointers in rax+rdx |
| 3344 | 3345 |
| 3345 // Check stack alignment. | 3346 // Check stack alignment. |
| 3346 if (FLAG_debug_code) { | 3347 if (FLAG_debug_code) { |
| 3347 __ CheckStackAlignment(); | 3348 __ CheckStackAlignment(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3368 if (always_allocate_scope) { | 3369 if (always_allocate_scope) { |
| 3369 __ movq(kScratchRegister, scope_depth); | 3370 __ movq(kScratchRegister, scope_depth); |
| 3370 __ incl(Operand(kScratchRegister, 0)); | 3371 __ incl(Operand(kScratchRegister, 0)); |
| 3371 } | 3372 } |
| 3372 | 3373 |
| 3373 // Call C function. | 3374 // Call C function. |
| 3374 #ifdef _WIN64 | 3375 #ifdef _WIN64 |
| 3375 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 | 3376 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 |
| 3376 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. | 3377 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. |
| 3377 __ movq(StackSpaceOperand(0), r14); // argc. | 3378 __ movq(StackSpaceOperand(0), r14); // argc. |
| 3378 __ movq(StackSpaceOperand(1), r12); // argv. | 3379 __ movq(StackSpaceOperand(1), r15); // argv. |
| 3379 if (result_size_ < 2) { | 3380 if (result_size_ < 2) { |
| 3380 // Pass a pointer to the Arguments object as the first argument. | 3381 // Pass a pointer to the Arguments object as the first argument. |
| 3381 // Return result in single register (rax). | 3382 // Return result in single register (rax). |
| 3382 __ lea(rcx, StackSpaceOperand(0)); | 3383 __ lea(rcx, StackSpaceOperand(0)); |
| 3383 __ movq(rdx, ExternalReference::isolate_address()); | 3384 __ movq(rdx, ExternalReference::isolate_address()); |
| 3384 } else { | 3385 } else { |
| 3385 ASSERT_EQ(2, result_size_); | 3386 ASSERT_EQ(2, result_size_); |
| 3386 // Pass a pointer to the result location as the first argument. | 3387 // Pass a pointer to the result location as the first argument. |
| 3387 __ lea(rcx, StackSpaceOperand(2)); | 3388 __ lea(rcx, StackSpaceOperand(2)); |
| 3388 // Pass a pointer to the Arguments object as the second argument. | 3389 // Pass a pointer to the Arguments object as the second argument. |
| 3389 __ lea(rdx, StackSpaceOperand(0)); | 3390 __ lea(rdx, StackSpaceOperand(0)); |
| 3390 __ movq(r8, ExternalReference::isolate_address()); | 3391 __ movq(r8, ExternalReference::isolate_address()); |
| 3391 } | 3392 } |
| 3392 | 3393 |
| 3393 #else // _WIN64 | 3394 #else // _WIN64 |
| 3394 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. | 3395 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. |
| 3395 __ movq(rdi, r14); // argc. | 3396 __ movq(rdi, r14); // argc. |
| 3396 __ movq(rsi, r12); // argv. | 3397 __ movq(rsi, r15); // argv. |
| 3397 __ movq(rdx, ExternalReference::isolate_address()); | 3398 __ movq(rdx, ExternalReference::isolate_address()); |
| 3398 #endif | 3399 #endif |
| 3399 __ call(rbx); | 3400 __ call(rbx); |
| 3400 // Result is in rax - do not destroy this register! | 3401 // Result is in rax - do not destroy this register! |
| 3401 | 3402 |
| 3402 if (always_allocate_scope) { | 3403 if (always_allocate_scope) { |
| 3403 __ movq(kScratchRegister, scope_depth); | 3404 __ movq(kScratchRegister, scope_depth); |
| 3404 __ decl(Operand(kScratchRegister, 0)); | 3405 __ decl(Operand(kScratchRegister, 0)); |
| 3405 } | 3406 } |
| 3406 | 3407 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3492 // rax: Holds the context at this point, but should not be used. | 3493 // rax: Holds the context at this point, but should not be used. |
| 3493 // On entry to code generated by GenerateCore, it must hold | 3494 // On entry to code generated by GenerateCore, it must hold |
| 3494 // a failure result if the collect_garbage argument to GenerateCore | 3495 // a failure result if the collect_garbage argument to GenerateCore |
| 3495 // is true. This failure result can be the result of code | 3496 // is true. This failure result can be the result of code |
| 3496 // generated by a previous call to GenerateCore. The value | 3497 // generated by a previous call to GenerateCore. The value |
| 3497 // of rax is then passed to Runtime::PerformGC. | 3498 // of rax is then passed to Runtime::PerformGC. |
| 3498 // rbx: pointer to builtin function (C callee-saved). | 3499 // rbx: pointer to builtin function (C callee-saved). |
| 3499 // rbp: frame pointer of exit frame (restored after C call). | 3500 // rbp: frame pointer of exit frame (restored after C call). |
| 3500 // rsp: stack pointer (restored after C call). | 3501 // rsp: stack pointer (restored after C call). |
| 3501 // r14: number of arguments including receiver (C callee-saved). | 3502 // r14: number of arguments including receiver (C callee-saved). |
| 3502 // r12: argv pointer (C callee-saved). | 3503 // r15: argv pointer (C callee-saved). |
| 3503 | 3504 |
| 3504 Label throw_normal_exception; | 3505 Label throw_normal_exception; |
| 3505 Label throw_termination_exception; | 3506 Label throw_termination_exception; |
| 3506 Label throw_out_of_memory_exception; | 3507 Label throw_out_of_memory_exception; |
| 3507 | 3508 |
| 3508 // Call into the runtime system. | 3509 // Call into the runtime system. |
| 3509 GenerateCore(masm, | 3510 GenerateCore(masm, |
| 3510 &throw_normal_exception, | 3511 &throw_normal_exception, |
| 3511 &throw_termination_exception, | 3512 &throw_termination_exception, |
| 3512 &throw_out_of_memory_exception, | 3513 &throw_out_of_memory_exception, |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 &string_add_runtime); | 4185 &string_add_runtime); |
| 4185 | 4186 |
| 4186 // Get the two characters forming the sub string. | 4187 // Get the two characters forming the sub string. |
| 4187 __ movzxbq(rbx, FieldOperand(rax, SeqAsciiString::kHeaderSize)); | 4188 __ movzxbq(rbx, FieldOperand(rax, SeqAsciiString::kHeaderSize)); |
| 4188 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); | 4189 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); |
| 4189 | 4190 |
| 4190 // Try to lookup two character string in symbol table. If it is not found | 4191 // Try to lookup two character string in symbol table. If it is not found |
| 4191 // just allocate a new one. | 4192 // just allocate a new one. |
| 4192 Label make_two_character_string, make_flat_ascii_string; | 4193 Label make_two_character_string, make_flat_ascii_string; |
| 4193 StringHelper::GenerateTwoCharacterSymbolTableProbe( | 4194 StringHelper::GenerateTwoCharacterSymbolTableProbe( |
| 4194 masm, rbx, rcx, r14, r11, rdi, r12, &make_two_character_string); | 4195 masm, rbx, rcx, r14, r11, rdi, r15, &make_two_character_string); |
| 4195 __ IncrementCounter(COUNTERS->string_add_native(), 1); | 4196 __ IncrementCounter(COUNTERS->string_add_native(), 1); |
| 4196 __ ret(2 * kPointerSize); | 4197 __ ret(2 * kPointerSize); |
| 4197 | 4198 |
| 4198 __ bind(&make_two_character_string); | 4199 __ bind(&make_two_character_string); |
| 4199 __ Set(rbx, 2); | 4200 __ Set(rbx, 2); |
| 4200 __ jmp(&make_flat_ascii_string); | 4201 __ jmp(&make_flat_ascii_string); |
| 4201 | 4202 |
| 4202 __ bind(&longer_than_two); | 4203 __ bind(&longer_than_two); |
| 4203 // Check if resulting string will be flat. | 4204 // Check if resulting string will be flat. |
| 4204 __ SmiCompare(rbx, Smi::FromInt(String::kMinNonFlatLength)); | 4205 __ SmiCompare(rbx, Smi::FromInt(String::kMinNonFlatLength)); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4956 &need_conversion, | 4957 &need_conversion, |
| 4957 &need_conversion, | 4958 &need_conversion, |
| 4958 &index_out_of_range, | 4959 &index_out_of_range, |
| 4959 STRING_INDEX_IS_NUMBER); | 4960 STRING_INDEX_IS_NUMBER); |
| 4960 generator.GenerateFast(masm); | 4961 generator.GenerateFast(masm); |
| 4961 __ jmp(&done); | 4962 __ jmp(&done); |
| 4962 | 4963 |
| 4963 __ bind(&index_out_of_range); | 4964 __ bind(&index_out_of_range); |
| 4964 // When the index is out of range, the spec requires us to return | 4965 // When the index is out of range, the spec requires us to return |
| 4965 // the empty string. | 4966 // the empty string. |
| 4966 __ Move(result, FACTORY->empty_string()); | 4967 __ LoadRoot(result, Heap::kEmptyStringRootIndex); |
| 4967 __ jmp(&done); | 4968 __ jmp(&done); |
| 4968 | 4969 |
| 4969 __ bind(&need_conversion); | 4970 __ bind(&need_conversion); |
| 4970 // Move smi zero into the result register, which will trigger | 4971 // Move smi zero into the result register, which will trigger |
| 4971 // conversion. | 4972 // conversion. |
| 4972 __ Move(result, Smi::FromInt(0)); | 4973 __ Move(result, Smi::FromInt(0)); |
| 4973 __ jmp(&done); | 4974 __ jmp(&done); |
| 4974 | 4975 |
| 4975 StubRuntimeCallHelper call_helper; | 4976 StubRuntimeCallHelper call_helper; |
| 4976 generator.GenerateSlow(masm, call_helper); | 4977 generator.GenerateSlow(masm, call_helper); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5095 // Do a tail call to the rewritten stub. | 5096 // Do a tail call to the rewritten stub. |
| 5096 __ jmp(rdi); | 5097 __ jmp(rdi); |
| 5097 } | 5098 } |
| 5098 | 5099 |
| 5099 | 5100 |
| 5100 #undef __ | 5101 #undef __ |
| 5101 | 5102 |
| 5102 } } // namespace v8::internal | 5103 } } // namespace v8::internal |
| 5103 | 5104 |
| 5104 #endif // V8_TARGET_ARCH_X64 | 5105 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |