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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 2470001: Change keyed load IC interface on x64 to pass arguments in registers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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/x64/debug-x64.cc ('k') | src/x64/ic-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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 // Rewritten parameter accesses are of the form "slot[literal]". 1169 // Rewritten parameter accesses are of the form "slot[literal]".
1170 1170
1171 // Assert that the object is in a slot. 1171 // Assert that the object is in a slot.
1172 Variable* object_var = property->obj()->AsVariableProxy()->AsVariable(); 1172 Variable* object_var = property->obj()->AsVariableProxy()->AsVariable();
1173 ASSERT_NOT_NULL(object_var); 1173 ASSERT_NOT_NULL(object_var);
1174 Slot* object_slot = object_var->slot(); 1174 Slot* object_slot = object_var->slot();
1175 ASSERT_NOT_NULL(object_slot); 1175 ASSERT_NOT_NULL(object_slot);
1176 1176
1177 // Load the object. 1177 // Load the object.
1178 MemOperand object_loc = EmitSlotSearch(object_slot, rax); 1178 MemOperand object_loc = EmitSlotSearch(object_slot, rax);
1179 __ push(object_loc); 1179 __ movq(rdx, object_loc);
1180 1180
1181 // Assert that the key is a smi. 1181 // Assert that the key is a smi.
1182 Literal* key_literal = property->key()->AsLiteral(); 1182 Literal* key_literal = property->key()->AsLiteral();
1183 ASSERT_NOT_NULL(key_literal); 1183 ASSERT_NOT_NULL(key_literal);
1184 ASSERT(key_literal->handle()->IsSmi()); 1184 ASSERT(key_literal->handle()->IsSmi());
1185 1185
1186 // Load the key. 1186 // Load the key.
1187 __ Push(key_literal->handle()); 1187 __ Move(rax, key_literal->handle());
1188 1188
1189 // Do a keyed property load. 1189 // Do a keyed property load.
1190 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1190 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1191 __ call(ic, RelocInfo::CODE_TARGET); 1191 __ call(ic, RelocInfo::CODE_TARGET);
1192 // Notice: We must not have a "test rax, ..." instruction after the 1192 // Notice: We must not have a "test rax, ..." instruction after the
1193 // call. It is treated specially by the LoadIC code. 1193 // call. It is treated specially by the LoadIC code.
1194 __ nop(); 1194 __ nop();
1195 // Drop key and object left on the stack by IC, and push the result. 1195 Apply(context, rax);
1196 DropAndApply(2, context, rax);
1197 } 1196 }
1198 } 1197 }
1199 1198
1200 1199
1201 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1200 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
1202 Comment cmnt(masm_, "[ RegExpLiteral"); 1201 Comment cmnt(masm_, "[ RegExpLiteral");
1203 Label done; 1202 Label done;
1204 // Registers will be used as follows: 1203 // Registers will be used as follows:
1205 // rdi = JS function. 1204 // rdi = JS function.
1206 // rbx = literals array. 1205 // rbx = literals array.
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 void FullCodeGenerator::VisitProperty(Property* expr) { 1691 void FullCodeGenerator::VisitProperty(Property* expr) {
1693 Comment cmnt(masm_, "[ Property"); 1692 Comment cmnt(masm_, "[ Property");
1694 Expression* key = expr->key(); 1693 Expression* key = expr->key();
1695 1694
1696 if (key->IsPropertyName()) { 1695 if (key->IsPropertyName()) {
1697 VisitForValue(expr->obj(), kAccumulator); 1696 VisitForValue(expr->obj(), kAccumulator);
1698 EmitNamedPropertyLoad(expr); 1697 EmitNamedPropertyLoad(expr);
1699 Apply(context_, rax); 1698 Apply(context_, rax);
1700 } else { 1699 } else {
1701 VisitForValue(expr->obj(), kStack); 1700 VisitForValue(expr->obj(), kStack);
1702 VisitForValue(expr->key(), kStack); 1701 VisitForValue(expr->key(), kAccumulator);
1702 __ pop(rdx);
1703 EmitKeyedPropertyLoad(expr); 1703 EmitKeyedPropertyLoad(expr);
1704 // Drop key and receiver left on the stack by IC. 1704 Apply(context_, rax);
1705 DropAndApply(2, context_, rax);
1706 } 1705 }
1707 } 1706 }
1708 1707
1709 1708
1710 void FullCodeGenerator::EmitCallWithIC(Call* expr, 1709 void FullCodeGenerator::EmitCallWithIC(Call* expr,
1711 Handle<Object> name, 1710 Handle<Object> name,
1712 RelocInfo::Mode mode) { 1711 RelocInfo::Mode mode) {
1713 // Code common for calls using the IC. 1712 // Code common for calls using the IC.
1714 ZoneList<Expression*>* args = expr->arguments(); 1713 ZoneList<Expression*>* args = expr->arguments();
1715 int arg_count = args->length(); 1714 int arg_count = args->length();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 Property* prop = fun->AsProperty(); 1816 Property* prop = fun->AsProperty();
1818 Literal* key = prop->key()->AsLiteral(); 1817 Literal* key = prop->key()->AsLiteral();
1819 if (key != NULL && key->handle()->IsSymbol()) { 1818 if (key != NULL && key->handle()->IsSymbol()) {
1820 // Call to a named property, use call IC. 1819 // Call to a named property, use call IC.
1821 VisitForValue(prop->obj(), kStack); 1820 VisitForValue(prop->obj(), kStack);
1822 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); 1821 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
1823 } else { 1822 } else {
1824 // Call to a keyed property, use keyed load IC followed by function 1823 // Call to a keyed property, use keyed load IC followed by function
1825 // call. 1824 // call.
1826 VisitForValue(prop->obj(), kStack); 1825 VisitForValue(prop->obj(), kStack);
1827 VisitForValue(prop->key(), kStack); 1826 VisitForValue(prop->key(), kAccumulator);
1827 __ movq(rdx, Operand(rsp, 0));
1828 // Record source code position for IC call. 1828 // Record source code position for IC call.
1829 SetSourcePosition(prop->position()); 1829 SetSourcePosition(prop->position());
1830 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1830 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1831 __ call(ic, RelocInfo::CODE_TARGET); 1831 __ call(ic, RelocInfo::CODE_TARGET);
1832 // By emitting a nop we make sure that we do not have a "test rax,..." 1832 // By emitting a nop we make sure that we do not have a "test rax,..."
1833 // instruction after the call it is treated specially by the LoadIC code. 1833 // instruction after the call it is treated specially by the LoadIC code.
1834 __ nop(); 1834 __ nop();
1835 // Drop key left on the stack by IC.
1836 __ Drop(1);
1837 // Pop receiver. 1835 // Pop receiver.
1838 __ pop(rbx); 1836 __ pop(rbx);
1839 // Push result (function). 1837 // Push result (function).
1840 __ push(rax); 1838 __ push(rax);
1841 // Push receiver object on stack. 1839 // Push receiver object on stack.
1842 if (prop->is_synthetic()) { 1840 if (prop->is_synthetic()) {
1843 __ movq(rcx, CodeGenerator::GlobalObject()); 1841 __ movq(rcx, CodeGenerator::GlobalObject());
1844 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); 1842 __ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
1845 } else { 1843 } else {
1846 __ push(rbx); 1844 __ push(rbx);
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 // Reserve space for result of postfix operation. 2856 // Reserve space for result of postfix operation.
2859 if (expr->is_postfix() && context_ != Expression::kEffect) { 2857 if (expr->is_postfix() && context_ != Expression::kEffect) {
2860 __ Push(Smi::FromInt(0)); 2858 __ Push(Smi::FromInt(0));
2861 } 2859 }
2862 if (assign_type == NAMED_PROPERTY) { 2860 if (assign_type == NAMED_PROPERTY) {
2863 VisitForValue(prop->obj(), kAccumulator); 2861 VisitForValue(prop->obj(), kAccumulator);
2864 __ push(rax); // Copy of receiver, needed for later store. 2862 __ push(rax); // Copy of receiver, needed for later store.
2865 EmitNamedPropertyLoad(prop); 2863 EmitNamedPropertyLoad(prop);
2866 } else { 2864 } else {
2867 VisitForValue(prop->obj(), kStack); 2865 VisitForValue(prop->obj(), kStack);
2868 VisitForValue(prop->key(), kStack); 2866 VisitForValue(prop->key(), kAccumulator);
2867 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack
2868 __ push(rax); // Copy of key, needed for later store.
2869 EmitKeyedPropertyLoad(prop); 2869 EmitKeyedPropertyLoad(prop);
2870 } 2870 }
2871 } 2871 }
2872 2872
2873 // Call ToNumber only if operand is not a smi. 2873 // Call ToNumber only if operand is not a smi.
2874 Label no_conversion; 2874 Label no_conversion;
2875 Condition is_smi; 2875 Condition is_smi;
2876 is_smi = masm_->CheckSmi(rax); 2876 is_smi = masm_->CheckSmi(rax);
2877 __ j(is_smi, &no_conversion); 2877 __ j(is_smi, &no_conversion);
2878 __ push(rax); 2878 __ push(rax);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 __ ret(0); 3214 __ ret(0);
3215 } 3215 }
3216 3216
3217 3217
3218 #undef __ 3218 #undef __
3219 3219
3220 3220
3221 } } // namespace v8::internal 3221 } } // namespace v8::internal
3222 3222
3223 #endif // V8_TARGET_ARCH_X64 3223 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/debug-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698