| 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 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3309 Label* throw_normal_exception, | 3309 Label* throw_normal_exception, |
| 3310 Label* throw_termination_exception, | 3310 Label* throw_termination_exception, |
| 3311 Label* throw_out_of_memory_exception, | 3311 Label* throw_out_of_memory_exception, |
| 3312 bool do_gc, | 3312 bool do_gc, |
| 3313 bool always_allocate_scope) { | 3313 bool always_allocate_scope) { |
| 3314 // rax: result parameter for PerformGC, if any. | 3314 // rax: result parameter for PerformGC, if any. |
| 3315 // rbx: pointer to C function (C callee-saved). | 3315 // rbx: pointer to C function (C callee-saved). |
| 3316 // rbp: frame pointer (restored after C call). | 3316 // rbp: frame pointer (restored after C call). |
| 3317 // rsp: stack pointer (restored after C call). | 3317 // rsp: stack pointer (restored after C call). |
| 3318 // r14: number of arguments including receiver (C callee-saved). | 3318 // r14: number of arguments including receiver (C callee-saved). |
| 3319 // r12: pointer to the first argument (C callee-saved). | 3319 // r15: pointer to the first argument (C callee-saved). |
| 3320 // This pointer is reused in LeaveExitFrame(), so it is stored in a | 3320 // This pointer is reused in LeaveExitFrame(), so it is stored in a |
| 3321 // callee-saved register. | 3321 // callee-saved register. |
| 3322 | 3322 |
| 3323 // Simple results returned in rax (both AMD64 and Win64 calling conventions). | 3323 // Simple results returned in rax (both AMD64 and Win64 calling conventions). |
| 3324 // Complex results must be written to address passed as first argument. | 3324 // Complex results must be written to address passed as first argument. |
| 3325 // AMD64 calling convention: a struct of two pointers in rax+rdx | 3325 // AMD64 calling convention: a struct of two pointers in rax+rdx |
| 3326 | 3326 |
| 3327 // Check stack alignment. | 3327 // Check stack alignment. |
| 3328 if (FLAG_debug_code) { | 3328 if (FLAG_debug_code) { |
| 3329 __ CheckStackAlignment(); | 3329 __ CheckStackAlignment(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3350 if (always_allocate_scope) { | 3350 if (always_allocate_scope) { |
| 3351 __ movq(kScratchRegister, scope_depth); | 3351 __ movq(kScratchRegister, scope_depth); |
| 3352 __ incl(Operand(kScratchRegister, 0)); | 3352 __ incl(Operand(kScratchRegister, 0)); |
| 3353 } | 3353 } |
| 3354 | 3354 |
| 3355 // Call C function. | 3355 // Call C function. |
| 3356 #ifdef _WIN64 | 3356 #ifdef _WIN64 |
| 3357 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 | 3357 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 |
| 3358 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. | 3358 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. |
| 3359 __ movq(StackSpaceOperand(0), r14); // argc. | 3359 __ movq(StackSpaceOperand(0), r14); // argc. |
| 3360 __ movq(StackSpaceOperand(1), r12); // argv. | 3360 __ movq(StackSpaceOperand(1), r15); // argv. |
| 3361 if (result_size_ < 2) { | 3361 if (result_size_ < 2) { |
| 3362 // Pass a pointer to the Arguments object as the first argument. | 3362 // Pass a pointer to the Arguments object as the first argument. |
| 3363 // Return result in single register (rax). | 3363 // Return result in single register (rax). |
| 3364 __ lea(rcx, StackSpaceOperand(0)); | 3364 __ lea(rcx, StackSpaceOperand(0)); |
| 3365 } else { | 3365 } else { |
| 3366 ASSERT_EQ(2, result_size_); | 3366 ASSERT_EQ(2, result_size_); |
| 3367 // Pass a pointer to the result location as the first argument. | 3367 // Pass a pointer to the result location as the first argument. |
| 3368 __ lea(rcx, StackSpaceOperand(2)); | 3368 __ lea(rcx, StackSpaceOperand(2)); |
| 3369 // Pass a pointer to the Arguments object as the second argument. | 3369 // Pass a pointer to the Arguments object as the second argument. |
| 3370 __ lea(rdx, StackSpaceOperand(0)); | 3370 __ lea(rdx, StackSpaceOperand(0)); |
| 3371 } | 3371 } |
| 3372 | 3372 |
| 3373 #else // _WIN64 | 3373 #else // _WIN64 |
| 3374 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. | 3374 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. |
| 3375 __ movq(rdi, r14); // argc. | 3375 __ movq(rdi, r14); // argc. |
| 3376 __ movq(rsi, r12); // argv. | 3376 __ movq(rsi, r15); // argv. |
| 3377 #endif | 3377 #endif |
| 3378 __ call(rbx); | 3378 __ call(rbx); |
| 3379 // Result is in rax - do not destroy this register! | 3379 // Result is in rax - do not destroy this register! |
| 3380 | 3380 |
| 3381 if (always_allocate_scope) { | 3381 if (always_allocate_scope) { |
| 3382 __ movq(kScratchRegister, scope_depth); | 3382 __ movq(kScratchRegister, scope_depth); |
| 3383 __ decl(Operand(kScratchRegister, 0)); | 3383 __ decl(Operand(kScratchRegister, 0)); |
| 3384 } | 3384 } |
| 3385 | 3385 |
| 3386 // Check for failure result. | 3386 // Check for failure result. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3470 // rax: Holds the context at this point, but should not be used. | 3470 // rax: Holds the context at this point, but should not be used. |
| 3471 // On entry to code generated by GenerateCore, it must hold | 3471 // On entry to code generated by GenerateCore, it must hold |
| 3472 // a failure result if the collect_garbage argument to GenerateCore | 3472 // a failure result if the collect_garbage argument to GenerateCore |
| 3473 // is true. This failure result can be the result of code | 3473 // is true. This failure result can be the result of code |
| 3474 // generated by a previous call to GenerateCore. The value | 3474 // generated by a previous call to GenerateCore. The value |
| 3475 // of rax is then passed to Runtime::PerformGC. | 3475 // of rax is then passed to Runtime::PerformGC. |
| 3476 // rbx: pointer to builtin function (C callee-saved). | 3476 // rbx: pointer to builtin function (C callee-saved). |
| 3477 // rbp: frame pointer of exit frame (restored after C call). | 3477 // rbp: frame pointer of exit frame (restored after C call). |
| 3478 // rsp: stack pointer (restored after C call). | 3478 // rsp: stack pointer (restored after C call). |
| 3479 // r14: number of arguments including receiver (C callee-saved). | 3479 // r14: number of arguments including receiver (C callee-saved). |
| 3480 // r12: argv pointer (C callee-saved). | 3480 // r15: argv pointer (C callee-saved). |
| 3481 | 3481 |
| 3482 Label throw_normal_exception; | 3482 Label throw_normal_exception; |
| 3483 Label throw_termination_exception; | 3483 Label throw_termination_exception; |
| 3484 Label throw_out_of_memory_exception; | 3484 Label throw_out_of_memory_exception; |
| 3485 | 3485 |
| 3486 // Call into the runtime system. | 3486 // Call into the runtime system. |
| 3487 GenerateCore(masm, | 3487 GenerateCore(masm, |
| 3488 &throw_normal_exception, | 3488 &throw_normal_exception, |
| 3489 &throw_termination_exception, | 3489 &throw_termination_exception, |
| 3490 &throw_out_of_memory_exception, | 3490 &throw_out_of_memory_exception, |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4090 &string_add_runtime); | 4090 &string_add_runtime); |
| 4091 | 4091 |
| 4092 // Get the two characters forming the sub string. | 4092 // Get the two characters forming the sub string. |
| 4093 __ movzxbq(rbx, FieldOperand(rax, SeqAsciiString::kHeaderSize)); | 4093 __ movzxbq(rbx, FieldOperand(rax, SeqAsciiString::kHeaderSize)); |
| 4094 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); | 4094 __ movzxbq(rcx, FieldOperand(rdx, SeqAsciiString::kHeaderSize)); |
| 4095 | 4095 |
| 4096 // Try to lookup two character string in symbol table. If it is not found | 4096 // Try to lookup two character string in symbol table. If it is not found |
| 4097 // just allocate a new one. | 4097 // just allocate a new one. |
| 4098 Label make_two_character_string, make_flat_ascii_string; | 4098 Label make_two_character_string, make_flat_ascii_string; |
| 4099 StringHelper::GenerateTwoCharacterSymbolTableProbe( | 4099 StringHelper::GenerateTwoCharacterSymbolTableProbe( |
| 4100 masm, rbx, rcx, r14, r11, rdi, r12, &make_two_character_string); | 4100 masm, rbx, rcx, r14, r11, rdi, r15, &make_two_character_string); |
| 4101 __ IncrementCounter(&Counters::string_add_native, 1); | 4101 __ IncrementCounter(&Counters::string_add_native, 1); |
| 4102 __ ret(2 * kPointerSize); | 4102 __ ret(2 * kPointerSize); |
| 4103 | 4103 |
| 4104 __ bind(&make_two_character_string); | 4104 __ bind(&make_two_character_string); |
| 4105 __ Set(rbx, 2); | 4105 __ Set(rbx, 2); |
| 4106 __ jmp(&make_flat_ascii_string); | 4106 __ jmp(&make_flat_ascii_string); |
| 4107 | 4107 |
| 4108 __ bind(&longer_than_two); | 4108 __ bind(&longer_than_two); |
| 4109 // Check if resulting string will be flat. | 4109 // Check if resulting string will be flat. |
| 4110 __ SmiCompare(rbx, Smi::FromInt(String::kMinNonFlatLength)); | 4110 __ SmiCompare(rbx, Smi::FromInt(String::kMinNonFlatLength)); |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5139 FieldOperand(elements, PixelArray::kExternalPointerOffset)); | 5139 FieldOperand(elements, PixelArray::kExternalPointerOffset)); |
| 5140 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); | 5140 __ movb(Operand(external_pointer, untagged_key, times_1, 0), untagged_value); |
| 5141 __ ret(0); // Return value in eax. | 5141 __ ret(0); // Return value in eax. |
| 5142 } | 5142 } |
| 5143 | 5143 |
| 5144 #undef __ | 5144 #undef __ |
| 5145 | 5145 |
| 5146 } } // namespace v8::internal | 5146 } } // namespace v8::internal |
| 5147 | 5147 |
| 5148 #endif // V8_TARGET_ARCH_X64 | 5148 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |