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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 136403005: Remove CALL_AS_FUNCTION and CALL_AS_METHOD. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Don't store/restore ecx/rcx/r5 given that it doesn't contain callkind anymore Created 6 years, 11 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('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 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 #endif 176 #endif
177 177
178 // Classic mode functions and builtins need to replace the receiver with the 178 // Classic mode functions and builtins need to replace the receiver with the
179 // global proxy when called as functions (without an explicit receiver 179 // global proxy when called as functions (without an explicit receiver
180 // object). 180 // object).
181 if (info_->this_has_uses() && 181 if (info_->this_has_uses() &&
182 info_->is_classic_mode() && 182 info_->is_classic_mode() &&
183 !info_->is_native()) { 183 !info_->is_native()) {
184 Label ok; 184 Label ok;
185 __ test(ecx, ecx);
186 __ j(zero, &ok, Label::kNear);
187
188 // +1 for return address. 185 // +1 for return address.
189 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; 186 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
190 __ mov(ecx, Operand(esp, receiver_offset)); 187 __ mov(ecx, Operand(esp, receiver_offset));
191 188
192 __ cmp(ecx, isolate()->factory()->undefined_value()); 189 __ cmp(ecx, isolate()->factory()->undefined_value());
193 __ j(not_equal, &ok, Label::kNear); 190 __ j(not_equal, &ok, Label::kNear);
194 191
195 __ mov(ecx, GlobalObjectOperand()); 192 __ mov(ecx, GlobalObjectOperand());
196 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); 193 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
197 194
(...skipping 3521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3719 __ dec(length); 3716 __ dec(length);
3720 __ j(not_zero, &loop); 3717 __ j(not_zero, &loop);
3721 3718
3722 // Invoke the function. 3719 // Invoke the function.
3723 __ bind(&invoke); 3720 __ bind(&invoke);
3724 ASSERT(instr->HasPointerMap()); 3721 ASSERT(instr->HasPointerMap());
3725 LPointerMap* pointers = instr->pointer_map(); 3722 LPointerMap* pointers = instr->pointer_map();
3726 SafepointGenerator safepoint_generator( 3723 SafepointGenerator safepoint_generator(
3727 this, pointers, Safepoint::kLazyDeopt); 3724 this, pointers, Safepoint::kLazyDeopt);
3728 ParameterCount actual(eax); 3725 ParameterCount actual(eax);
3729 __ InvokeFunction(function, actual, CALL_FUNCTION, 3726 __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator);
3730 safepoint_generator, CALL_AS_FUNCTION);
3731 } 3727 }
3732 3728
3733 3729
3734 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 3730 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
3735 __ int3(); 3731 __ int3();
3736 } 3732 }
3737 3733
3738 3734
3739 void LCodeGen::DoPushArgument(LPushArgument* instr) { 3735 void LCodeGen::DoPushArgument(LPushArgument* instr) {
3740 LOperand* argument = instr->value(); 3736 LOperand* argument = instr->value();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3793 Register global = ToRegister(instr->global()); 3789 Register global = ToRegister(instr->global());
3794 Register result = ToRegister(instr->result()); 3790 Register result = ToRegister(instr->result());
3795 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset)); 3791 __ mov(result, FieldOperand(global, GlobalObject::kGlobalReceiverOffset));
3796 } 3792 }
3797 3793
3798 3794
3799 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, 3795 void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
3800 int formal_parameter_count, 3796 int formal_parameter_count,
3801 int arity, 3797 int arity,
3802 LInstruction* instr, 3798 LInstruction* instr,
3803 CallKind call_kind,
3804 EDIState edi_state) { 3799 EDIState edi_state) {
3805 bool dont_adapt_arguments = 3800 bool dont_adapt_arguments =
3806 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; 3801 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
3807 bool can_invoke_directly = 3802 bool can_invoke_directly =
3808 dont_adapt_arguments || formal_parameter_count == arity; 3803 dont_adapt_arguments || formal_parameter_count == arity;
3809 3804
3810 if (can_invoke_directly) { 3805 if (can_invoke_directly) {
3811 if (edi_state == EDI_UNINITIALIZED) { 3806 if (edi_state == EDI_UNINITIALIZED) {
3812 __ LoadHeapObject(edi, function); 3807 __ LoadHeapObject(edi, function);
3813 } 3808 }
3814 3809
3815 // Change context. 3810 // Change context.
3816 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 3811 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3817 3812
3818 // Set eax to arguments count if adaption is not needed. Assumes that eax 3813 // Set eax to arguments count if adaption is not needed. Assumes that eax
3819 // is available to write to at this point. 3814 // is available to write to at this point.
3820 if (dont_adapt_arguments) { 3815 if (dont_adapt_arguments) {
3821 __ mov(eax, arity); 3816 __ mov(eax, arity);
3822 } 3817 }
3823 3818
3824 // Invoke function directly. 3819 // Invoke function directly.
3825 __ SetCallKind(ecx, call_kind);
3826 if (function.is_identical_to(info()->closure())) { 3820 if (function.is_identical_to(info()->closure())) {
3827 __ CallSelf(); 3821 __ CallSelf();
3828 } else { 3822 } else {
3829 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); 3823 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
3830 } 3824 }
3831 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3825 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3832 } else { 3826 } else {
3833 // We need to adapt arguments. 3827 // We need to adapt arguments.
3834 LPointerMap* pointers = instr->pointer_map(); 3828 LPointerMap* pointers = instr->pointer_map();
3835 SafepointGenerator generator( 3829 SafepointGenerator generator(
3836 this, pointers, Safepoint::kLazyDeopt); 3830 this, pointers, Safepoint::kLazyDeopt);
3837 ParameterCount count(arity); 3831 ParameterCount count(arity);
3838 ParameterCount expected(formal_parameter_count); 3832 ParameterCount expected(formal_parameter_count);
3839 __ InvokeFunction( 3833 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
3840 function, expected, count, CALL_FUNCTION, generator, call_kind);
3841 } 3834 }
3842 } 3835 }
3843 3836
3844 3837
3845 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { 3838 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
3846 ASSERT(ToRegister(instr->result()).is(eax)); 3839 ASSERT(ToRegister(instr->result()).is(eax));
3847 CallKnownFunction(instr->hydrogen()->function(), 3840 CallKnownFunction(instr->hydrogen()->function(),
3848 instr->hydrogen()->formal_parameter_count(), 3841 instr->hydrogen()->formal_parameter_count(),
3849 instr->arity(), 3842 instr->arity(),
3850 instr, 3843 instr,
3851 CALL_AS_FUNCTION,
3852 EDI_UNINITIALIZED); 3844 EDI_UNINITIALIZED);
3853 } 3845 }
3854 3846
3855 3847
3856 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3848 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3857 Register input_reg = ToRegister(instr->value()); 3849 Register input_reg = ToRegister(instr->value());
3858 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 3850 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
3859 factory()->heap_number_map()); 3851 factory()->heap_number_map());
3860 DeoptimizeIf(not_equal, instr->environment()); 3852 DeoptimizeIf(not_equal, instr->environment());
3861 3853
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4202 ASSERT(ToRegister(instr->context()).is(esi)); 4194 ASSERT(ToRegister(instr->context()).is(esi));
4203 ASSERT(ToRegister(instr->function()).is(edi)); 4195 ASSERT(ToRegister(instr->function()).is(edi));
4204 ASSERT(instr->HasPointerMap()); 4196 ASSERT(instr->HasPointerMap());
4205 4197
4206 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); 4198 Handle<JSFunction> known_function = instr->hydrogen()->known_function();
4207 if (known_function.is_null()) { 4199 if (known_function.is_null()) {
4208 LPointerMap* pointers = instr->pointer_map(); 4200 LPointerMap* pointers = instr->pointer_map();
4209 SafepointGenerator generator( 4201 SafepointGenerator generator(
4210 this, pointers, Safepoint::kLazyDeopt); 4202 this, pointers, Safepoint::kLazyDeopt);
4211 ParameterCount count(instr->arity()); 4203 ParameterCount count(instr->arity());
4212 __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION); 4204 __ InvokeFunction(edi, count, CALL_FUNCTION, generator);
4213 } else { 4205 } else {
4214 CallKnownFunction(known_function, 4206 CallKnownFunction(known_function,
4215 instr->hydrogen()->formal_parameter_count(), 4207 instr->hydrogen()->formal_parameter_count(),
4216 instr->arity(), 4208 instr->arity(),
4217 instr, 4209 instr,
4218 CALL_AS_FUNCTION,
4219 EDI_CONTAINS_TARGET); 4210 EDI_CONTAINS_TARGET);
4220 } 4211 }
4221 } 4212 }
4222 4213
4223 4214
4224 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 4215 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
4225 ASSERT(ToRegister(instr->context()).is(esi)); 4216 ASSERT(ToRegister(instr->context()).is(esi));
4226 ASSERT(ToRegister(instr->key()).is(ecx)); 4217 ASSERT(ToRegister(instr->key()).is(ecx));
4227 ASSERT(ToRegister(instr->result()).is(eax)); 4218 ASSERT(ToRegister(instr->result()).is(eax));
4228 4219
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4272 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4263 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4273 } 4264 }
4274 4265
4275 4266
4276 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { 4267 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
4277 ASSERT(ToRegister(instr->result()).is(eax)); 4268 ASSERT(ToRegister(instr->result()).is(eax));
4278 CallKnownFunction(instr->hydrogen()->target(), 4269 CallKnownFunction(instr->hydrogen()->target(),
4279 instr->hydrogen()->formal_parameter_count(), 4270 instr->hydrogen()->formal_parameter_count(),
4280 instr->arity(), 4271 instr->arity(),
4281 instr, 4272 instr,
4282 CALL_AS_FUNCTION,
4283 EDI_UNINITIALIZED); 4273 EDI_UNINITIALIZED);
4284 } 4274 }
4285 4275
4286 4276
4287 void LCodeGen::DoCallNew(LCallNew* instr) { 4277 void LCodeGen::DoCallNew(LCallNew* instr) {
4288 ASSERT(ToRegister(instr->context()).is(esi)); 4278 ASSERT(ToRegister(instr->context()).is(esi));
4289 ASSERT(ToRegister(instr->constructor()).is(edi)); 4279 ASSERT(ToRegister(instr->constructor()).is(edi));
4290 ASSERT(ToRegister(instr->result()).is(eax)); 4280 ASSERT(ToRegister(instr->result()).is(eax));
4291 4281
4292 // No cell in ebx for construct type feedback in optimized code 4282 // No cell in ebx for construct type feedback in optimized code
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
6366 FixedArray::kHeaderSize - kPointerSize)); 6356 FixedArray::kHeaderSize - kPointerSize));
6367 __ bind(&done); 6357 __ bind(&done);
6368 } 6358 }
6369 6359
6370 6360
6371 #undef __ 6361 #undef __
6372 6362
6373 } } // namespace v8::internal 6363 } } // namespace v8::internal
6374 6364
6375 #endif // V8_TARGET_ARCH_IA32 6365 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698