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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 CheckPageFlag(object, | 549 CheckPageFlag(object, |
550 value, // Used as scratch. | 550 value, // Used as scratch. |
551 MemoryChunk::kPointersFromHereAreInterestingMask, | 551 MemoryChunk::kPointersFromHereAreInterestingMask, |
552 eq, | 552 eq, |
553 &done); | 553 &done); |
554 | 554 |
555 // Record the actual write. | 555 // Record the actual write. |
556 if (lr_status == kLRHasNotBeenSaved) { | 556 if (lr_status == kLRHasNotBeenSaved) { |
557 push(lr); | 557 push(lr); |
558 } | 558 } |
559 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); | 559 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, |
| 560 fp_mode); |
560 CallStub(&stub); | 561 CallStub(&stub); |
561 if (lr_status == kLRHasNotBeenSaved) { | 562 if (lr_status == kLRHasNotBeenSaved) { |
562 pop(lr); | 563 pop(lr); |
563 } | 564 } |
564 | 565 |
565 bind(&done); | 566 bind(&done); |
566 | 567 |
567 // Clobber clobbered registers when running with the debug-code flag | 568 // Clobber clobbered registers when running with the debug-code flag |
568 // turned on to provoke errors. | 569 // turned on to provoke errors. |
569 if (emit_debug_code()) { | 570 if (emit_debug_code()) { |
(...skipping 28 matching lines...) Expand all Loading... |
598 // Check for end of buffer. | 599 // Check for end of buffer. |
599 tst(scratch, Operand(StoreBuffer::kStoreBufferOverflowBit)); | 600 tst(scratch, Operand(StoreBuffer::kStoreBufferOverflowBit)); |
600 if (and_then == kFallThroughAtEnd) { | 601 if (and_then == kFallThroughAtEnd) { |
601 b(eq, &done); | 602 b(eq, &done); |
602 } else { | 603 } else { |
603 ASSERT(and_then == kReturnAtEnd); | 604 ASSERT(and_then == kReturnAtEnd); |
604 Ret(eq); | 605 Ret(eq); |
605 } | 606 } |
606 push(lr); | 607 push(lr); |
607 StoreBufferOverflowStub store_buffer_overflow = | 608 StoreBufferOverflowStub store_buffer_overflow = |
608 StoreBufferOverflowStub(fp_mode); | 609 StoreBufferOverflowStub(isolate(), fp_mode); |
609 CallStub(&store_buffer_overflow); | 610 CallStub(&store_buffer_overflow); |
610 pop(lr); | 611 pop(lr); |
611 bind(&done); | 612 bind(&done); |
612 if (and_then == kReturnAtEnd) { | 613 if (and_then == kReturnAtEnd) { |
613 Ret(); | 614 Ret(); |
614 } | 615 } |
615 } | 616 } |
616 | 617 |
617 | 618 |
618 void MacroAssembler::PushFixedFrame(Register marker_reg) { | 619 void MacroAssembler::PushFixedFrame(Register marker_reg) { |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1333 ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
1333 cmp(scratch, Operand(LAST_NAME_TYPE)); | 1334 cmp(scratch, Operand(LAST_NAME_TYPE)); |
1334 b(hi, fail); | 1335 b(hi, fail); |
1335 } | 1336 } |
1336 | 1337 |
1337 | 1338 |
1338 #ifdef ENABLE_DEBUGGER_SUPPORT | 1339 #ifdef ENABLE_DEBUGGER_SUPPORT |
1339 void MacroAssembler::DebugBreak() { | 1340 void MacroAssembler::DebugBreak() { |
1340 mov(r0, Operand::Zero()); | 1341 mov(r0, Operand::Zero()); |
1341 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); | 1342 mov(r1, Operand(ExternalReference(Runtime::kDebugBreak, isolate()))); |
1342 CEntryStub ces(1); | 1343 CEntryStub ces(isolate(), 1); |
1343 ASSERT(AllowThisStubCall(&ces)); | 1344 ASSERT(AllowThisStubCall(&ces)); |
1344 Call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); | 1345 Call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); |
1345 } | 1346 } |
1346 #endif | 1347 #endif |
1347 | 1348 |
1348 | 1349 |
1349 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 1350 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
1350 int handler_index) { | 1351 int handler_index) { |
1351 // Adjust this code if not the case. | 1352 // Adjust this code if not the case. |
1352 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 1353 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 PushSafepointRegisters(); | 2383 PushSafepointRegisters(); |
2383 PrepareCallCFunction(1, r0); | 2384 PrepareCallCFunction(1, r0); |
2384 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2385 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2385 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 2386 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
2386 PopSafepointRegisters(); | 2387 PopSafepointRegisters(); |
2387 } | 2388 } |
2388 | 2389 |
2389 // Native call returns to the DirectCEntry stub which redirects to the | 2390 // Native call returns to the DirectCEntry stub which redirects to the |
2390 // return address pushed on stack (could have moved after GC). | 2391 // return address pushed on stack (could have moved after GC). |
2391 // DirectCEntry stub itself is generated early and never moves. | 2392 // DirectCEntry stub itself is generated early and never moves. |
2392 DirectCEntryStub stub; | 2393 DirectCEntryStub stub(isolate()); |
2393 stub.GenerateCall(this, r3); | 2394 stub.GenerateCall(this, r3); |
2394 | 2395 |
2395 if (FLAG_log_timer_events) { | 2396 if (FLAG_log_timer_events) { |
2396 FrameScope frame(this, StackFrame::MANUAL); | 2397 FrameScope frame(this, StackFrame::MANUAL); |
2397 PushSafepointRegisters(); | 2398 PushSafepointRegisters(); |
2398 PrepareCallCFunction(1, r0); | 2399 PrepareCallCFunction(1, r0); |
2399 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); | 2400 mov(r0, Operand(ExternalReference::isolate_address(isolate()))); |
2400 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 2401 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
2401 PopSafepointRegisters(); | 2402 PopSafepointRegisters(); |
2402 } | 2403 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 DwVfpRegister double_input) { | 2588 DwVfpRegister double_input) { |
2588 Label done; | 2589 Label done; |
2589 | 2590 |
2590 TryInlineTruncateDoubleToI(result, double_input, &done); | 2591 TryInlineTruncateDoubleToI(result, double_input, &done); |
2591 | 2592 |
2592 // If we fell through then inline version didn't succeed - call stub instead. | 2593 // If we fell through then inline version didn't succeed - call stub instead. |
2593 push(lr); | 2594 push(lr); |
2594 sub(sp, sp, Operand(kDoubleSize)); // Put input on stack. | 2595 sub(sp, sp, Operand(kDoubleSize)); // Put input on stack. |
2595 vstr(double_input, MemOperand(sp, 0)); | 2596 vstr(double_input, MemOperand(sp, 0)); |
2596 | 2597 |
2597 DoubleToIStub stub(sp, result, 0, true, true); | 2598 DoubleToIStub stub(isolate(), sp, result, 0, true, true); |
2598 CallStub(&stub); | 2599 CallStub(&stub); |
2599 | 2600 |
2600 add(sp, sp, Operand(kDoubleSize)); | 2601 add(sp, sp, Operand(kDoubleSize)); |
2601 pop(lr); | 2602 pop(lr); |
2602 | 2603 |
2603 bind(&done); | 2604 bind(&done); |
2604 } | 2605 } |
2605 | 2606 |
2606 | 2607 |
2607 void MacroAssembler::TruncateHeapNumberToI(Register result, | 2608 void MacroAssembler::TruncateHeapNumberToI(Register result, |
2608 Register object) { | 2609 Register object) { |
2609 Label done; | 2610 Label done; |
2610 LowDwVfpRegister double_scratch = kScratchDoubleReg; | 2611 LowDwVfpRegister double_scratch = kScratchDoubleReg; |
2611 ASSERT(!result.is(object)); | 2612 ASSERT(!result.is(object)); |
2612 | 2613 |
2613 vldr(double_scratch, | 2614 vldr(double_scratch, |
2614 MemOperand(object, HeapNumber::kValueOffset - kHeapObjectTag)); | 2615 MemOperand(object, HeapNumber::kValueOffset - kHeapObjectTag)); |
2615 TryInlineTruncateDoubleToI(result, double_scratch, &done); | 2616 TryInlineTruncateDoubleToI(result, double_scratch, &done); |
2616 | 2617 |
2617 // If we fell through then inline version didn't succeed - call stub instead. | 2618 // If we fell through then inline version didn't succeed - call stub instead. |
2618 push(lr); | 2619 push(lr); |
2619 DoubleToIStub stub(object, | 2620 DoubleToIStub stub(isolate(), |
| 2621 object, |
2620 result, | 2622 result, |
2621 HeapNumber::kValueOffset - kHeapObjectTag, | 2623 HeapNumber::kValueOffset - kHeapObjectTag, |
2622 true, | 2624 true, |
2623 true); | 2625 true); |
2624 CallStub(&stub); | 2626 CallStub(&stub); |
2625 pop(lr); | 2627 pop(lr); |
2626 | 2628 |
2627 bind(&done); | 2629 bind(&done); |
2628 } | 2630 } |
2629 | 2631 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 IllegalOperation(num_arguments); | 2677 IllegalOperation(num_arguments); |
2676 return; | 2678 return; |
2677 } | 2679 } |
2678 | 2680 |
2679 // TODO(1236192): Most runtime routines don't need the number of | 2681 // TODO(1236192): Most runtime routines don't need the number of |
2680 // arguments passed in because it is constant. At some point we | 2682 // arguments passed in because it is constant. At some point we |
2681 // should remove this need and make the runtime routine entry code | 2683 // should remove this need and make the runtime routine entry code |
2682 // smarter. | 2684 // smarter. |
2683 mov(r0, Operand(num_arguments)); | 2685 mov(r0, Operand(num_arguments)); |
2684 mov(r1, Operand(ExternalReference(f, isolate()))); | 2686 mov(r1, Operand(ExternalReference(f, isolate()))); |
2685 CEntryStub stub(1, save_doubles); | 2687 CEntryStub stub(isolate(), 1, save_doubles); |
2686 CallStub(&stub); | 2688 CallStub(&stub); |
2687 } | 2689 } |
2688 | 2690 |
2689 | 2691 |
2690 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 2692 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
2691 int num_arguments) { | 2693 int num_arguments) { |
2692 mov(r0, Operand(num_arguments)); | 2694 mov(r0, Operand(num_arguments)); |
2693 mov(r1, Operand(ext)); | 2695 mov(r1, Operand(ext)); |
2694 | 2696 |
2695 CEntryStub stub(1); | 2697 CEntryStub stub(isolate(), 1); |
2696 CallStub(&stub); | 2698 CallStub(&stub); |
2697 } | 2699 } |
2698 | 2700 |
2699 | 2701 |
2700 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, | 2702 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
2701 int num_arguments, | 2703 int num_arguments, |
2702 int result_size) { | 2704 int result_size) { |
2703 // TODO(1236192): Most runtime routines don't need the number of | 2705 // TODO(1236192): Most runtime routines don't need the number of |
2704 // arguments passed in because it is constant. At some point we | 2706 // arguments passed in because it is constant. At some point we |
2705 // should remove this need and make the runtime routine entry code | 2707 // should remove this need and make the runtime routine entry code |
(...skipping 11 matching lines...) Expand all Loading... |
2717 result_size); | 2719 result_size); |
2718 } | 2720 } |
2719 | 2721 |
2720 | 2722 |
2721 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { | 2723 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { |
2722 #if defined(__thumb__) | 2724 #if defined(__thumb__) |
2723 // Thumb mode builtin. | 2725 // Thumb mode builtin. |
2724 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); | 2726 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); |
2725 #endif | 2727 #endif |
2726 mov(r1, Operand(builtin)); | 2728 mov(r1, Operand(builtin)); |
2727 CEntryStub stub(1); | 2729 CEntryStub stub(isolate(), 1); |
2728 Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 2730 Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
2729 } | 2731 } |
2730 | 2732 |
2731 | 2733 |
2732 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 2734 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
2733 InvokeFlag flag, | 2735 InvokeFlag flag, |
2734 const CallWrapper& call_wrapper) { | 2736 const CallWrapper& call_wrapper) { |
2735 // You can't call a builtin without a valid frame. | 2737 // You can't call a builtin without a valid frame. |
2736 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 2738 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
2737 | 2739 |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 sub(result, result, Operand(dividend)); | 4091 sub(result, result, Operand(dividend)); |
4090 } | 4092 } |
4091 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); | 4093 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); |
4092 add(result, result, Operand(dividend, LSR, 31)); | 4094 add(result, result, Operand(dividend, LSR, 31)); |
4093 } | 4095 } |
4094 | 4096 |
4095 | 4097 |
4096 } } // namespace v8::internal | 4098 } } // namespace v8::internal |
4097 | 4099 |
4098 #endif // V8_TARGET_ARCH_ARM | 4100 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |