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

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

Issue 104663004: Preview of a first step towards unification of hydrogen calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed code review comments 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
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 3817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3828 SafepointGenerator generator( 3828 SafepointGenerator generator(
3829 this, pointers, Safepoint::kLazyDeopt); 3829 this, pointers, Safepoint::kLazyDeopt);
3830 ParameterCount count(arity); 3830 ParameterCount count(arity);
3831 ParameterCount expected(formal_parameter_count); 3831 ParameterCount expected(formal_parameter_count);
3832 __ InvokeFunction( 3832 __ InvokeFunction(
3833 function, expected, count, CALL_FUNCTION, generator, call_kind); 3833 function, expected, count, CALL_FUNCTION, generator, call_kind);
3834 } 3834 }
3835 } 3835 }
3836 3836
3837 3837
3838 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { 3838 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
3839 ASSERT(ToRegister(instr->result()).is(eax)); 3839 ASSERT(ToRegister(instr->result()).is(eax));
3840 CallKnownFunction(instr->hydrogen()->function(), 3840
3841 instr->hydrogen()->formal_parameter_count(), 3841 LPointerMap* pointers = instr->pointer_map();
3842 instr->arity(), 3842 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3843 instr, 3843
3844 CALL_AS_METHOD, 3844 if (instr->target()->IsConstantOperand()) {
3845 EDI_UNINITIALIZED); 3845 LConstantOperand* target = LConstantOperand::cast(instr->target());
3846 Handle<Code> code = Handle<Code>::cast(ToHandle(target));
3847 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET));
3848 __ call(code, RelocInfo::CODE_TARGET);
3849 } else {
3850 ASSERT(instr->target()->IsRegister());
3851 Register target = ToRegister(instr->target());
3852 generator.BeforeCall(__ CallSize(Operand(target)));
3853 __ add(target, Immediate(Code::kHeaderSize - kHeapObjectTag));
3854 __ call(target);
3855 }
3856 generator.AfterCall();
3846 } 3857 }
3847 3858
3848 3859
3860 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3861 ASSERT(ToRegister(instr->function()).is(edi));
3862 ASSERT(ToRegister(instr->call_kind()).is(ecx));
3863 ASSERT(ToRegister(instr->result()).is(eax));
3864
3865 if (instr->hydrogen()->pass_argument_count()) {
3866 __ mov(eax, instr->arity());
3867 }
3868
3869 // Change context.
3870 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3871
3872 bool is_self_call = false;
3873 if (instr->hydrogen()->function()->IsConstant()) {
3874 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
3875 Handle<JSFunction> jsfun =
3876 Handle<JSFunction>::cast(fun_const->handle(isolate()));
3877 is_self_call = jsfun.is_identical_to(info()->closure());
3878 }
3879
3880 if (is_self_call) {
3881 __ CallSelf();
3882 } else {
3883 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
3884 }
3885
3886 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3887 }
3888
3889
3849 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3890 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3850 Register input_reg = ToRegister(instr->value()); 3891 Register input_reg = ToRegister(instr->value());
3851 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 3892 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
3852 factory()->heap_number_map()); 3893 factory()->heap_number_map());
3853 DeoptimizeIf(not_equal, instr->environment()); 3894 DeoptimizeIf(not_equal, instr->environment());
3854 3895
3855 Label slow, allocated, done; 3896 Label slow, allocated, done;
3856 Register tmp = input_reg.is(eax) ? ecx : eax; 3897 Register tmp = input_reg.is(eax) ? ecx : eax;
3857 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; 3898 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx;
3858 3899
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
4207 CallKnownFunction(known_function, 4248 CallKnownFunction(known_function,
4208 instr->hydrogen()->formal_parameter_count(), 4249 instr->hydrogen()->formal_parameter_count(),
4209 instr->arity(), 4250 instr->arity(),
4210 instr, 4251 instr,
4211 CALL_AS_METHOD, 4252 CALL_AS_METHOD,
4212 EDI_CONTAINS_TARGET); 4253 EDI_CONTAINS_TARGET);
4213 } 4254 }
4214 } 4255 }
4215 4256
4216 4257
4217 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
4218 ASSERT(ToRegister(instr->context()).is(esi));
4219 ASSERT(ToRegister(instr->key()).is(ecx));
4220 ASSERT(ToRegister(instr->result()).is(eax));
4221
4222 int arity = instr->arity();
4223 Handle<Code> ic =
4224 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity);
4225 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4226 }
4227
4228
4229 void LCodeGen::DoCallNamed(LCallNamed* instr) {
4230 ASSERT(ToRegister(instr->context()).is(esi));
4231 ASSERT(ToRegister(instr->result()).is(eax));
4232
4233 int arity = instr->arity();
4234 RelocInfo::Mode mode = RelocInfo::CODE_TARGET;
4235 Handle<Code> ic =
4236 isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
4237 __ mov(ecx, instr->name());
4238 CallCode(ic, mode, instr);
4239 }
4240
4241
4242 void LCodeGen::DoCallFunction(LCallFunction* instr) { 4258 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4243 ASSERT(ToRegister(instr->context()).is(esi)); 4259 ASSERT(ToRegister(instr->context()).is(esi));
4244 ASSERT(ToRegister(instr->function()).is(edi)); 4260 ASSERT(ToRegister(instr->function()).is(edi));
4245 ASSERT(ToRegister(instr->result()).is(eax)); 4261 ASSERT(ToRegister(instr->result()).is(eax));
4246 4262
4247 int arity = instr->arity(); 4263 int arity = instr->arity();
4248 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 4264 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
4249 if (instr->hydrogen()->IsTailCall()) { 4265 if (instr->hydrogen()->IsTailCall()) {
4250 if (NeedsEagerFrame()) __ leave(); 4266 if (NeedsEagerFrame()) __ leave();
4251 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); 4267 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
4252 } else { 4268 } else {
4253 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 4269 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4254 } 4270 }
4255 } 4271 }
4256 4272
4257 4273
4258 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { 4274 void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
4259 ASSERT(ToRegister(instr->context()).is(esi)); 4275 ASSERT(ToRegister(instr->context()).is(esi));
4260 ASSERT(ToRegister(instr->result()).is(eax)); 4276 ASSERT(ToRegister(instr->result()).is(eax));
4261 4277
4262 int arity = instr->arity(); 4278 int arity = instr->arity();
4263 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; 4279 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT;
4264 Handle<Code> ic = 4280 Handle<Code> ic =
4265 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); 4281 isolate()->stub_cache()->ComputeCallInitialize(arity, mode);
4266 __ mov(ecx, instr->name()); 4282 __ mov(ecx, instr->name());
4267 CallCode(ic, mode, instr); 4283 CallCode(ic, mode, instr);
4268 } 4284 }
4269 4285
4270 4286
4271 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
4272 ASSERT(ToRegister(instr->result()).is(eax));
4273 CallKnownFunction(instr->hydrogen()->target(),
4274 instr->hydrogen()->formal_parameter_count(),
4275 instr->arity(),
4276 instr,
4277 CALL_AS_FUNCTION,
4278 EDI_UNINITIALIZED);
4279 }
4280
4281
4282 void LCodeGen::DoCallNew(LCallNew* instr) { 4287 void LCodeGen::DoCallNew(LCallNew* instr) {
4283 ASSERT(ToRegister(instr->context()).is(esi)); 4288 ASSERT(ToRegister(instr->context()).is(esi));
4284 ASSERT(ToRegister(instr->constructor()).is(edi)); 4289 ASSERT(ToRegister(instr->constructor()).is(edi));
4285 ASSERT(ToRegister(instr->result()).is(eax)); 4290 ASSERT(ToRegister(instr->result()).is(eax));
4286 4291
4287 // No cell in ebx for construct type feedback in optimized code 4292 // No cell in ebx for construct type feedback in optimized code
4288 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); 4293 Handle<Object> undefined_value(isolate()->factory()->undefined_value());
4289 __ mov(ebx, Immediate(undefined_value)); 4294 __ mov(ebx, Immediate(undefined_value));
4290 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 4295 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
4291 __ Set(eax, Immediate(instr->arity())); 4296 __ Set(eax, Immediate(instr->arity()));
(...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after
6363 FixedArray::kHeaderSize - kPointerSize)); 6368 FixedArray::kHeaderSize - kPointerSize));
6364 __ bind(&done); 6369 __ bind(&done);
6365 } 6370 }
6366 6371
6367 6372
6368 #undef __ 6373 #undef __
6369 6374
6370 } } // namespace v8::internal 6375 } } // namespace v8::internal
6371 6376
6372 #endif // V8_TARGET_ARCH_IA32 6377 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698