| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 690 |
| 691 // rcx must be used to pass the pointer to the return value slot. | 691 // rcx must be used to pass the pointer to the return value slot. |
| 692 lea(rcx, StackSpaceOperand(arg_stack_space)); | 692 lea(rcx, StackSpaceOperand(arg_stack_space)); |
| 693 #else | 693 #else |
| 694 EnterApiExitFrame(arg_stack_space); | 694 EnterApiExitFrame(arg_stack_space); |
| 695 #endif | 695 #endif |
| 696 } | 696 } |
| 697 | 697 |
| 698 | 698 |
| 699 void MacroAssembler::CallApiFunctionAndReturn(Address function_address, | 699 void MacroAssembler::CallApiFunctionAndReturn(Address function_address, |
| 700 Address thunk_address, |
| 701 Register thunk_last_arg, |
| 700 int stack_space, | 702 int stack_space, |
| 701 bool returns_handle, | 703 bool returns_handle, |
| 702 int return_value_offset) { | 704 int return_value_offset) { |
| 703 Label prologue; | 705 Label prologue; |
| 704 Label promote_scheduled_exception; | 706 Label promote_scheduled_exception; |
| 705 Label delete_allocated_handles; | 707 Label delete_allocated_handles; |
| 706 Label leave_exit_frame; | 708 Label leave_exit_frame; |
| 707 Label write_back; | 709 Label write_back; |
| 708 | 710 |
| 709 Factory* factory = isolate()->factory(); | 711 Factory* factory = isolate()->factory(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 730 | 732 |
| 731 if (FLAG_log_timer_events) { | 733 if (FLAG_log_timer_events) { |
| 732 FrameScope frame(this, StackFrame::MANUAL); | 734 FrameScope frame(this, StackFrame::MANUAL); |
| 733 PushSafepointRegisters(); | 735 PushSafepointRegisters(); |
| 734 PrepareCallCFunction(1); | 736 PrepareCallCFunction(1); |
| 735 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); | 737 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); |
| 736 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); | 738 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); |
| 737 PopSafepointRegisters(); | 739 PopSafepointRegisters(); |
| 738 } | 740 } |
| 739 | 741 |
| 742 |
| 743 Label profiler_disabled; |
| 744 Label end_profiler_check; |
| 745 bool* is_profiling_flag = |
| 746 isolate()->cpu_profiler()->is_profiling_address(); |
| 747 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1); |
| 748 movq(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE); |
| 749 cmpb(Operand(rax, 0), Immediate(0)); |
| 750 j(zero, &profiler_disabled); |
| 751 |
| 752 // Third parameter is the address of the actual getter function. |
| 753 movq(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE); |
| 754 movq(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE); |
| 755 jmp(&end_profiler_check); |
| 756 |
| 757 bind(&profiler_disabled); |
| 740 // Call the api function! | 758 // Call the api function! |
| 741 movq(rax, reinterpret_cast<int64_t>(function_address), | 759 movq(rax, reinterpret_cast<int64_t>(function_address), |
| 742 RelocInfo::EXTERNAL_REFERENCE); | 760 RelocInfo::EXTERNAL_REFERENCE); |
| 761 |
| 762 bind(&end_profiler_check); |
| 763 |
| 764 // Call the api function! |
| 743 call(rax); | 765 call(rax); |
| 744 | 766 |
| 745 if (FLAG_log_timer_events) { | 767 if (FLAG_log_timer_events) { |
| 746 FrameScope frame(this, StackFrame::MANUAL); | 768 FrameScope frame(this, StackFrame::MANUAL); |
| 747 PushSafepointRegisters(); | 769 PushSafepointRegisters(); |
| 748 PrepareCallCFunction(1); | 770 PrepareCallCFunction(1); |
| 749 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); | 771 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); |
| 750 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); | 772 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); |
| 751 PopSafepointRegisters(); | 773 PopSafepointRegisters(); |
| 752 } | 774 } |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); | 2372 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); |
| 2351 push(kScratchRegister); | 2373 push(kScratchRegister); |
| 2352 } | 2374 } |
| 2353 } | 2375 } |
| 2354 | 2376 |
| 2355 | 2377 |
| 2356 void MacroAssembler::LoadHeapObject(Register result, | 2378 void MacroAssembler::LoadHeapObject(Register result, |
| 2357 Handle<HeapObject> object) { | 2379 Handle<HeapObject> object) { |
| 2358 AllowDeferredHandleDereference using_raw_address; | 2380 AllowDeferredHandleDereference using_raw_address; |
| 2359 if (isolate()->heap()->InNewSpace(*object)) { | 2381 if (isolate()->heap()->InNewSpace(*object)) { |
| 2360 Handle<JSGlobalPropertyCell> cell = | 2382 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2361 isolate()->factory()->NewJSGlobalPropertyCell(object); | 2383 movq(result, cell, RelocInfo::CELL); |
| 2362 movq(result, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | |
| 2363 movq(result, Operand(result, 0)); | 2384 movq(result, Operand(result, 0)); |
| 2364 } else { | 2385 } else { |
| 2365 Move(result, object); | 2386 Move(result, object); |
| 2366 } | 2387 } |
| 2367 } | 2388 } |
| 2368 | 2389 |
| 2369 | 2390 |
| 2370 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) { | 2391 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) { |
| 2371 AllowDeferredHandleDereference using_raw_address; | 2392 AllowDeferredHandleDereference using_raw_address; |
| 2372 if (isolate()->heap()->InNewSpace(*object)) { | 2393 if (isolate()->heap()->InNewSpace(*object)) { |
| 2373 Handle<JSGlobalPropertyCell> cell = | 2394 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2374 isolate()->factory()->NewJSGlobalPropertyCell(object); | 2395 movq(kScratchRegister, cell, RelocInfo::CELL); |
| 2375 movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | |
| 2376 cmpq(reg, Operand(kScratchRegister, 0)); | 2396 cmpq(reg, Operand(kScratchRegister, 0)); |
| 2377 } else { | 2397 } else { |
| 2378 Cmp(reg, object); | 2398 Cmp(reg, object); |
| 2379 } | 2399 } |
| 2380 } | 2400 } |
| 2381 | 2401 |
| 2382 | 2402 |
| 2383 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { | 2403 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { |
| 2384 AllowDeferredHandleDereference using_raw_address; | 2404 AllowDeferredHandleDereference using_raw_address; |
| 2385 if (isolate()->heap()->InNewSpace(*object)) { | 2405 if (isolate()->heap()->InNewSpace(*object)) { |
| 2386 Handle<JSGlobalPropertyCell> cell = | 2406 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2387 isolate()->factory()->NewJSGlobalPropertyCell(object); | 2407 movq(kScratchRegister, cell, RelocInfo::CELL); |
| 2388 movq(kScratchRegister, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | |
| 2389 movq(kScratchRegister, Operand(kScratchRegister, 0)); | 2408 movq(kScratchRegister, Operand(kScratchRegister, 0)); |
| 2390 push(kScratchRegister); | 2409 push(kScratchRegister); |
| 2391 } else { | 2410 } else { |
| 2392 Push(object); | 2411 Push(object); |
| 2393 } | 2412 } |
| 2394 } | 2413 } |
| 2395 | 2414 |
| 2396 | 2415 |
| 2397 void MacroAssembler::LoadGlobalCell(Register dst, | 2416 void MacroAssembler::LoadGlobalCell(Register dst, Handle<Cell> cell) { |
| 2398 Handle<JSGlobalPropertyCell> cell) { | |
| 2399 if (dst.is(rax)) { | 2417 if (dst.is(rax)) { |
| 2400 AllowDeferredHandleDereference embedding_raw_address; | 2418 AllowDeferredHandleDereference embedding_raw_address; |
| 2401 load_rax(cell.location(), RelocInfo::GLOBAL_PROPERTY_CELL); | 2419 load_rax(cell.location(), RelocInfo::CELL); |
| 2402 } else { | 2420 } else { |
| 2403 movq(dst, cell, RelocInfo::GLOBAL_PROPERTY_CELL); | 2421 movq(dst, cell, RelocInfo::CELL); |
| 2404 movq(dst, Operand(dst, 0)); | 2422 movq(dst, Operand(dst, 0)); |
| 2405 } | 2423 } |
| 2406 } | 2424 } |
| 2407 | 2425 |
| 2408 | 2426 |
| 2409 void MacroAssembler::Push(Smi* source) { | 2427 void MacroAssembler::Push(Smi* source) { |
| 2410 intptr_t smi = reinterpret_cast<intptr_t>(source); | 2428 intptr_t smi = reinterpret_cast<intptr_t>(source); |
| 2411 if (is_int32(smi)) { | 2429 if (is_int32(smi)) { |
| 2412 push(Immediate(static_cast<int32_t>(smi))); | 2430 push(Immediate(static_cast<int32_t>(smi))); |
| 2413 } else { | 2431 } else { |
| (...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4682 j(greater, &no_info_available); | 4700 j(greater, &no_info_available); |
| 4683 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), | 4701 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), |
| 4684 Heap::kAllocationSiteInfoMapRootIndex); | 4702 Heap::kAllocationSiteInfoMapRootIndex); |
| 4685 bind(&no_info_available); | 4703 bind(&no_info_available); |
| 4686 } | 4704 } |
| 4687 | 4705 |
| 4688 | 4706 |
| 4689 } } // namespace v8::internal | 4707 } } // namespace v8::internal |
| 4690 | 4708 |
| 4691 #endif // V8_TARGET_ARCH_X64 | 4709 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |