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 3963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3974 // After shadowing stops, the original targets are unshadowed and the | 3974 // After shadowing stops, the original targets are unshadowed and the |
3975 // ShadowTargets represent the formerly shadowing targets. | 3975 // ShadowTargets represent the formerly shadowing targets. |
3976 bool has_unlinks = false; | 3976 bool has_unlinks = false; |
3977 for (int i = 0; i < shadows.length(); i++) { | 3977 for (int i = 0; i < shadows.length(); i++) { |
3978 shadows[i]->StopShadowing(); | 3978 shadows[i]->StopShadowing(); |
3979 has_unlinks = has_unlinks || shadows[i]->is_linked(); | 3979 has_unlinks = has_unlinks || shadows[i]->is_linked(); |
3980 } | 3980 } |
3981 function_return_is_shadowed_ = function_return_was_shadowed; | 3981 function_return_is_shadowed_ = function_return_was_shadowed; |
3982 | 3982 |
3983 // Get an external reference to the handler address. | 3983 // Get an external reference to the handler address. |
3984 ExternalReference handler_address(Isolate::k_handler_address); | 3984 ExternalReference handler_address(Isolate::k_handler_address, isolate()); |
3985 | 3985 |
3986 // Make sure that there's nothing left on the stack above the | 3986 // Make sure that there's nothing left on the stack above the |
3987 // handler structure. | 3987 // handler structure. |
3988 if (FLAG_debug_code) { | 3988 if (FLAG_debug_code) { |
3989 __ movq(kScratchRegister, handler_address); | 3989 __ movq(kScratchRegister, handler_address); |
3990 __ cmpq(rsp, Operand(kScratchRegister, 0)); | 3990 __ cmpq(rsp, Operand(kScratchRegister, 0)); |
3991 __ Assert(equal, "stack pointer should point to top handler"); | 3991 __ Assert(equal, "stack pointer should point to top handler"); |
3992 } | 3992 } |
3993 | 3993 |
3994 // If we can fall off the end of the try block, unlink from try chain. | 3994 // If we can fall off the end of the try block, unlink from try chain. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4103 // After shadowing stops, the original targets are unshadowed and the | 4103 // After shadowing stops, the original targets are unshadowed and the |
4104 // ShadowTargets represent the formerly shadowing targets. | 4104 // ShadowTargets represent the formerly shadowing targets. |
4105 int nof_unlinks = 0; | 4105 int nof_unlinks = 0; |
4106 for (int i = 0; i < shadows.length(); i++) { | 4106 for (int i = 0; i < shadows.length(); i++) { |
4107 shadows[i]->StopShadowing(); | 4107 shadows[i]->StopShadowing(); |
4108 if (shadows[i]->is_linked()) nof_unlinks++; | 4108 if (shadows[i]->is_linked()) nof_unlinks++; |
4109 } | 4109 } |
4110 function_return_is_shadowed_ = function_return_was_shadowed; | 4110 function_return_is_shadowed_ = function_return_was_shadowed; |
4111 | 4111 |
4112 // Get an external reference to the handler address. | 4112 // Get an external reference to the handler address. |
4113 ExternalReference handler_address(Isolate::k_handler_address); | 4113 ExternalReference handler_address(Isolate::k_handler_address, isolate()); |
4114 | 4114 |
4115 // If we can fall off the end of the try block, unlink from the try | 4115 // If we can fall off the end of the try block, unlink from the try |
4116 // chain and set the state on the frame to FALLING. | 4116 // chain and set the state on the frame to FALLING. |
4117 if (has_valid_frame()) { | 4117 if (has_valid_frame()) { |
4118 // The next handler address is on top of the frame. | 4118 // The next handler address is on top of the frame. |
4119 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 4119 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
4120 __ movq(kScratchRegister, handler_address); | 4120 __ movq(kScratchRegister, handler_address); |
4121 frame_->EmitPop(Operand(kScratchRegister, 0)); | 4121 frame_->EmitPop(Operand(kScratchRegister, 0)); |
4122 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); | 4122 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); |
4123 | 4123 |
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6432 __ bind(&slow_allocate_heapnumber); | 6432 __ bind(&slow_allocate_heapnumber); |
6433 // Allocate a heap number. | 6433 // Allocate a heap number. |
6434 __ CallRuntime(Runtime::kNumberAlloc, 0); | 6434 __ CallRuntime(Runtime::kNumberAlloc, 0); |
6435 __ movq(rbx, rax); | 6435 __ movq(rbx, rax); |
6436 | 6436 |
6437 __ bind(&heapnumber_allocated); | 6437 __ bind(&heapnumber_allocated); |
6438 | 6438 |
6439 // Return a random uint32 number in rax. | 6439 // Return a random uint32 number in rax. |
6440 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 6440 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
6441 __ PrepareCallCFunction(0); | 6441 __ PrepareCallCFunction(0); |
6442 __ CallCFunction(ExternalReference::random_uint32_function(), 0); | 6442 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); |
6443 | 6443 |
6444 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 6444 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
6445 // by computing: | 6445 // by computing: |
6446 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 6446 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
6447 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 6447 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
6448 __ movd(xmm1, rcx); | 6448 __ movd(xmm1, rcx); |
6449 __ movd(xmm0, rax); | 6449 __ movd(xmm0, rax); |
6450 __ cvtss2sd(xmm1, xmm1); | 6450 __ cvtss2sd(xmm1, xmm1); |
6451 __ xorpd(xmm0, xmm1); | 6451 __ xorpd(xmm0, xmm1); |
6452 __ subsd(xmm0, xmm1); | 6452 __ subsd(xmm0, xmm1); |
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8841 } | 8841 } |
8842 | 8842 |
8843 #endif | 8843 #endif |
8844 | 8844 |
8845 | 8845 |
8846 #undef __ | 8846 #undef __ |
8847 | 8847 |
8848 } } // namespace v8::internal | 8848 } } // namespace v8::internal |
8849 | 8849 |
8850 #endif // V8_TARGET_ARCH_X64 | 8850 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |