Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: src/x64/builtins-x64.cc

Issue 174639: Use a root array register for constant loads and stack guards on x64.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Label copy; 132 Label copy;
133 __ bind(&copy); 133 __ bind(&copy);
134 __ incq(rcx); 134 __ incq(rcx);
135 __ push(Operand(rdi, 0)); 135 __ push(Operand(rdi, 0));
136 __ subq(rdi, Immediate(kPointerSize)); 136 __ subq(rdi, Immediate(kPointerSize));
137 __ cmpq(rcx, rax); 137 __ cmpq(rcx, rax);
138 __ j(less, &copy); 138 __ j(less, &copy);
139 139
140 // Fill remaining expected arguments with undefined values. 140 // Fill remaining expected arguments with undefined values.
141 Label fill; 141 Label fill;
142 __ movq(kScratchRegister, 142 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
143 Factory::undefined_value(),
144 RelocInfo::EMBEDDED_OBJECT);
145 __ bind(&fill); 143 __ bind(&fill);
146 __ incq(rcx); 144 __ incq(rcx);
147 __ push(kScratchRegister); 145 __ push(kScratchRegister);
148 __ cmpq(rcx, rbx); 146 __ cmpq(rcx, rbx);
149 __ j(less, &fill); 147 __ j(less, &fill);
150 148
151 // Restore function pointer. 149 // Restore function pointer.
152 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 150 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
153 } 151 }
154 152
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 __ bind(&done); 209 __ bind(&done);
212 } 210 }
213 211
214 // 3. Make sure first argument is an object; convert if necessary. 212 // 3. Make sure first argument is an object; convert if necessary.
215 { Label call_to_object, use_global_receiver, patch_receiver, done; 213 { Label call_to_object, use_global_receiver, patch_receiver, done;
216 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); 214 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0));
217 215
218 __ testl(rbx, Immediate(kSmiTagMask)); 216 __ testl(rbx, Immediate(kSmiTagMask));
219 __ j(zero, &call_to_object); 217 __ j(zero, &call_to_object);
220 218
221 __ Cmp(rbx, Factory::null_value()); 219 __ CompareRoot(rbx, Heap::kNullValueRootIndex);
222 __ j(equal, &use_global_receiver); 220 __ j(equal, &use_global_receiver);
223 __ Cmp(rbx, Factory::undefined_value()); 221 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
224 __ j(equal, &use_global_receiver); 222 __ j(equal, &use_global_receiver);
225 223
226 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); 224 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx);
227 __ j(below, &call_to_object); 225 __ j(below, &call_to_object);
228 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); 226 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE);
229 __ j(below_equal, &done); 227 __ j(below_equal, &done);
230 228
231 __ bind(&call_to_object); 229 __ bind(&call_to_object);
232 __ EnterInternalFrame(); // preserves rax, rbx, rdi 230 __ EnterInternalFrame(); // preserves rax, rbx, rdi
233 231
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // Change context eagerly to get the right global object if 377 // Change context eagerly to get the right global object if
380 // necessary. 378 // necessary.
381 __ movq(rdi, Operand(rbp, kFunctionOffset)); 379 __ movq(rdi, Operand(rbp, kFunctionOffset));
382 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); 380 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
383 381
384 // Compute the receiver. 382 // Compute the receiver.
385 Label call_to_object, use_global_receiver, push_receiver; 383 Label call_to_object, use_global_receiver, push_receiver;
386 __ movq(rbx, Operand(rbp, kReceiverOffset)); 384 __ movq(rbx, Operand(rbp, kReceiverOffset));
387 __ testl(rbx, Immediate(kSmiTagMask)); 385 __ testl(rbx, Immediate(kSmiTagMask));
388 __ j(zero, &call_to_object); 386 __ j(zero, &call_to_object);
389 __ Cmp(rbx, Factory::null_value()); 387 __ CompareRoot(rbx, Heap::kNullValueRootIndex);
390 __ j(equal, &use_global_receiver); 388 __ j(equal, &use_global_receiver);
391 __ Cmp(rbx, Factory::undefined_value()); 389 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
392 __ j(equal, &use_global_receiver); 390 __ j(equal, &use_global_receiver);
393 391
394 // If given receiver is already a JavaScript object then there's no 392 // If given receiver is already a JavaScript object then there's no
395 // reason for converting it. 393 // reason for converting it.
396 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); 394 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx);
397 __ j(below, &call_to_object); 395 __ j(below, &call_to_object);
398 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE); 396 __ CmpInstanceType(rcx, LAST_JS_OBJECT_TYPE);
399 __ j(below_equal, &push_receiver); 397 __ j(below_equal, &push_receiver);
400 398
401 // Convert the receiver to an object. 399 // Convert the receiver to an object.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // Make sure that the maximum heap object size will never cause us 539 // Make sure that the maximum heap object size will never cause us
542 // problem here, because it is always greater than the maximum 540 // problem here, because it is always greater than the maximum
543 // instance size that can be represented in a byte. 541 // instance size that can be represented in a byte.
544 ASSERT(Heap::MaxObjectSizeInPagedSpace() >= (1 << kBitsPerByte)); 542 ASSERT(Heap::MaxObjectSizeInPagedSpace() >= (1 << kBitsPerByte));
545 __ AllocateObjectInNewSpace(rdi, rbx, rdi, no_reg, &rt_call, false); 543 __ AllocateObjectInNewSpace(rdi, rbx, rdi, no_reg, &rt_call, false);
546 // Allocated the JSObject, now initialize the fields. 544 // Allocated the JSObject, now initialize the fields.
547 // rax: initial map 545 // rax: initial map
548 // rbx: JSObject (not HeapObject tagged - the actual address). 546 // rbx: JSObject (not HeapObject tagged - the actual address).
549 // rdi: start of next object 547 // rdi: start of next object
550 __ movq(Operand(rbx, JSObject::kMapOffset), rax); 548 __ movq(Operand(rbx, JSObject::kMapOffset), rax);
551 __ Move(rcx, Factory::empty_fixed_array()); 549 __ LoadRoot(rcx, Heap::kEmptyFixedArrayRootIndex);
552 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx); 550 __ movq(Operand(rbx, JSObject::kPropertiesOffset), rcx);
553 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx); 551 __ movq(Operand(rbx, JSObject::kElementsOffset), rcx);
554 // Set extra fields in the newly allocated object. 552 // Set extra fields in the newly allocated object.
555 // rax: initial map 553 // rax: initial map
556 // rbx: JSObject 554 // rbx: JSObject
557 // rdi: start of next object 555 // rdi: start of next object
558 { Label loop, entry; 556 { Label loop, entry;
559 __ Move(rdx, Factory::undefined_value()); 557 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
560 __ lea(rcx, Operand(rbx, JSObject::kHeaderSize)); 558 __ lea(rcx, Operand(rbx, JSObject::kHeaderSize));
561 __ jmp(&entry); 559 __ jmp(&entry);
562 __ bind(&loop); 560 __ bind(&loop);
563 __ movq(Operand(rcx, 0), rdx); 561 __ movq(Operand(rcx, 0), rdx);
564 __ addq(rcx, Immediate(kPointerSize)); 562 __ addq(rcx, Immediate(kPointerSize));
565 __ bind(&entry); 563 __ bind(&entry);
566 __ cmpq(rcx, rdi); 564 __ cmpq(rcx, rdi);
567 __ j(less, &loop); 565 __ j(less, &loop);
568 } 566 }
569 567
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 rax, 604 rax,
607 no_reg, 605 no_reg,
608 &undo_allocation, 606 &undo_allocation,
609 true); 607 true);
610 608
611 // Initialize the FixedArray. 609 // Initialize the FixedArray.
612 // rbx: JSObject 610 // rbx: JSObject
613 // rdi: FixedArray 611 // rdi: FixedArray
614 // rdx: number of elements 612 // rdx: number of elements
615 // rax: start of next object 613 // rax: start of next object
616 __ Move(rcx, Factory::fixed_array_map()); 614 __ LoadRoot(rcx, Heap::kFixedArrayMapRootIndex);
617 __ movq(Operand(rdi, JSObject::kMapOffset), rcx); // setup the map 615 __ movq(Operand(rdi, JSObject::kMapOffset), rcx); // setup the map
618 __ movl(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length 616 __ movl(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length
619 617
620 // Initialize the fields to undefined. 618 // Initialize the fields to undefined.
621 // rbx: JSObject 619 // rbx: JSObject
622 // rdi: FixedArray 620 // rdi: FixedArray
623 // rax: start of next object 621 // rax: start of next object
624 // rdx: number of elements 622 // rdx: number of elements
625 { Label loop, entry; 623 { Label loop, entry;
626 __ Move(rdx, Factory::undefined_value()); 624 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
627 __ lea(rcx, Operand(rdi, FixedArray::kHeaderSize)); 625 __ lea(rcx, Operand(rdi, FixedArray::kHeaderSize));
628 __ jmp(&entry); 626 __ jmp(&entry);
629 __ bind(&loop); 627 __ bind(&loop);
630 __ movq(Operand(rcx, 0), rdx); 628 __ movq(Operand(rcx, 0), rdx);
631 __ addq(rcx, Immediate(kPointerSize)); 629 __ addq(rcx, Immediate(kPointerSize));
632 __ bind(&entry); 630 __ bind(&entry);
633 __ cmpq(rcx, rax); 631 __ cmpq(rcx, rax);
634 __ j(below, &loop); 632 __ j(below, &loop);
635 } 633 }
636 634
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 788
791 // Push the function and receiver and setup the context. 789 // Push the function and receiver and setup the context.
792 __ push(rdi); 790 __ push(rdi);
793 __ push(rdx); 791 __ push(rdx);
794 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); 792 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
795 793
796 // Load the number of arguments and setup pointer to the arguments. 794 // Load the number of arguments and setup pointer to the arguments.
797 __ movq(rax, rcx); 795 __ movq(rax, rcx);
798 __ movq(rbx, r8); 796 __ movq(rbx, r8);
799 #endif // _WIN64 797 #endif // _WIN64
798
799 // Set up the roots register.
800 ExternalReference roots_address = ExternalReference::roots_address();
801 __ movq(r13, roots_address);
802
800 // Current stack contents: 803 // Current stack contents:
801 // [rsp + 2 * kPointerSize ... ]: Internal frame 804 // [rsp + 2 * kPointerSize ... ]: Internal frame
802 // [rsp + kPointerSize] : function 805 // [rsp + kPointerSize] : function
803 // [rsp] : receiver 806 // [rsp] : receiver
804 // Current register contents: 807 // Current register contents:
805 // rax : argc 808 // rax : argc
806 // rbx : argv 809 // rbx : argv
807 // rsi : context 810 // rsi : context
808 // rdi : function 811 // rdi : function
809 812
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 847 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
845 Generate_JSEntryTrampolineHelper(masm, false); 848 Generate_JSEntryTrampolineHelper(masm, false);
846 } 849 }
847 850
848 851
849 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 852 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
850 Generate_JSEntryTrampolineHelper(masm, true); 853 Generate_JSEntryTrampolineHelper(masm, true);
851 } 854 }
852 855
853 } } // namespace v8::internal 856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698