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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 | 389 |
390 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, | 390 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, |
391 Register receiver, | 391 Register receiver, |
392 Register holder, | 392 Register holder, |
393 Register name, | 393 Register name, |
394 JSObject* holder_obj) { | 394 JSObject* holder_obj) { |
395 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 395 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
396 | 396 |
397 ExternalReference ref = | 397 ExternalReference ref = |
398 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)); | 398 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), |
| 399 masm->isolate()); |
399 __ movq(rax, Immediate(5)); | 400 __ movq(rax, Immediate(5)); |
400 __ movq(rbx, ref); | 401 __ movq(rbx, ref); |
401 | 402 |
402 CEntryStub stub(1); | 403 CEntryStub stub(1); |
403 __ CallStub(&stub); | 404 __ CallStub(&stub); |
404 } | 405 } |
405 | 406 |
406 | 407 |
407 // Number of pointers to be reserved on stack for fast API call. | 408 // Number of pointers to be reserved on stack for fast API call. |
408 static const int kFastApiCallArguments = 3; | 409 static const int kFastApiCallArguments = 3; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 // Save the name_ register across the call. | 685 // Save the name_ register across the call. |
685 __ push(name_); | 686 __ push(name_); |
686 | 687 |
687 PushInterceptorArguments(masm, | 688 PushInterceptorArguments(masm, |
688 receiver, | 689 receiver, |
689 holder, | 690 holder, |
690 name_, | 691 name_, |
691 interceptor_holder); | 692 interceptor_holder); |
692 | 693 |
693 __ CallExternalReference( | 694 __ CallExternalReference( |
694 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall)), | 695 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
| 696 masm->isolate()), |
695 5); | 697 5); |
696 | 698 |
697 // Restore the name_ register. | 699 // Restore the name_ register. |
698 __ pop(name_); | 700 __ pop(name_); |
699 __ LeaveInternalFrame(); | 701 __ LeaveInternalFrame(); |
700 } | 702 } |
701 | 703 |
702 void LoadWithInterceptor(MacroAssembler* masm, | 704 void LoadWithInterceptor(MacroAssembler* masm, |
703 Register receiver, | 705 Register receiver, |
704 Register holder, | 706 Register holder, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // Perform map transition for the receiver if necessary. | 774 // Perform map transition for the receiver if necessary. |
773 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { | 775 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { |
774 // The properties must be extended before we can store the value. | 776 // The properties must be extended before we can store the value. |
775 // We jump to a runtime call that extends the properties array. | 777 // We jump to a runtime call that extends the properties array. |
776 __ pop(scratch); // Return address. | 778 __ pop(scratch); // Return address. |
777 __ push(receiver_reg); | 779 __ push(receiver_reg); |
778 __ Push(Handle<Map>(transition)); | 780 __ Push(Handle<Map>(transition)); |
779 __ push(rax); | 781 __ push(rax); |
780 __ push(scratch); | 782 __ push(scratch); |
781 __ TailCallExternalReference( | 783 __ TailCallExternalReference( |
782 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 3, 1); | 784 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage), |
| 785 masm->isolate()), |
| 786 3, |
| 787 1); |
783 return; | 788 return; |
784 } | 789 } |
785 | 790 |
786 if (transition != NULL) { | 791 if (transition != NULL) { |
787 // Update the map of the object; no write barrier updating is | 792 // Update the map of the object; no write barrier updating is |
788 // needed because the map is never in new space. | 793 // needed because the map is never in new space. |
789 __ Move(FieldOperand(receiver_reg, HeapObject::kMapOffset), | 794 __ Move(FieldOperand(receiver_reg, HeapObject::kMapOffset), |
790 Handle<Map>(transition)); | 795 Handle<Map>(transition)); |
791 } | 796 } |
792 | 797 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 __ pop(scratch2); // return address | 1231 __ pop(scratch2); // return address |
1227 __ push(receiver); | 1232 __ push(receiver); |
1228 __ push(holder_reg); | 1233 __ push(holder_reg); |
1229 __ Move(holder_reg, Handle<AccessorInfo>(callback)); | 1234 __ Move(holder_reg, Handle<AccessorInfo>(callback)); |
1230 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); | 1235 __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); |
1231 __ push(holder_reg); | 1236 __ push(holder_reg); |
1232 __ push(name_reg); | 1237 __ push(name_reg); |
1233 __ push(scratch2); // restore return address | 1238 __ push(scratch2); // restore return address |
1234 | 1239 |
1235 ExternalReference ref = | 1240 ExternalReference ref = |
1236 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 1241 ExternalReference(IC_Utility(IC::kLoadCallbackProperty), |
| 1242 masm()->isolate()); |
1237 __ TailCallExternalReference(ref, 5, 1); | 1243 __ TailCallExternalReference(ref, 5, 1); |
1238 } | 1244 } |
1239 } else { // !compile_followup_inline | 1245 } else { // !compile_followup_inline |
1240 // Call the runtime system to load the interceptor. | 1246 // Call the runtime system to load the interceptor. |
1241 // Check that the maps haven't changed. | 1247 // Check that the maps haven't changed. |
1242 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1248 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
1243 scratch1, scratch2, scratch3, | 1249 scratch1, scratch2, scratch3, |
1244 name, miss); | 1250 name, miss); |
1245 __ pop(scratch2); // save old return address | 1251 __ pop(scratch2); // save old return address |
1246 PushInterceptorArguments(masm(), receiver, holder_reg, | 1252 PushInterceptorArguments(masm(), receiver, holder_reg, |
1247 name_reg, interceptor_holder); | 1253 name_reg, interceptor_holder); |
1248 __ push(scratch2); // restore old return address | 1254 __ push(scratch2); // restore old return address |
1249 | 1255 |
1250 ExternalReference ref = ExternalReference( | 1256 ExternalReference ref = ExternalReference( |
1251 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad)); | 1257 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), masm()->isolate()); |
1252 __ TailCallExternalReference(ref, 5, 1); | 1258 __ TailCallExternalReference(ref, 5, 1); |
1253 } | 1259 } |
1254 } | 1260 } |
1255 | 1261 |
1256 | 1262 |
1257 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { | 1263 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { |
1258 if (kind_ == Code::KEYED_CALL_IC) { | 1264 if (kind_ == Code::KEYED_CALL_IC) { |
1259 __ Cmp(rcx, Handle<String>(name)); | 1265 __ Cmp(rcx, Handle<String>(name)); |
1260 __ j(not_equal, miss); | 1266 __ j(not_equal, miss); |
1261 } | 1267 } |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 | 1478 |
1473 __ RecordWriteHelper(rbx, rdx, rcx); | 1479 __ RecordWriteHelper(rbx, rdx, rcx); |
1474 | 1480 |
1475 __ ret((argc + 1) * kPointerSize); | 1481 __ ret((argc + 1) * kPointerSize); |
1476 | 1482 |
1477 __ bind(&attempt_to_grow_elements); | 1483 __ bind(&attempt_to_grow_elements); |
1478 if (!FLAG_inline_new) { | 1484 if (!FLAG_inline_new) { |
1479 __ jmp(&call_builtin); | 1485 __ jmp(&call_builtin); |
1480 } | 1486 } |
1481 | 1487 |
| 1488 Isolate* isolate = masm()->isolate(); |
1482 ExternalReference new_space_allocation_top = | 1489 ExternalReference new_space_allocation_top = |
1483 ExternalReference::new_space_allocation_top_address(); | 1490 ExternalReference::new_space_allocation_top_address(isolate); |
1484 ExternalReference new_space_allocation_limit = | 1491 ExternalReference new_space_allocation_limit = |
1485 ExternalReference::new_space_allocation_limit_address(); | 1492 ExternalReference::new_space_allocation_limit_address(isolate); |
1486 | 1493 |
1487 const int kAllocationDelta = 4; | 1494 const int kAllocationDelta = 4; |
1488 // Load top. | 1495 // Load top. |
1489 __ movq(rcx, new_space_allocation_top); | 1496 __ movq(rcx, new_space_allocation_top); |
1490 __ movq(rcx, Operand(rcx, 0)); | 1497 __ movq(rcx, Operand(rcx, 0)); |
1491 | 1498 |
1492 // Check if it's the end of elements. | 1499 // Check if it's the end of elements. |
1493 __ lea(rdx, FieldOperand(rbx, | 1500 __ lea(rdx, FieldOperand(rbx, |
1494 rax, times_pointer_size, | 1501 rax, times_pointer_size, |
1495 FixedArray::kHeaderSize - argc * kPointerSize)); | 1502 FixedArray::kHeaderSize - argc * kPointerSize)); |
(...skipping 26 matching lines...) Expand all Loading... |
1522 | 1529 |
1523 // Make new length a smi before returning it. | 1530 // Make new length a smi before returning it. |
1524 __ Integer32ToSmi(rax, rax); | 1531 __ Integer32ToSmi(rax, rax); |
1525 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); | 1532 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
1526 | 1533 |
1527 // Elements are in new space, so write barrier is not required. | 1534 // Elements are in new space, so write barrier is not required. |
1528 __ ret((argc + 1) * kPointerSize); | 1535 __ ret((argc + 1) * kPointerSize); |
1529 } | 1536 } |
1530 | 1537 |
1531 __ bind(&call_builtin); | 1538 __ bind(&call_builtin); |
1532 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1539 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush, |
| 1540 masm()->isolate()), |
1533 argc + 1, | 1541 argc + 1, |
1534 1); | 1542 1); |
1535 } | 1543 } |
1536 | 1544 |
1537 __ bind(&miss); | 1545 __ bind(&miss); |
1538 Object* obj; | 1546 Object* obj; |
1539 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1547 { MaybeObject* maybe_obj = GenerateMissBranch(); |
1540 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1548 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1541 } | 1549 } |
1542 | 1550 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 rcx, times_pointer_size, | 1615 rcx, times_pointer_size, |
1608 FixedArray::kHeaderSize), | 1616 FixedArray::kHeaderSize), |
1609 r9); | 1617 r9); |
1610 __ ret((argc + 1) * kPointerSize); | 1618 __ ret((argc + 1) * kPointerSize); |
1611 | 1619 |
1612 __ bind(&return_undefined); | 1620 __ bind(&return_undefined); |
1613 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 1621 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
1614 __ ret((argc + 1) * kPointerSize); | 1622 __ ret((argc + 1) * kPointerSize); |
1615 | 1623 |
1616 __ bind(&call_builtin); | 1624 __ bind(&call_builtin); |
1617 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1625 __ TailCallExternalReference( |
1618 argc + 1, | 1626 ExternalReference(Builtins::c_ArrayPop, masm()->isolate()), |
1619 1); | 1627 argc + 1, |
| 1628 1); |
1620 | 1629 |
1621 __ bind(&miss); | 1630 __ bind(&miss); |
1622 Object* obj; | 1631 Object* obj; |
1623 { MaybeObject* maybe_obj = GenerateMissBranch(); | 1632 { MaybeObject* maybe_obj = GenerateMissBranch(); |
1624 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1633 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1625 } | 1634 } |
1626 | 1635 |
1627 // Return the generated code. | 1636 // Return the generated code. |
1628 return GetCode(function); | 1637 return GetCode(function); |
1629 } | 1638 } |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 | 2391 |
2383 __ pop(rbx); // remove the return address | 2392 __ pop(rbx); // remove the return address |
2384 __ push(rdx); // receiver | 2393 __ push(rdx); // receiver |
2385 __ Push(Handle<AccessorInfo>(callback)); // callback info | 2394 __ Push(Handle<AccessorInfo>(callback)); // callback info |
2386 __ push(rcx); // name | 2395 __ push(rcx); // name |
2387 __ push(rax); // value | 2396 __ push(rax); // value |
2388 __ push(rbx); // restore return address | 2397 __ push(rbx); // restore return address |
2389 | 2398 |
2390 // Do tail-call to the runtime system. | 2399 // Do tail-call to the runtime system. |
2391 ExternalReference store_callback_property = | 2400 ExternalReference store_callback_property = |
2392 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); | 2401 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), |
| 2402 masm()->isolate()); |
2393 __ TailCallExternalReference(store_callback_property, 4, 1); | 2403 __ TailCallExternalReference(store_callback_property, 4, 1); |
2394 | 2404 |
2395 // Handle store cache miss. | 2405 // Handle store cache miss. |
2396 __ bind(&miss); | 2406 __ bind(&miss); |
2397 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2407 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
2398 Builtins::StoreIC_Miss)); | 2408 Builtins::StoreIC_Miss)); |
2399 __ Jump(ic, RelocInfo::CODE_TARGET); | 2409 __ Jump(ic, RelocInfo::CODE_TARGET); |
2400 | 2410 |
2401 // Return the generated code. | 2411 // Return the generated code. |
2402 return GetCode(CALLBACKS, name); | 2412 return GetCode(CALLBACKS, name); |
(...skipping 29 matching lines...) Expand all Loading... |
2432 | 2442 |
2433 __ pop(rbx); // remove the return address | 2443 __ pop(rbx); // remove the return address |
2434 __ push(rdx); // receiver | 2444 __ push(rdx); // receiver |
2435 __ push(rcx); // name | 2445 __ push(rcx); // name |
2436 __ push(rax); // value | 2446 __ push(rax); // value |
2437 __ Push(Smi::FromInt(strict_mode_)); | 2447 __ Push(Smi::FromInt(strict_mode_)); |
2438 __ push(rbx); // restore return address | 2448 __ push(rbx); // restore return address |
2439 | 2449 |
2440 // Do tail-call to the runtime system. | 2450 // Do tail-call to the runtime system. |
2441 ExternalReference store_ic_property = | 2451 ExternalReference store_ic_property = |
2442 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 2452 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), |
| 2453 masm()->isolate()); |
2443 __ TailCallExternalReference(store_ic_property, 4, 1); | 2454 __ TailCallExternalReference(store_ic_property, 4, 1); |
2444 | 2455 |
2445 // Handle store cache miss. | 2456 // Handle store cache miss. |
2446 __ bind(&miss); | 2457 __ bind(&miss); |
2447 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2458 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
2448 Builtins::StoreIC_Miss)); | 2459 Builtins::StoreIC_Miss)); |
2449 __ Jump(ic, RelocInfo::CODE_TARGET); | 2460 __ Jump(ic, RelocInfo::CODE_TARGET); |
2450 | 2461 |
2451 // Return the generated code. | 2462 // Return the generated code. |
2452 return GetCode(INTERCEPTOR, name); | 2463 return GetCode(INTERCEPTOR, name); |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 3465 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
3455 | 3466 |
3456 return GetCode(flags); | 3467 return GetCode(flags); |
3457 } | 3468 } |
3458 | 3469 |
3459 #undef __ | 3470 #undef __ |
3460 | 3471 |
3461 } } // namespace v8::internal | 3472 } } // namespace v8::internal |
3462 | 3473 |
3463 #endif // V8_TARGET_ARCH_X64 | 3474 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |