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

Side by Side Diff: src/x64/virtual-frame-x64.cc

Issue 196139: X64: Convert smis to holding 32 bits of payload. (Closed)
Patch Set: Addressed review comments. Forwarded to head. Created 11 years, 2 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
« no previous file with comments | « src/x64/virtual-frame-x64.h ('k') | test/cctest/SConscript » ('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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // rsp: stack pointer, points to return address from this function. 58 // rsp: stack pointer, points to return address from this function.
59 // rbp: base pointer, points to previous JS, ArgumentsAdaptor, or 59 // rbp: base pointer, points to previous JS, ArgumentsAdaptor, or
60 // Trampoline frame. 60 // Trampoline frame.
61 // rsi: context of this function call. 61 // rsi: context of this function call.
62 // rdi: pointer to this function object. 62 // rdi: pointer to this function object.
63 Comment cmnt(masm(), "[ Enter JS frame"); 63 Comment cmnt(masm(), "[ Enter JS frame");
64 64
65 #ifdef DEBUG 65 #ifdef DEBUG
66 // Verify that rdi contains a JS function. The following code 66 // Verify that rdi contains a JS function. The following code
67 // relies on rax being available for use. 67 // relies on rax being available for use.
68 Condition not_smi = masm()->CheckNotSmi(rdi); 68 Condition not_smi = NegateCondition(masm()->CheckSmi(rdi));
69 __ Check(not_smi, 69 __ Check(not_smi,
70 "VirtualFrame::Enter - rdi is not a function (smi check)."); 70 "VirtualFrame::Enter - rdi is not a function (smi check).");
71 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rax); 71 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rax);
72 __ Check(equal, 72 __ Check(equal,
73 "VirtualFrame::Enter - rdi is not a function (map check)."); 73 "VirtualFrame::Enter - rdi is not a function (map check).");
74 #endif 74 #endif
75 75
76 EmitPush(rbp); 76 EmitPush(rbp);
77 77
78 __ movq(rbp, rsp); 78 __ movq(rbp, rsp);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 191
192 void VirtualFrame::EmitPush(Immediate immediate) { 192 void VirtualFrame::EmitPush(Immediate immediate) {
193 ASSERT(stack_pointer_ == element_count() - 1); 193 ASSERT(stack_pointer_ == element_count() - 1);
194 elements_.Add(FrameElement::MemoryElement()); 194 elements_.Add(FrameElement::MemoryElement());
195 stack_pointer_++; 195 stack_pointer_++;
196 __ push(immediate); 196 __ push(immediate);
197 } 197 }
198 198
199 199
200 void VirtualFrame::EmitPush(Smi* smi_value) {
201 ASSERT(stack_pointer_ == element_count() - 1);
202 elements_.Add(FrameElement::MemoryElement());
203 stack_pointer_++;
204 __ Push(smi_value);
205 }
206
207
200 void VirtualFrame::EmitPush(Handle<Object> value) { 208 void VirtualFrame::EmitPush(Handle<Object> value) {
201 ASSERT(stack_pointer_ == element_count() - 1); 209 ASSERT(stack_pointer_ == element_count() - 1);
202 elements_.Add(FrameElement::MemoryElement()); 210 elements_.Add(FrameElement::MemoryElement());
203 stack_pointer_++; 211 stack_pointer_++;
204 __ Push(value); 212 __ Push(value);
205 } 213 }
206 214
207 215
208 void VirtualFrame::EmitPush(Heap::RootListIndex index) { 216 void VirtualFrame::EmitPush(Heap::RootListIndex index) {
209 ASSERT(stack_pointer_ == element_count() - 1); 217 ASSERT(stack_pointer_ == element_count() - 1);
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 842
835 void VirtualFrame::SyncElementByPushing(int index) { 843 void VirtualFrame::SyncElementByPushing(int index) {
836 // Sync an element of the frame that is just above the stack pointer 844 // Sync an element of the frame that is just above the stack pointer
837 // by pushing it. 845 // by pushing it.
838 ASSERT(index == stack_pointer_ + 1); 846 ASSERT(index == stack_pointer_ + 1);
839 stack_pointer_++; 847 stack_pointer_++;
840 FrameElement element = elements_[index]; 848 FrameElement element = elements_[index];
841 849
842 switch (element.type()) { 850 switch (element.type()) {
843 case FrameElement::INVALID: 851 case FrameElement::INVALID:
844 __ push(Immediate(Smi::FromInt(0))); 852 __ Push(Smi::FromInt(0));
845 break; 853 break;
846 854
847 case FrameElement::MEMORY: 855 case FrameElement::MEMORY:
848 // No memory elements exist above the stack pointer. 856 // No memory elements exist above the stack pointer.
849 UNREACHABLE(); 857 UNREACHABLE();
850 break; 858 break;
851 859
852 case FrameElement::REGISTER: 860 case FrameElement::REGISTER:
853 __ push(element.reg()); 861 __ push(element.reg());
854 break; 862 break;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // IC expects arg count in rax, function in rdi, and the arguments 1006 // IC expects arg count in rax, function in rdi, and the arguments
999 // and receiver on the stack. 1007 // and receiver on the stack.
1000 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall)); 1008 Handle<Code> ic(Builtins::builtin(Builtins::JSConstructCall));
1001 // Duplicate the function before preparing the frame. 1009 // Duplicate the function before preparing the frame.
1002 PushElementAt(arg_count + 1); 1010 PushElementAt(arg_count + 1);
1003 Result function = Pop(); 1011 Result function = Pop();
1004 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver. 1012 PrepareForCall(arg_count + 1, arg_count + 1); // Spill args and receiver.
1005 function.ToRegister(rdi); 1013 function.ToRegister(rdi);
1006 1014
1007 // Constructors are called with the number of arguments in register 1015 // Constructors are called with the number of arguments in register
1008 // eax for now. Another option would be to have separate construct 1016 // rax for now. Another option would be to have separate construct
1009 // call trampolines per different arguments counts encountered. 1017 // call trampolines per different arguments counts encountered.
1010 Result num_args = cgen()->allocator()->Allocate(rax); 1018 Result num_args = cgen()->allocator()->Allocate(rax);
1011 ASSERT(num_args.is_valid()); 1019 ASSERT(num_args.is_valid());
1012 __ movq(num_args.reg(), Immediate(arg_count)); 1020 __ movq(num_args.reg(), Immediate(arg_count));
1013 1021
1014 function.Unuse(); 1022 function.Unuse();
1015 num_args.Unuse(); 1023 num_args.Unuse();
1016 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL); 1024 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL);
1017 } 1025 }
1018 1026
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 // Grow the expression stack by handler size less one (the return 1061 // Grow the expression stack by handler size less one (the return
1054 // address is already pushed by a call instruction). 1062 // address is already pushed by a call instruction).
1055 Adjust(kHandlerSize - 1); 1063 Adjust(kHandlerSize - 1);
1056 __ PushTryHandler(IN_JAVASCRIPT, type); 1064 __ PushTryHandler(IN_JAVASCRIPT, type);
1057 } 1065 }
1058 1066
1059 1067
1060 #undef __ 1068 #undef __
1061 1069
1062 } } // namespace v8::internal 1070 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/virtual-frame-x64.h ('k') | test/cctest/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698