| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 // Jump to the first instruction in the code stub. | 102 // Jump to the first instruction in the code stub. |
| 103 __ addq(kScratchRegister, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 103 __ addq(kScratchRegister, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 104 __ jmp(kScratchRegister); | 104 __ jmp(kScratchRegister); |
| 105 | 105 |
| 106 __ bind(&miss); | 106 __ bind(&miss); |
| 107 } | 107 } |
| 108 | 108 |
| 109 | 109 |
| 110 // Helper function used to check that the dictionary doesn't contain | 110 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm, |
| 111 // the property. This function may return false negatives, so miss_label | 111 Label* miss_label, |
| 112 // must always call a backup property check that is complete. | 112 Register receiver, |
| 113 // This function is safe to call if the receiver has fast properties. | 113 Handle<Name> name, |
| 114 // Name must be unique and receiver must be a heap object. | 114 Register scratch0, |
| 115 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, | 115 Register scratch1) { |
| 116 Label* miss_label, | |
| 117 Register receiver, | |
| 118 Handle<Name> name, | |
| 119 Register r0, | |
| 120 Register r1) { | |
| 121 ASSERT(name->IsUniqueName()); | 116 ASSERT(name->IsUniqueName()); |
| 117 ASSERT(!receiver.is(scratch0)); |
| 122 Counters* counters = masm->isolate()->counters(); | 118 Counters* counters = masm->isolate()->counters(); |
| 123 __ IncrementCounter(counters->negative_lookups(), 1); | 119 __ IncrementCounter(counters->negative_lookups(), 1); |
| 124 __ IncrementCounter(counters->negative_lookups_miss(), 1); | 120 __ IncrementCounter(counters->negative_lookups_miss(), 1); |
| 125 | 121 |
| 126 __ movq(r0, FieldOperand(receiver, HeapObject::kMapOffset)); | 122 __ movq(scratch0, FieldOperand(receiver, HeapObject::kMapOffset)); |
| 127 | 123 |
| 128 const int kInterceptorOrAccessCheckNeededMask = | 124 const int kInterceptorOrAccessCheckNeededMask = |
| 129 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); | 125 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); |
| 130 | 126 |
| 131 // Bail out if the receiver has a named interceptor or requires access checks. | 127 // Bail out if the receiver has a named interceptor or requires access checks. |
| 132 __ testb(FieldOperand(r0, Map::kBitFieldOffset), | 128 __ testb(FieldOperand(scratch0, Map::kBitFieldOffset), |
| 133 Immediate(kInterceptorOrAccessCheckNeededMask)); | 129 Immediate(kInterceptorOrAccessCheckNeededMask)); |
| 134 __ j(not_zero, miss_label); | 130 __ j(not_zero, miss_label); |
| 135 | 131 |
| 136 // Check that receiver is a JSObject. | 132 // Check that receiver is a JSObject. |
| 137 __ CmpInstanceType(r0, FIRST_SPEC_OBJECT_TYPE); | 133 __ CmpInstanceType(scratch0, FIRST_SPEC_OBJECT_TYPE); |
| 138 __ j(below, miss_label); | 134 __ j(below, miss_label); |
| 139 | 135 |
| 140 // Load properties array. | 136 // Load properties array. |
| 141 Register properties = r0; | 137 Register properties = scratch0; |
| 142 __ movq(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 138 __ movq(properties, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
| 143 | 139 |
| 144 // Check that the properties array is a dictionary. | 140 // Check that the properties array is a dictionary. |
| 145 __ CompareRoot(FieldOperand(properties, HeapObject::kMapOffset), | 141 __ CompareRoot(FieldOperand(properties, HeapObject::kMapOffset), |
| 146 Heap::kHashTableMapRootIndex); | 142 Heap::kHashTableMapRootIndex); |
| 147 __ j(not_equal, miss_label); | 143 __ j(not_equal, miss_label); |
| 148 | 144 |
| 149 Label done; | 145 Label done; |
| 150 NameDictionaryLookupStub::GenerateNegativeLookup(masm, | 146 NameDictionaryLookupStub::GenerateNegativeLookup(masm, |
| 151 miss_label, | 147 miss_label, |
| 152 &done, | 148 &done, |
| 153 properties, | 149 properties, |
| 154 name, | 150 name, |
| 155 r1); | 151 scratch1); |
| 156 __ bind(&done); | 152 __ bind(&done); |
| 157 __ DecrementCounter(counters->negative_lookups_miss(), 1); | 153 __ DecrementCounter(counters->negative_lookups_miss(), 1); |
| 158 } | 154 } |
| 159 | 155 |
| 160 | 156 |
| 161 void StubCache::GenerateProbe(MacroAssembler* masm, | 157 void StubCache::GenerateProbe(MacroAssembler* masm, |
| 162 Code::Flags flags, | 158 Code::Flags flags, |
| 163 Register receiver, | 159 Register receiver, |
| 164 Register name, | 160 Register name, |
| 165 Register scratch, | 161 Register scratch, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); | 466 __ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi); |
| 471 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 467 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 472 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 468 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
| 473 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 469 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
| 474 __ Move(rcx, api_call_info); | 470 __ Move(rcx, api_call_info); |
| 475 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 471 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
| 476 __ movq(args.GetArgumentOperand(offset - FCA::kDataIndex), rbx); | 472 __ movq(args.GetArgumentOperand(offset - FCA::kDataIndex), rbx); |
| 477 } else { | 473 } else { |
| 478 __ Move(args.GetArgumentOperand(offset - FCA::kDataIndex), call_data); | 474 __ Move(args.GetArgumentOperand(offset - FCA::kDataIndex), call_data); |
| 479 } | 475 } |
| 480 __ movq(kScratchRegister, | 476 __ Move(kScratchRegister, |
| 481 ExternalReference::isolate_address(masm->isolate())); | 477 ExternalReference::isolate_address(masm->isolate())); |
| 482 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), | 478 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), |
| 483 kScratchRegister); | 479 kScratchRegister); |
| 484 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 480 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
| 485 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), | 481 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), |
| 486 kScratchRegister); | 482 kScratchRegister); |
| 487 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), | 483 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), |
| 488 kScratchRegister); | 484 kScratchRegister); |
| 489 | 485 |
| 490 // Prepare arguments. | 486 // Prepare arguments. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, | 766 void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, |
| 771 Label* label, | 767 Label* label, |
| 772 Handle<Name> name) { | 768 Handle<Name> name) { |
| 773 if (!label->is_unused()) { | 769 if (!label->is_unused()) { |
| 774 __ bind(label); | 770 __ bind(label); |
| 775 __ Move(this->name(), name); | 771 __ Move(this->name(), name); |
| 776 } | 772 } |
| 777 } | 773 } |
| 778 | 774 |
| 779 | 775 |
| 780 // Generate code to check that a global property cell is empty. Create | 776 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm, |
| 781 // the property cell at compilation time if no cell exists for the | 777 Handle<JSGlobalObject> global, |
| 782 // property. | 778 Handle<Name> name, |
| 783 static void GenerateCheckPropertyCell(MacroAssembler* masm, | 779 Register scratch, |
| 784 Handle<GlobalObject> global, | 780 Label* miss) { |
| 785 Handle<Name> name, | |
| 786 Register scratch, | |
| 787 Label* miss) { | |
| 788 Handle<PropertyCell> cell = | 781 Handle<PropertyCell> cell = |
| 789 GlobalObject::EnsurePropertyCell(global, name); | 782 JSGlobalObject::EnsurePropertyCell(global, name); |
| 790 ASSERT(cell->value()->IsTheHole()); | 783 ASSERT(cell->value()->IsTheHole()); |
| 791 __ Move(scratch, cell); | 784 __ Move(scratch, cell); |
| 792 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), | 785 __ Cmp(FieldOperand(scratch, Cell::kValueOffset), |
| 793 masm->isolate()->factory()->the_hole_value()); | 786 masm->isolate()->factory()->the_hole_value()); |
| 794 __ j(not_equal, miss); | 787 __ j(not_equal, miss); |
| 795 } | 788 } |
| 796 | 789 |
| 797 | 790 |
| 798 void StoreStubCompiler::GenerateNegativeHolderLookup( | 791 void StoreStubCompiler::GenerateNegativeHolderLookup( |
| 799 MacroAssembler* masm, | 792 MacroAssembler* masm, |
| 800 Handle<JSObject> holder, | 793 Handle<JSObject> holder, |
| 801 Register holder_reg, | 794 Register holder_reg, |
| 802 Handle<Name> name, | 795 Handle<Name> name, |
| 803 Label* miss) { | 796 Label* miss) { |
| 804 if (holder->IsJSGlobalObject()) { | 797 if (holder->IsJSGlobalObject()) { |
| 805 GenerateCheckPropertyCell( | 798 GenerateCheckPropertyCell( |
| 806 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); | 799 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss); |
| 807 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { | 800 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { |
| 808 GenerateDictionaryNegativeLookup( | 801 GenerateDictionaryNegativeLookup( |
| 809 masm, miss, holder_reg, name, scratch1(), scratch2()); | 802 masm, miss, holder_reg, name, scratch1(), scratch2()); |
| 810 } | 803 } |
| 811 } | 804 } |
| 812 | 805 |
| 813 | 806 |
| 814 // Receiver_reg is preserved on jumps to miss_label, but may be destroyed if | 807 // Receiver_reg is preserved on jumps to miss_label, but may be destroyed if |
| 815 // store is successful. | 808 // store is successful. |
| 816 void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, | 809 void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 EMIT_REMEMBERED_SET, smi_check); | 1040 EMIT_REMEMBERED_SET, smi_check); |
| 1048 } | 1041 } |
| 1049 } | 1042 } |
| 1050 | 1043 |
| 1051 // Return the value (register rax). | 1044 // Return the value (register rax). |
| 1052 ASSERT(value_reg.is(rax)); | 1045 ASSERT(value_reg.is(rax)); |
| 1053 __ ret(0); | 1046 __ ret(0); |
| 1054 } | 1047 } |
| 1055 | 1048 |
| 1056 | 1049 |
| 1057 // Calls GenerateCheckPropertyCell for each global object in the prototype chain | 1050 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm, |
| 1058 // from object to (but not including) holder. | 1051 Handle<JSObject> object, |
| 1059 static void GenerateCheckPropertyCells(MacroAssembler* masm, | 1052 Handle<JSObject> holder, |
| 1060 Handle<JSObject> object, | 1053 Handle<Name> name, |
| 1061 Handle<JSObject> holder, | 1054 Register scratch, |
| 1062 Handle<Name> name, | 1055 Label* miss) { |
| 1063 Register scratch, | |
| 1064 Label* miss) { | |
| 1065 Handle<JSObject> current = object; | 1056 Handle<JSObject> current = object; |
| 1066 while (!current.is_identical_to(holder)) { | 1057 while (!current.is_identical_to(holder)) { |
| 1067 if (current->IsGlobalObject()) { | 1058 if (current->IsJSGlobalObject()) { |
| 1068 GenerateCheckPropertyCell(masm, | 1059 GenerateCheckPropertyCell(masm, |
| 1069 Handle<GlobalObject>::cast(current), | 1060 Handle<JSGlobalObject>::cast(current), |
| 1070 name, | 1061 name, |
| 1071 scratch, | 1062 scratch, |
| 1072 miss); | 1063 miss); |
| 1073 } | 1064 } |
| 1074 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); | 1065 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); |
| 1075 } | 1066 } |
| 1076 } | 1067 } |
| 1077 | 1068 |
| 1078 | 1069 |
| 1079 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { | 1070 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 __ movq(scratch3(), callback, RelocInfo::EMBEDDED_OBJECT); | 1266 __ movq(scratch3(), callback, RelocInfo::EMBEDDED_OBJECT); |
| 1276 __ cmpq(scratch2(), scratch3()); | 1267 __ cmpq(scratch2(), scratch3()); |
| 1277 __ j(not_equal, &miss); | 1268 __ j(not_equal, &miss); |
| 1278 } | 1269 } |
| 1279 | 1270 |
| 1280 HandlerFrontendFooter(name, success, &miss); | 1271 HandlerFrontendFooter(name, success, &miss); |
| 1281 return reg; | 1272 return reg; |
| 1282 } | 1273 } |
| 1283 | 1274 |
| 1284 | 1275 |
| 1285 void LoadStubCompiler::NonexistentHandlerFrontend( | |
| 1286 Handle<JSObject> object, | |
| 1287 Handle<JSObject> last, | |
| 1288 Handle<Name> name, | |
| 1289 Label* success, | |
| 1290 Handle<GlobalObject> global) { | |
| 1291 Label miss; | |
| 1292 | |
| 1293 HandlerFrontendHeader(object, receiver(), last, name, &miss); | |
| 1294 | |
| 1295 // If the last object in the prototype chain is a global object, | |
| 1296 // check that the global property cell is empty. | |
| 1297 if (!global.is_null()) { | |
| 1298 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss); | |
| 1299 } | |
| 1300 | |
| 1301 HandlerFrontendFooter(name, success, &miss); | |
| 1302 } | |
| 1303 | |
| 1304 | |
| 1305 void LoadStubCompiler::GenerateLoadField(Register reg, | 1276 void LoadStubCompiler::GenerateLoadField(Register reg, |
| 1306 Handle<JSObject> holder, | 1277 Handle<JSObject> holder, |
| 1307 PropertyIndex field, | 1278 PropertyIndex field, |
| 1308 Representation representation) { | 1279 Representation representation) { |
| 1309 if (!reg.is(receiver())) __ movq(receiver(), reg); | 1280 if (!reg.is(receiver())) __ movq(receiver(), reg); |
| 1310 if (kind() == Code::LOAD_IC) { | 1281 if (kind() == Code::LOAD_IC) { |
| 1311 LoadFieldStub stub(field.is_inobject(holder), | 1282 LoadFieldStub stub(field.is_inobject(holder), |
| 1312 field.translate(holder), | 1283 field.translate(holder), |
| 1313 representation); | 1284 representation); |
| 1314 GenerateTailCall(masm(), stub.GetCode(isolate())); | 1285 GenerateTailCall(masm(), stub.GetCode(isolate())); |
| 1315 } else { | 1286 } else { |
| 1316 KeyedLoadFieldStub stub(field.is_inobject(holder), | 1287 KeyedLoadFieldStub stub(field.is_inobject(holder), |
| 1317 field.translate(holder), | 1288 field.translate(holder), |
| 1318 representation); | 1289 representation); |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2315 | 2286 |
| 2316 // Smi tag and return. | 2287 // Smi tag and return. |
| 2317 __ Integer32ToSmi(rax, rax); | 2288 __ Integer32ToSmi(rax, rax); |
| 2318 __ bind(&smi); | 2289 __ bind(&smi); |
| 2319 __ ret(2 * kPointerSize); | 2290 __ ret(2 * kPointerSize); |
| 2320 | 2291 |
| 2321 // Check if the argument is < 2^kMantissaBits. | 2292 // Check if the argument is < 2^kMantissaBits. |
| 2322 Label already_round; | 2293 Label already_round; |
| 2323 __ bind(&conversion_failure); | 2294 __ bind(&conversion_failure); |
| 2324 int64_t kTwoMantissaBits= V8_INT64_C(0x4330000000000000); | 2295 int64_t kTwoMantissaBits= V8_INT64_C(0x4330000000000000); |
| 2325 __ movq(rbx, kTwoMantissaBits, RelocInfo::NONE64); | 2296 __ movq(rbx, kTwoMantissaBits); |
| 2326 __ movq(xmm1, rbx); | 2297 __ movq(xmm1, rbx); |
| 2327 __ ucomisd(xmm0, xmm1); | 2298 __ ucomisd(xmm0, xmm1); |
| 2328 __ j(above_equal, &already_round); | 2299 __ j(above_equal, &already_round); |
| 2329 | 2300 |
| 2330 // Save a copy of the argument. | 2301 // Save a copy of the argument. |
| 2331 __ movaps(xmm2, xmm0); | 2302 __ movaps(xmm2, xmm0); |
| 2332 | 2303 |
| 2333 // Compute (argument + 2^kMantissaBits) - 2^kMantissaBits. | 2304 // Compute (argument + 2^kMantissaBits) - 2^kMantissaBits. |
| 2334 __ addsd(xmm0, xmm1); | 2305 __ addsd(xmm0, xmm1); |
| 2335 __ subsd(xmm0, xmm1); | 2306 __ subsd(xmm0, xmm1); |
| 2336 | 2307 |
| 2337 // 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: |
| 2338 // if xmm2 < xmm0: | 2309 // if xmm2 < xmm0: |
| 2339 // xmm2 = 1...1 | 2310 // xmm2 = 1...1 |
| 2340 // else: | 2311 // else: |
| 2341 // xmm2 = 0...0 | 2312 // xmm2 = 0...0 |
| 2342 __ cmpltsd(xmm2, xmm0); | 2313 __ cmpltsd(xmm2, xmm0); |
| 2343 | 2314 |
| 2344 // Subtract 1 if the argument was less than the tentative result. | 2315 // Subtract 1 if the argument was less than the tentative result. |
| 2345 int64_t kOne = V8_INT64_C(0x3ff0000000000000); | 2316 int64_t kOne = V8_INT64_C(0x3ff0000000000000); |
| 2346 __ movq(rbx, kOne, RelocInfo::NONE64); | 2317 __ movq(rbx, kOne); |
| 2347 __ movq(xmm1, rbx); | 2318 __ movq(xmm1, rbx); |
| 2348 __ andpd(xmm1, xmm2); | 2319 __ andpd(xmm1, xmm2); |
| 2349 __ subsd(xmm0, xmm1); | 2320 __ subsd(xmm0, xmm1); |
| 2350 | 2321 |
| 2351 // Return a new heap number. | 2322 // Return a new heap number. |
| 2352 __ AllocateHeapNumber(rax, rbx, &slow); | 2323 __ AllocateHeapNumber(rax, rbx, &slow); |
| 2353 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); | 2324 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), xmm0); |
| 2354 __ ret(2 * kPointerSize); | 2325 __ ret(2 * kPointerSize); |
| 2355 | 2326 |
| 2356 // Return the argument (when it's an already round heap number). | 2327 // Return the argument (when it's an already round heap number). |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 // If the result is still negative, go to the slow case. | 2404 // If the result is still negative, go to the slow case. |
| 2434 // This only happens for the most negative smi. | 2405 // This only happens for the most negative smi. |
| 2435 Label slow; | 2406 Label slow; |
| 2436 __ j(negative, &slow); | 2407 __ j(negative, &slow); |
| 2437 | 2408 |
| 2438 __ ret(2 * kPointerSize); | 2409 __ ret(2 * kPointerSize); |
| 2439 | 2410 |
| 2440 // 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. |
| 2441 __ bind(¬_smi); | 2412 __ bind(¬_smi); |
| 2442 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); | 2413 __ CheckMap(rax, factory()->heap_number_map(), &slow, DONT_DO_SMI_CHECK); |
| 2443 __ movq(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); | 2414 __ MoveDouble(rbx, FieldOperand(rax, HeapNumber::kValueOffset)); |
| 2444 | 2415 |
| 2445 // Check the sign of the argument. If the argument is positive, | 2416 // Check the sign of the argument. If the argument is positive, |
| 2446 // just return it. | 2417 // just return it. |
| 2447 Label negative_sign; | 2418 Label negative_sign; |
| 2448 const int sign_mask_shift = | 2419 const int sign_mask_shift = |
| 2449 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; | 2420 (HeapNumber::kExponentOffset - HeapNumber::kValueOffset) * kBitsPerByte; |
| 2450 __ movq(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift, | 2421 __ Set(rdi, static_cast<int64_t>(HeapNumber::kSignMask) << sign_mask_shift); |
| 2451 RelocInfo::NONE64); | |
| 2452 __ testq(rbx, rdi); | 2422 __ testq(rbx, rdi); |
| 2453 __ j(not_zero, &negative_sign); | 2423 __ j(not_zero, &negative_sign); |
| 2454 __ ret(2 * kPointerSize); | 2424 __ ret(2 * kPointerSize); |
| 2455 | 2425 |
| 2456 // 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 |
| 2457 // number. We still have the sign mask in rdi. | 2427 // number. We still have the sign mask in rdi. |
| 2458 __ bind(&negative_sign); | 2428 __ bind(&negative_sign); |
| 2459 __ xor_(rbx, rdi); | 2429 __ xor_(rbx, rdi); |
| 2460 __ AllocateHeapNumber(rax, rdx, &slow); | 2430 __ AllocateHeapNumber(rax, rdx, &slow); |
| 2461 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); | 2431 __ MoveDouble(FieldOperand(rax, HeapNumber::kValueOffset), rbx); |
| 2462 __ ret(2 * kPointerSize); | 2432 __ ret(2 * kPointerSize); |
| 2463 | 2433 |
| 2464 // Tail call the full function. We do not have to patch the receiver | 2434 // Tail call the full function. We do not have to patch the receiver |
| 2465 // because the function makes no use of it. | 2435 // because the function makes no use of it. |
| 2466 __ bind(&slow); | 2436 __ bind(&slow); |
| 2467 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) | 2437 CallKind call_kind = CallICBase::Contextual::decode(extra_state_) |
| 2468 ? CALL_AS_FUNCTION | 2438 ? CALL_AS_FUNCTION |
| 2469 : CALL_AS_METHOD; | 2439 : CALL_AS_METHOD; |
| 2470 ParameterCount expected(function); | 2440 ParameterCount expected(function); |
| 2471 __ InvokeFunction(function, expected, arguments(), | 2441 __ InvokeFunction(function, expected, arguments(), |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 // Return the generated code. | 2920 // Return the generated code. |
| 2951 return GetICCode( | 2921 return GetICCode( |
| 2952 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 2922 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
| 2953 } | 2923 } |
| 2954 | 2924 |
| 2955 | 2925 |
| 2956 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( | 2926 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( |
| 2957 Handle<JSObject> object, | 2927 Handle<JSObject> object, |
| 2958 Handle<JSObject> last, | 2928 Handle<JSObject> last, |
| 2959 Handle<Name> name, | 2929 Handle<Name> name, |
| 2960 Handle<GlobalObject> global) { | 2930 Handle<JSGlobalObject> global) { |
| 2961 Label success; | 2931 Label success; |
| 2962 | 2932 |
| 2963 NonexistentHandlerFrontend(object, last, name, &success, global); | 2933 NonexistentHandlerFrontend(object, last, name, &success, global); |
| 2964 | 2934 |
| 2965 __ bind(&success); | 2935 __ bind(&success); |
| 2966 // Return undefined if maps of the full prototype chain are still the | 2936 // Return undefined if maps of the full prototype chain are still the |
| 2967 // same and no global property with this name contains a value. | 2937 // same and no global property with this name contains a value. |
| 2968 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 2938 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 2969 __ ret(0); | 2939 __ ret(0); |
| 2970 | 2940 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3059 Handle<Code> LoadStubCompiler::CompileLoadGlobal( | 3029 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
| 3060 Handle<JSObject> object, | 3030 Handle<JSObject> object, |
| 3061 Handle<GlobalObject> global, | 3031 Handle<GlobalObject> global, |
| 3062 Handle<PropertyCell> cell, | 3032 Handle<PropertyCell> cell, |
| 3063 Handle<Name> name, | 3033 Handle<Name> name, |
| 3064 bool is_dont_delete) { | 3034 bool is_dont_delete) { |
| 3065 Label success, miss; | 3035 Label success, miss; |
| 3066 // 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 |
| 3067 // 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 |
| 3068 // potential miss. | 3038 // potential miss. |
| 3069 | 3039 HandlerFrontendHeader(object, receiver(), global, name, &miss); |
| 3070 __ CheckMap(receiver(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK); | |
| 3071 HandlerFrontendHeader( | |
| 3072 object, receiver(), Handle<JSObject>::cast(global), name, &miss); | |
| 3073 | 3040 |
| 3074 // Get the value from the cell. | 3041 // Get the value from the cell. |
| 3075 __ Move(rbx, cell); | 3042 __ Move(rbx, cell); |
| 3076 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); | 3043 __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset)); |
| 3077 | 3044 |
| 3078 // Check for deleted property if property can actually be deleted. | 3045 // Check for deleted property if property can actually be deleted. |
| 3079 if (!is_dont_delete) { | 3046 if (!is_dont_delete) { |
| 3080 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 3047 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 3081 __ j(equal, &miss); | 3048 __ j(equal, &miss); |
| 3082 } else if (FLAG_debug_code) { | 3049 } else if (FLAG_debug_code) { |
| 3083 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); | 3050 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
| 3084 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); | 3051 __ Check(not_equal, kDontDeleteCellsCannotContainTheHole); |
| 3085 } | 3052 } |
| 3086 | 3053 |
| 3087 HandlerFrontendFooter(name, &success, &miss); | 3054 HandlerFrontendFooter(name, &success, &miss); |
| 3088 __ bind(&success); | 3055 __ bind(&success); |
| 3089 | 3056 |
| 3090 Counters* counters = isolate()->counters(); | 3057 Counters* counters = isolate()->counters(); |
| 3091 __ IncrementCounter(counters->named_load_global_stub(), 1); | 3058 __ IncrementCounter(counters->named_load_global_stub(), 1); |
| 3092 __ movq(rax, rbx); | 3059 __ movq(rax, rbx); |
| 3093 __ ret(0); | 3060 __ ret(0); |
| 3094 | 3061 |
| 3095 // Return the generated code. | 3062 // Return the generated code. |
| 3096 return GetICCode(kind(), Code::NORMAL, name); | 3063 return GetCode(kind(), Code::NORMAL, name); |
| 3097 } | 3064 } |
| 3098 | 3065 |
| 3099 | 3066 |
| 3100 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( | 3067 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( |
| 3101 MapHandleList* receiver_maps, | 3068 MapHandleList* receiver_maps, |
| 3102 CodeHandleList* handlers, | 3069 CodeHandleList* handlers, |
| 3103 Handle<Name> name, | 3070 Handle<Name> name, |
| 3104 Code::StubType type, | 3071 Code::StubType type, |
| 3105 IcCheckType check) { | 3072 IcCheckType check) { |
| 3106 Label miss; | 3073 Label miss; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3179 // ----------------------------------- | 3146 // ----------------------------------- |
| 3180 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3147 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3181 } | 3148 } |
| 3182 | 3149 |
| 3183 | 3150 |
| 3184 #undef __ | 3151 #undef __ |
| 3185 | 3152 |
| 3186 } } // namespace v8::internal | 3153 } } // namespace v8::internal |
| 3187 | 3154 |
| 3188 #endif // V8_TARGET_ARCH_X64 | 3155 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |