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

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: Merge fix 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/code-stubs-ia32.cc ('k') | src/ia32/lithium-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 3817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3828 LPointerMap* pointers = instr->pointer_map(); 3828 LPointerMap* pointers = instr->pointer_map();
3829 SafepointGenerator generator( 3829 SafepointGenerator generator(
3830 this, pointers, Safepoint::kLazyDeopt); 3830 this, pointers, Safepoint::kLazyDeopt);
3831 ParameterCount count(arity); 3831 ParameterCount count(arity);
3832 ParameterCount expected(formal_parameter_count); 3832 ParameterCount expected(formal_parameter_count);
3833 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3833 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
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 EDI_UNINITIALIZED); 3844 if (instr->target()->IsConstantOperand()) {
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();
3845 } 3857 }
3846 3858
3847 3859
3860 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3861 ASSERT(ToRegister(instr->function()).is(edi));
3862 ASSERT(ToRegister(instr->result()).is(eax));
3863
3864 if (instr->hydrogen()->pass_argument_count()) {
3865 __ mov(eax, instr->arity());
3866 }
3867
3868 // Change context.
3869 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
3870
3871 bool is_self_call = false;
3872 if (instr->hydrogen()->function()->IsConstant()) {
3873 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
3874 Handle<JSFunction> jsfun =
3875 Handle<JSFunction>::cast(fun_const->handle(isolate()));
3876 is_self_call = jsfun.is_identical_to(info()->closure());
3877 }
3878
3879 if (is_self_call) {
3880 __ CallSelf();
3881 } else {
3882 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
3883 }
3884
3885 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3886 }
3887
3888
3848 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3889 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3849 Register input_reg = ToRegister(instr->value()); 3890 Register input_reg = ToRegister(instr->value());
3850 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 3891 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
3851 factory()->heap_number_map()); 3892 factory()->heap_number_map());
3852 DeoptimizeIf(not_equal, instr->environment()); 3893 DeoptimizeIf(not_equal, instr->environment());
3853 3894
3854 Label slow, allocated, done; 3895 Label slow, allocated, done;
3855 Register tmp = input_reg.is(eax) ? ecx : eax; 3896 Register tmp = input_reg.is(eax) ? ecx : eax;
3856 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; 3897 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx;
3857 3898
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
4205 } else { 4246 } else {
4206 CallKnownFunction(known_function, 4247 CallKnownFunction(known_function,
4207 instr->hydrogen()->formal_parameter_count(), 4248 instr->hydrogen()->formal_parameter_count(),
4208 instr->arity(), 4249 instr->arity(),
4209 instr, 4250 instr,
4210 EDI_CONTAINS_TARGET); 4251 EDI_CONTAINS_TARGET);
4211 } 4252 }
4212 } 4253 }
4213 4254
4214 4255
4215 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
4216 ASSERT(ToRegister(instr->context()).is(esi));
4217 ASSERT(ToRegister(instr->key()).is(ecx));
4218 ASSERT(ToRegister(instr->result()).is(eax));
4219
4220 int arity = instr->arity();
4221 Handle<Code> ic =
4222 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity);
4223 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4224 }
4225
4226
4227 void LCodeGen::DoCallNamed(LCallNamed* instr) {
4228 ASSERT(ToRegister(instr->context()).is(esi));
4229 ASSERT(ToRegister(instr->result()).is(eax));
4230
4231 int arity = instr->arity();
4232 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity);
4233 __ mov(ecx, instr->name());
4234 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4235 }
4236
4237
4238 void LCodeGen::DoCallFunction(LCallFunction* instr) { 4256 void LCodeGen::DoCallFunction(LCallFunction* instr) {
4239 ASSERT(ToRegister(instr->context()).is(esi)); 4257 ASSERT(ToRegister(instr->context()).is(esi));
4240 ASSERT(ToRegister(instr->function()).is(edi)); 4258 ASSERT(ToRegister(instr->function()).is(edi));
4241 ASSERT(ToRegister(instr->result()).is(eax)); 4259 ASSERT(ToRegister(instr->result()).is(eax));
4242 4260
4243 int arity = instr->arity(); 4261 int arity = instr->arity();
4244 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 4262 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
4245 if (instr->hydrogen()->IsTailCall()) { 4263 if (instr->hydrogen()->IsTailCall()) {
4246 if (NeedsEagerFrame()) __ leave(); 4264 if (NeedsEagerFrame()) __ leave();
4247 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); 4265 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
4248 } else { 4266 } else {
4249 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 4267 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
4250 } 4268 }
4251 } 4269 }
4252 4270
4253 4271
4254 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
4255 ASSERT(ToRegister(instr->result()).is(eax));
4256 CallKnownFunction(instr->hydrogen()->target(),
4257 instr->hydrogen()->formal_parameter_count(),
4258 instr->arity(),
4259 instr,
4260 EDI_UNINITIALIZED);
4261 }
4262
4263
4264 void LCodeGen::DoCallNew(LCallNew* instr) { 4272 void LCodeGen::DoCallNew(LCallNew* instr) {
4265 ASSERT(ToRegister(instr->context()).is(esi)); 4273 ASSERT(ToRegister(instr->context()).is(esi));
4266 ASSERT(ToRegister(instr->constructor()).is(edi)); 4274 ASSERT(ToRegister(instr->constructor()).is(edi));
4267 ASSERT(ToRegister(instr->result()).is(eax)); 4275 ASSERT(ToRegister(instr->result()).is(eax));
4268 4276
4269 // No cell in ebx for construct type feedback in optimized code 4277 // No cell in ebx for construct type feedback in optimized code
4270 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); 4278 Handle<Object> undefined_value(isolate()->factory()->undefined_value());
4271 __ mov(ebx, Immediate(undefined_value)); 4279 __ mov(ebx, Immediate(undefined_value));
4272 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 4280 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
4273 __ Set(eax, Immediate(instr->arity())); 4281 __ Set(eax, Immediate(instr->arity()));
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
6343 FixedArray::kHeaderSize - kPointerSize)); 6351 FixedArray::kHeaderSize - kPointerSize));
6344 __ bind(&done); 6352 __ bind(&done);
6345 } 6353 }
6346 6354
6347 6355
6348 #undef __ 6356 #undef __
6349 6357
6350 } } // namespace v8::internal 6358 } } // namespace v8::internal
6351 6359
6352 #endif // V8_TARGET_ARCH_IA32 6360 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698