OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2994 __ bind(&slow_allocate_heapnumber); | 2994 __ bind(&slow_allocate_heapnumber); |
2995 // Allocate a heap number. | 2995 // Allocate a heap number. |
2996 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2996 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2997 __ movq(rbx, rax); | 2997 __ movq(rbx, rax); |
2998 | 2998 |
2999 __ bind(&heapnumber_allocated); | 2999 __ bind(&heapnumber_allocated); |
3000 | 3000 |
3001 // Return a random uint32 number in rax. | 3001 // Return a random uint32 number in rax. |
3002 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 3002 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
3003 __ PrepareCallCFunction(1); | 3003 __ PrepareCallCFunction(1); |
3004 #ifdef _WIN64 | 3004 __ movq(arg_reg_1, |
3005 __ movq(rcx, | |
3006 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | 3005 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
3007 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); | 3006 __ movq(arg_reg_1, |
3008 | 3007 FieldOperand(arg_reg_1, GlobalObject::kNativeContextOffset)); |
3009 #else | |
3010 __ movq(rdi, | |
3011 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | |
3012 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); | |
3013 #endif | |
3014 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3008 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3015 | 3009 |
3016 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 3010 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
3017 // by computing: | 3011 // by computing: |
3018 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3012 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3019 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 3013 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
3020 __ movd(xmm1, rcx); | 3014 __ movd(xmm1, rcx); |
3021 __ movd(xmm0, rax); | 3015 __ movd(xmm0, rax); |
3022 __ cvtss2sd(xmm1, xmm1); | 3016 __ cvtss2sd(xmm1, xmm1); |
3023 __ xorps(xmm0, xmm1); | 3017 __ xorps(xmm0, xmm1); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3101 Operand stamp_operand = __ ExternalOperand(stamp); | 3095 Operand stamp_operand = __ ExternalOperand(stamp); |
3102 __ movq(scratch, stamp_operand); | 3096 __ movq(scratch, stamp_operand); |
3103 __ cmpq(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); | 3097 __ cmpq(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
3104 __ j(not_equal, &runtime, Label::kNear); | 3098 __ j(not_equal, &runtime, Label::kNear); |
3105 __ movq(result, FieldOperand(object, JSDate::kValueOffset + | 3099 __ movq(result, FieldOperand(object, JSDate::kValueOffset + |
3106 kPointerSize * index->value())); | 3100 kPointerSize * index->value())); |
3107 __ jmp(&done); | 3101 __ jmp(&done); |
3108 } | 3102 } |
3109 __ bind(&runtime); | 3103 __ bind(&runtime); |
3110 __ PrepareCallCFunction(2); | 3104 __ PrepareCallCFunction(2); |
3111 #ifdef _WIN64 | 3105 __ movq(arg_reg_1, object); |
3112 __ movq(rcx, object); | 3106 __ movq(arg_reg_2, index, RelocInfo::NONE64); |
3113 __ movq(rdx, index, RelocInfo::NONE64); | |
3114 #else | |
3115 __ movq(rdi, object); | |
3116 __ movq(rsi, index, RelocInfo::NONE64); | |
3117 #endif | |
3118 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 3107 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
3119 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3108 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3120 __ jmp(&done); | 3109 __ jmp(&done); |
3121 } | 3110 } |
3122 | 3111 |
3123 __ bind(¬_date_object); | 3112 __ bind(¬_date_object); |
3124 __ CallRuntime(Runtime::kThrowNotDateError, 0); | 3113 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
3125 __ bind(&done); | 3114 __ bind(&done); |
3126 context()->Plug(rax); | 3115 context()->Plug(rax); |
3127 } | 3116 } |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4601 *context_length = 0; | 4590 *context_length = 0; |
4602 return previous_; | 4591 return previous_; |
4603 } | 4592 } |
4604 | 4593 |
4605 | 4594 |
4606 #undef __ | 4595 #undef __ |
4607 | 4596 |
4608 } } // namespace v8::internal | 4597 } } // namespace v8::internal |
4609 | 4598 |
4610 #endif // V8_TARGET_ARCH_X64 | 4599 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |