| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); | 466 __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); |
| 467 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 467 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 468 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 468 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
| 469 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 469 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
| 470 __ Move(rcx, api_call_info); | 470 __ Move(rcx, api_call_info); |
| 471 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 471 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
| 472 __ movq(args.GetArgumentOperand(offset - FCA::kDataIndex), rbx); | 472 __ movq(args.GetArgumentOperand(offset - FCA::kDataIndex), rbx); |
| 473 } else { | 473 } else { |
| 474 __ Move(args.GetArgumentOperand(offset - FCA::kDataIndex), call_data); | 474 __ Move(args.GetArgumentOperand(offset - FCA::kDataIndex), call_data); |
| 475 } | 475 } |
| 476 __ movq(kScratchRegister, | 476 __ Move(kScratchRegister, |
| 477 ExternalReference::isolate_address(masm->isolate())); | 477 ExternalReference::isolate_address(masm->isolate())); |
| 478 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), | 478 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), |
| 479 kScratchRegister); | 479 kScratchRegister); |
| 480 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 480 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 481 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), | 481 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), |
| 482 kScratchRegister); | 482 kScratchRegister); |
| 483 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), | 483 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), |
| 484 kScratchRegister); | 484 kScratchRegister); |
| 485 | 485 |
| 486 // Prepare arguments. | 486 // Prepare arguments. |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 | 2286 |
| 2287 // Smi tag and return. | 2287 // Smi tag and return. |
| 2288 __ Integer32ToSmi(rax, rax); | 2288 __ Integer32ToSmi(rax, rax); |
| 2289 __ bind(&smi); | 2289 __ bind(&smi); |
| 2290 __ ret(2 * kPointerSize); | 2290 __ ret(2 * kPointerSize); |
| 2291 | 2291 |
| 2292 // Check if the argument is < 2^kMantissaBits. | 2292 // Check if the argument is < 2^kMantissaBits. |
| 2293 Label already_round; | 2293 Label already_round; |
| 2294 __ bind(&conversion_failure); | 2294 __ bind(&conversion_failure); |
| 2295 int64_t kTwoMantissaBits= V8_INT64_C(0x4330000000000000); | 2295 int64_t kTwoMantissaBits= V8_INT64_C(0x4330000000000000); |
| 2296 __ movq(rbx, kTwoMantissaBits, RelocInfo::NONE64); | 2296 __ movq(rbx, kTwoMantissaBits); |
| 2297 __ movq(xmm1, rbx); | 2297 __ movq(xmm1, rbx); |
| 2298 __ ucomisd(xmm0, xmm1); | 2298 __ ucomisd(xmm0, xmm1); |
| 2299 __ j(above_equal, &already_round); | 2299 __ j(above_equal, &already_round); |
| 2300 | 2300 |
| 2301 // Save a copy of the argument. | 2301 // Save a copy of the argument. |
| 2302 __ movaps(xmm2, xmm0); | 2302 __ movaps(xmm2, xmm0); |
| 2303 | 2303 |
| 2304 // Compute (argument + 2^kMantissaBits) - 2^kMantissaBits. | 2304 // Compute (argument + 2^kMantissaBits) - 2^kMantissaBits. |
| 2305 __ addsd(xmm0, xmm1); | 2305 __ addsd(xmm0, xmm1); |
| 2306 __ subsd(xmm0, xmm1); | 2306 __ subsd(xmm0, xmm1); |
| 2307 | 2307 |
| 2308 // Compare the argument and the tentative result to get the right mask: | 2308 // Compare the argument and the tentative result to get the right mask: |
| 2309 // if xmm2 < xmm0: | 2309 // if xmm2 < xmm0: |
| 2310 // xmm2 = 1...1 | 2310 // xmm2 = 1...1 |
| 2311 // else: | 2311 // else: |
| 2312 // xmm2 = 0...0 | 2312 // xmm2 = 0...0 |
| 2313 __ cmpltsd(xmm2, xmm0); | 2313 __ cmpltsd(xmm2, xmm0); |
| 2314 | 2314 |
| 2315 // Subtract 1 if the argument was less than the tentative result. | 2315 // Subtract 1 if the argument was less than the tentative result. |
| 2316 int64_t kOne = V8_INT64_C(0x3ff0000000000000); | 2316 int64_t kOne = V8_INT64_C(0x3ff0000000000000); |
| 2317 __ movq(rbx, kOne, RelocInfo::NONE64); | 2317 __ movq(rbx, kOne); |
| 2318 __ movq(xmm1, rbx); | 2318 __ movq(xmm1, rbx); |
| 2319 __ andpd(xmm1, xmm2); | 2319 __ andpd(xmm1, xmm2); |
| 2320 __ subsd(xmm0, xmm1); | 2320 __ subsd(xmm0, xmm1); |
| 2321 | 2321 |
| 2322 // Return a new heap number. | 2322 // Return a new heap number. |
| 2323 __ AllocateHeapNumber(rax, rbx, &slow); | 2323 __ AllocateHeapNumber(rax, rbx, &slow); |
| 2324 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); | 2324 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); |
| 2325 __ ret(2 * kPointerSize); | 2325 __ ret(2 * kPointerSize); |
| 2326 | 2326 |
| 2327 // Return the argument (when it's an already round heap number). | 2327 // Return the argument (when it's an already round heap number). |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 // Check if the argument is a heap number and load its value. | 2411 // Check if the argument is a heap number and load its value. |
| 2412 __ bind(¬_smi); | 2412 __ bind(¬_smi); |
| 2413 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); | 2413 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
| 2414 __ MoveDouble(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); | 2414 __ MoveDouble(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); |
| 2415 | 2415 |
| 2416 // Check the sign of the argument. If the argument is positive, | 2416 // Check the sign of the argument. If the argument is positive, |
| 2417 // just return it. | 2417 // just return it. |
| 2418 Label negative_sign; | 2418 Label negative_sign; |
| 2419 const int sign_mask_shift = | 2419 const int sign_mask_shift = |
| 2420 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; | 2420 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; |
| 2421 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, | 2421 __ Set(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift); |
| 2422 RelocInfo::NONE64); | |
| 2423 __ testq(rbx, rdi); | 2422 __ testq(rbx, rdi); |
| 2424 __ j(not_zero, &negative_sign); | 2423 __ j(not_zero, &negative_sign); |
| 2425 __ ret(2 * kPointerSize); | 2424 __ ret(2 * kPointerSize); |
| 2426 | 2425 |
| 2427 // If the argument is negative, clear the sign, and return a new | 2426 // If the argument is negative, clear the sign, and return a new |
| 2428 // number. We still have the sign mask in rdi. | 2427 // number. We still have the sign mask in rdi. |
| 2429 __ bind(&negative_sign); | 2428 __ bind(&negative_sign); |
| 2430 __ xor_(rbx, rdi); | 2429 __ xor_(rbx, rdi); |
| 2431 __ AllocateHeapNumber(rax, rdx, &slow); | 2430 __ AllocateHeapNumber(rax, rdx, &slow); |
| 2432 __ MoveDouble(FieldOperand(rax, HeapNumber::kValueOffset), rbx); | 2431 __ MoveDouble(FieldOperand(rax, HeapNumber::kValueOffset), rbx); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 3029 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
| 3031 Handle<JSObject> object, | 3030 Handle<JSObject> object, |
| 3032 Handle<GlobalObject> global, | 3031 Handle<GlobalObject> global, |
| 3033 Handle<PropertyCell> cell, | 3032 Handle<PropertyCell> cell, |
| 3034 Handle<Name> name, | 3033 Handle<Name> name, |
| 3035 bool is_dont_delete) { | 3034 bool is_dont_delete) { |
| 3036 Label success, miss; | 3035 Label success, miss; |
| 3037 // TODO(verwaest): Directly store to rax. Currently we cannot do this, since | 3036 // TODO(verwaest): Directly store to rax. Currently we cannot do this, since |
| 3038 // rax is used as receiver(), which we would otherwise clobber before a | 3037 // rax is used as receiver(), which we would otherwise clobber before a |
| 3039 // potential miss. | 3038 // potential miss. |
| 3040 | 3039 HandlerFrontendHeader(object, receiver(), global, name, &miss); |
| 3041 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); | |
| 3042 HandlerFrontendHeader( | |
| 3043 object, receiver(), Handle<JSObject>::cast(global), name, &miss); | |
| 3044 | 3040 |
| 3045 // Get the value from the cell. | 3041 // Get the value from the cell. |
| 3046 __ Move(rbx, cell); | 3042 __ Move(rbx, cell); |
| 3047 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); | 3043 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); |
| 3048 | 3044 |
| 3049 // Check for deleted property if property can actually be deleted. | 3045 // Check for deleted property if property can actually be deleted. |
| 3050 if (!is_dont_delete) { | 3046 if (!is_dont_delete) { |
| 3051 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 3047 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 3052 __ j(equal, &miss); | 3048 __ j(equal, &miss); |
| 3053 } else if (FLAG_debug_code) { | 3049 } else if (FLAG_debug_code) { |
| 3054 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 3050 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 3055 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); | 3051 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); |
| 3056 } | 3052 } |
| 3057 | 3053 |
| 3058 HandlerFrontendFooter(name, &success, &miss); | 3054 HandlerFrontendFooter(name, &success, &miss); |
| 3059 __ bind(&success); | 3055 __ bind(&success); |
| 3060 | 3056 |
| 3061 Counters* counters = isolate()->counters(); | 3057 Counters* counters = isolate()->counters(); |
| 3062 __ IncrementCounter(counters->named_load_global_stub(), 1); | 3058 __ IncrementCounter(counters->named_load_global_stub(), 1); |
| 3063 __ movq(rax, rbx); | 3059 __ movq(rax, rbx); |
| 3064 __ ret(0); | 3060 __ ret(0); |
| 3065 | 3061 |
| 3066 // Return the generated code. | 3062 // Return the generated code. |
| 3067 return GetICCode(kind(), Code::NORMAL, name); | 3063 return GetCode(kind(), Code::NORMAL, name); |
| 3068 } | 3064 } |
| 3069 | 3065 |
| 3070 | 3066 |
| 3071 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( | 3067 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( |
| 3072 MapHandleList* receiver_maps, | 3068 MapHandleList* receiver_maps, |
| 3073 CodeHandleList* handlers, | 3069 CodeHandleList* handlers, |
| 3074 Handle<Name> name, | 3070 Handle<Name> name, |
| 3075 Code::StubType type, | 3071 Code::StubType type, |
| 3076 IcCheckType check) { | 3072 IcCheckType check) { |
| 3077 Label miss; | 3073 Label miss; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 // ----------------------------------- | 3146 // ----------------------------------- |
| 3151 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3147 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3152 } | 3148 } |
| 3153 | 3149 |
| 3154 | 3150 |
| 3155 #undef __ | 3151 #undef __ |
| 3156 | 3152 |
| 3157 } } // namespace v8::internal | 3153 } } // namespace v8::internal |
| 3158 | 3154 |
| 3159 #endif // V8_TARGET_ARCH_X64 | 3155 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |