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

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

Powered by Google App Engine
This is Rietveld 408576698