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 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2660 | 2660 |
2661 // Reload map as register rbx was used as temporary above. | 2661 // Reload map as register rbx was used as temporary above. |
2662 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 2662 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
2663 | 2663 |
2664 // If a valueOf property is not found on the object check that it's | 2664 // If a valueOf property is not found on the object check that it's |
2665 // prototype is the un-modified String prototype. If not result is false. | 2665 // prototype is the un-modified String prototype. If not result is false. |
2666 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 2666 __ movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
2667 __ testq(rcx, Immediate(kSmiTagMask)); | 2667 __ testq(rcx, Immediate(kSmiTagMask)); |
2668 __ j(zero, if_false); | 2668 __ j(zero, if_false); |
2669 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); | 2669 __ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset)); |
2670 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2670 __ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2671 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); | 2671 __ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset)); |
2672 __ cmpq(rcx, | 2672 __ cmpq(rcx, |
2673 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); | 2673 ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX)); |
2674 __ j(not_equal, if_false); | 2674 __ j(not_equal, if_false); |
2675 // Set the bit in the map to indicate that it has been checked safe for | 2675 // Set the bit in the map to indicate that it has been checked safe for |
2676 // default valueOf and set true result. | 2676 // default valueOf and set true result. |
2677 __ or_(FieldOperand(rbx, Map::kBitField2Offset), | 2677 __ or_(FieldOperand(rbx, Map::kBitField2Offset), |
2678 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2678 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2679 __ jmp(if_true); | 2679 __ jmp(if_true); |
2680 | 2680 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 // Allocate a heap number. | 2938 // Allocate a heap number. |
2939 __ CallRuntime(Runtime::kNumberAlloc, 0); | 2939 __ CallRuntime(Runtime::kNumberAlloc, 0); |
2940 __ movq(rbx, rax); | 2940 __ movq(rbx, rax); |
2941 | 2941 |
2942 __ bind(&heapnumber_allocated); | 2942 __ bind(&heapnumber_allocated); |
2943 | 2943 |
2944 // Return a random uint32 number in rax. | 2944 // Return a random uint32 number in rax. |
2945 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. | 2945 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. |
2946 __ PrepareCallCFunction(1); | 2946 __ PrepareCallCFunction(1); |
2947 #ifdef _WIN64 | 2947 #ifdef _WIN64 |
2948 __ movq(rcx, ContextOperand(context_register(), Context::GLOBAL_INDEX)); | 2948 __ movq(rcx, |
| 2949 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
2949 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); | 2950 __ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset)); |
2950 | 2951 |
2951 #else | 2952 #else |
2952 __ movq(rdi, ContextOperand(context_register(), Context::GLOBAL_INDEX)); | 2953 __ movq(rdi, |
| 2954 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
2953 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); | 2955 __ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); |
2954 #endif | 2956 #endif |
2955 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 2957 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
2956 | 2958 |
2957 // Convert 32 random bits in rax to 0.(32 random bits) in a double | 2959 // Convert 32 random bits in rax to 0.(32 random bits) in a double |
2958 // by computing: | 2960 // by computing: |
2959 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 2961 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
2960 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. | 2962 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. |
2961 __ movd(xmm1, rcx); | 2963 __ movd(xmm1, rcx); |
2962 __ movd(xmm0, rax); | 2964 __ movd(xmm0, rax); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3373 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 3375 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
3374 context()->Plug(rax); | 3376 context()->Plug(rax); |
3375 return; | 3377 return; |
3376 } | 3378 } |
3377 | 3379 |
3378 VisitForAccumulatorValue(args->at(1)); | 3380 VisitForAccumulatorValue(args->at(1)); |
3379 | 3381 |
3380 Register key = rax; | 3382 Register key = rax; |
3381 Register cache = rbx; | 3383 Register cache = rbx; |
3382 Register tmp = rcx; | 3384 Register tmp = rcx; |
3383 __ movq(cache, ContextOperand(rsi, Context::GLOBAL_INDEX)); | 3385 __ movq(cache, ContextOperand(rsi, Context::GLOBAL_OBJECT_INDEX)); |
3384 __ movq(cache, | 3386 __ movq(cache, |
3385 FieldOperand(cache, GlobalObject::kNativeContextOffset)); | 3387 FieldOperand(cache, GlobalObject::kNativeContextOffset)); |
3386 __ movq(cache, | 3388 __ movq(cache, |
3387 ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); | 3389 ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX)); |
3388 __ movq(cache, | 3390 __ movq(cache, |
3389 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); | 3391 FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id))); |
3390 | 3392 |
3391 Label done, not_found; | 3393 Label done, not_found; |
3392 // tmp now holds finger offset as a smi. | 3394 // tmp now holds finger offset as a smi. |
3393 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 3395 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4540 *context_length = 0; | 4542 *context_length = 0; |
4541 return previous_; | 4543 return previous_; |
4542 } | 4544 } |
4543 | 4545 |
4544 | 4546 |
4545 #undef __ | 4547 #undef __ |
4546 | 4548 |
4547 } } // namespace v8::internal | 4549 } } // namespace v8::internal |
4548 | 4550 |
4549 #endif // V8_TARGET_ARCH_X64 | 4551 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |