| 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 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 | 2544 |
| 2545 // Calculate the entry in the number string cache. The hash value in the | 2545 // Calculate the entry in the number string cache. The hash value in the |
| 2546 // number string cache for smis is just the smi value, and the hash for | 2546 // number string cache for smis is just the smi value, and the hash for |
| 2547 // doubles is the xor of the upper and lower words. See | 2547 // doubles is the xor of the upper and lower words. See |
| 2548 // Heap::GetNumberStringCache. | 2548 // Heap::GetNumberStringCache. |
| 2549 Label is_smi; | 2549 Label is_smi; |
| 2550 Label load_result_from_cache; | 2550 Label load_result_from_cache; |
| 2551 Factory* factory = masm->isolate()->factory(); | 2551 Factory* factory = masm->isolate()->factory(); |
| 2552 if (!object_is_smi) { | 2552 if (!object_is_smi) { |
| 2553 __ JumpIfSmi(object, &is_smi); | 2553 __ JumpIfSmi(object, &is_smi); |
| 2554 __ CheckMap(object, factory->heap_number_map(), not_found, true); | 2554 __ CheckMap(object, |
| 2555 factory->heap_number_map(), |
| 2556 not_found, |
| 2557 DONT_DO_SMI_CHECK); |
| 2555 | 2558 |
| 2556 STATIC_ASSERT(8 == kDoubleSize); | 2559 STATIC_ASSERT(8 == kDoubleSize); |
| 2557 __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); | 2560 __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); |
| 2558 __ xor_(scratch, FieldOperand(object, HeapNumber::kValueOffset)); | 2561 __ xor_(scratch, FieldOperand(object, HeapNumber::kValueOffset)); |
| 2559 GenerateConvertHashCodeToIndex(masm, scratch, mask); | 2562 GenerateConvertHashCodeToIndex(masm, scratch, mask); |
| 2560 | 2563 |
| 2561 Register index = scratch; | 2564 Register index = scratch; |
| 2562 Register probe = mask; | 2565 Register probe = mask; |
| 2563 __ movq(probe, | 2566 __ movq(probe, |
| 2564 FieldOperand(number_string_cache, | 2567 FieldOperand(number_string_cache, |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3263 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | 3266 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
| 3264 __ push(c_entry_fp_operand); | 3267 __ push(c_entry_fp_operand); |
| 3265 } | 3268 } |
| 3266 | 3269 |
| 3267 #ifdef ENABLE_LOGGING_AND_PROFILING | 3270 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3268 // If this is the outermost JS call, set js_entry_sp value. | 3271 // If this is the outermost JS call, set js_entry_sp value. |
| 3269 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); | 3272 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); |
| 3270 __ Load(rax, js_entry_sp); | 3273 __ Load(rax, js_entry_sp); |
| 3271 __ testq(rax, rax); | 3274 __ testq(rax, rax); |
| 3272 __ j(not_zero, ¬_outermost_js); | 3275 __ j(not_zero, ¬_outermost_js); |
| 3276 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); |
| 3273 __ movq(rax, rbp); | 3277 __ movq(rax, rbp); |
| 3274 __ Store(js_entry_sp, rax); | 3278 __ Store(js_entry_sp, rax); |
| 3279 Label cont; |
| 3280 __ jmp(&cont); |
| 3275 __ bind(¬_outermost_js); | 3281 __ bind(¬_outermost_js); |
| 3282 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); |
| 3283 __ bind(&cont); |
| 3276 #endif | 3284 #endif |
| 3277 | 3285 |
| 3278 // Call a faked try-block that does the invoke. | 3286 // Call a faked try-block that does the invoke. |
| 3279 __ call(&invoke); | 3287 __ call(&invoke); |
| 3280 | 3288 |
| 3281 // Caught exception: Store result (exception) in the pending | 3289 // Caught exception: Store result (exception) in the pending |
| 3282 // exception field in the JSEnv and return a failure sentinel. | 3290 // exception field in the JSEnv and return a failure sentinel. |
| 3283 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 3291 ExternalReference pending_exception(Isolate::k_pending_exception_address, |
| 3284 isolate); | 3292 isolate); |
| 3285 __ Store(pending_exception, rax); | 3293 __ Store(pending_exception, rax); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3307 isolate); | 3315 isolate); |
| 3308 __ Load(rax, construct_entry); | 3316 __ Load(rax, construct_entry); |
| 3309 } else { | 3317 } else { |
| 3310 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); | 3318 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); |
| 3311 __ Load(rax, entry); | 3319 __ Load(rax, entry); |
| 3312 } | 3320 } |
| 3313 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); | 3321 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); |
| 3314 __ call(kScratchRegister); | 3322 __ call(kScratchRegister); |
| 3315 | 3323 |
| 3316 // Unlink this frame from the handler chain. | 3324 // Unlink this frame from the handler chain. |
| 3317 Operand handler_operand = | 3325 __ PopTryHandler(); |
| 3318 masm->ExternalOperand(ExternalReference(Isolate::k_handler_address, | |
| 3319 isolate)); | |
| 3320 __ pop(handler_operand); | |
| 3321 // Pop next_sp. | |
| 3322 __ addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); | |
| 3323 | 3326 |
| 3327 __ bind(&exit); |
| 3324 #ifdef ENABLE_LOGGING_AND_PROFILING | 3328 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 3325 // If current RBP value is the same as js_entry_sp value, it means that | 3329 // Check if the current stack frame is marked as the outermost JS frame. |
| 3326 // the current function is the outermost. | 3330 __ pop(rbx); |
| 3331 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); |
| 3332 __ j(not_equal, ¬_outermost_js_2); |
| 3327 __ movq(kScratchRegister, js_entry_sp); | 3333 __ movq(kScratchRegister, js_entry_sp); |
| 3328 __ cmpq(rbp, Operand(kScratchRegister, 0)); | |
| 3329 __ j(not_equal, ¬_outermost_js_2); | |
| 3330 __ movq(Operand(kScratchRegister, 0), Immediate(0)); | 3334 __ movq(Operand(kScratchRegister, 0), Immediate(0)); |
| 3331 __ bind(¬_outermost_js_2); | 3335 __ bind(¬_outermost_js_2); |
| 3332 #endif | 3336 #endif |
| 3333 | 3337 |
| 3334 // Restore the top frame descriptor from the stack. | 3338 // Restore the top frame descriptor from the stack. |
| 3335 __ bind(&exit); | 3339 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); |
| 3336 { | |
| 3337 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); | |
| 3338 __ pop(c_entry_fp_operand); | 3340 __ pop(c_entry_fp_operand); |
| 3339 } | 3341 } |
| 3340 | 3342 |
| 3341 // Restore callee-saved registers (X64 conventions). | 3343 // Restore callee-saved registers (X64 conventions). |
| 3342 __ pop(rbx); | 3344 __ pop(rbx); |
| 3343 #ifdef _WIN64 | 3345 #ifdef _WIN64 |
| 3344 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. | 3346 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. |
| 3345 __ pop(rsi); | 3347 __ pop(rsi); |
| 3346 __ pop(rdi); | 3348 __ pop(rdi); |
| 3347 #endif | 3349 #endif |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 | 3676 |
| 3675 | 3677 |
| 3676 void StringCharCodeAtGenerator::GenerateSlow( | 3678 void StringCharCodeAtGenerator::GenerateSlow( |
| 3677 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 3679 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { |
| 3678 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 3680 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); |
| 3679 | 3681 |
| 3680 Factory* factory = masm->isolate()->factory(); | 3682 Factory* factory = masm->isolate()->factory(); |
| 3681 // Index is not a smi. | 3683 // Index is not a smi. |
| 3682 __ bind(&index_not_smi_); | 3684 __ bind(&index_not_smi_); |
| 3683 // If index is a heap number, try converting it to an integer. | 3685 // If index is a heap number, try converting it to an integer. |
| 3684 __ CheckMap(index_, factory->heap_number_map(), index_not_number_, true); | 3686 __ CheckMap(index_, |
| 3687 factory->heap_number_map(), |
| 3688 index_not_number_, |
| 3689 DONT_DO_SMI_CHECK); |
| 3685 call_helper.BeforeCall(masm); | 3690 call_helper.BeforeCall(masm); |
| 3686 __ push(object_); | 3691 __ push(object_); |
| 3687 __ push(index_); | 3692 __ push(index_); |
| 3688 __ push(index_); // Consumed by runtime conversion function. | 3693 __ push(index_); // Consumed by runtime conversion function. |
| 3689 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3694 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
| 3690 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3695 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
| 3691 } else { | 3696 } else { |
| 3692 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3697 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
| 3693 // NumberToSmi discards numbers that are not exact integers. | 3698 // NumberToSmi discards numbers that are not exact integers. |
| 3694 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3699 __ CallRuntime(Runtime::kNumberToSmi, 1); |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5101 __ Drop(1); | 5106 __ Drop(1); |
| 5102 __ ret(2 * kPointerSize); | 5107 __ ret(2 * kPointerSize); |
| 5103 } | 5108 } |
| 5104 | 5109 |
| 5105 | 5110 |
| 5106 #undef __ | 5111 #undef __ |
| 5107 | 5112 |
| 5108 } } // namespace v8::internal | 5113 } } // namespace v8::internal |
| 5109 | 5114 |
| 5110 #endif // V8_TARGET_ARCH_X64 | 5115 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |