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

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

Issue 137663005: MIPS: This is a preview of a first step towards unification of the hydrogen call machinery. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.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.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
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 3531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3542 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); 3542 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3543 } else { 3543 } else {
3544 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); 3544 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3545 ParameterCount count(arity); 3545 ParameterCount count(arity);
3546 ParameterCount expected(formal_parameter_count); 3546 ParameterCount expected(formal_parameter_count);
3547 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator); 3547 __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
3548 } 3548 }
3549 } 3549 }
3550 3550
3551 3551
3552 void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
3553 ASSERT(ToRegister(instr->result()).is(v0));
3554 __ mov(a0, v0);
3555 CallKnownFunction(instr->hydrogen()->function(),
3556 instr->hydrogen()->formal_parameter_count(),
3557 instr->arity(),
3558 instr,
3559 A1_UNINITIALIZED);
3560 }
3561
3562
3563 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3552 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3564 ASSERT(instr->context() != NULL); 3553 ASSERT(instr->context() != NULL);
3565 ASSERT(ToRegister(instr->context()).is(cp)); 3554 ASSERT(ToRegister(instr->context()).is(cp));
3566 Register input = ToRegister(instr->value()); 3555 Register input = ToRegister(instr->value());
3567 Register result = ToRegister(instr->result()); 3556 Register result = ToRegister(instr->result());
3568 Register scratch = scratch0(); 3557 Register scratch = scratch0();
3569 3558
3570 // Deoptimize if not a heap number. 3559 // Deoptimize if not a heap number.
3571 __ lw(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); 3560 __ lw(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
3572 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 3561 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3882 } else { 3871 } else {
3883 CallKnownFunction(known_function, 3872 CallKnownFunction(known_function,
3884 instr->hydrogen()->formal_parameter_count(), 3873 instr->hydrogen()->formal_parameter_count(),
3885 instr->arity(), 3874 instr->arity(),
3886 instr, 3875 instr,
3887 A1_CONTAINS_TARGET); 3876 A1_CONTAINS_TARGET);
3888 } 3877 }
3889 } 3878 }
3890 3879
3891 3880
3892 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 3881 void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
3893 ASSERT(ToRegister(instr->context()).is(cp));
3894 ASSERT(ToRegister(instr->result()).is(v0)); 3882 ASSERT(ToRegister(instr->result()).is(v0));
3895 3883
3896 int arity = instr->arity(); 3884 LPointerMap* pointers = instr->pointer_map();
3897 Handle<Code> ic = 3885 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
3898 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); 3886
3899 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3887 if (instr->target()->IsConstantOperand()) {
3888 LConstantOperand* target = LConstantOperand::cast(instr->target());
3889 Handle<Code> code = Handle<Code>::cast(ToHandle(target));
3890 generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET));
3891 __ Call(code, RelocInfo::CODE_TARGET);
3892 } else {
3893 ASSERT(instr->target()->IsRegister());
3894 Register target = ToRegister(instr->target());
3895 generator.BeforeCall(__ CallSize(target));
3896 __ Addu(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
3897 __ Call(target);
3898 }
3899 generator.AfterCall();
3900 } 3900 }
3901 3901
3902 3902
3903 void LCodeGen::DoCallNamed(LCallNamed* instr) { 3903 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
3904 ASSERT(ToRegister(instr->context()).is(cp)); 3904 ASSERT(ToRegister(instr->function()).is(a1));
3905 ASSERT(ToRegister(instr->result()).is(v0)); 3905 ASSERT(ToRegister(instr->result()).is(v0));
3906 3906
3907 int arity = instr->arity(); 3907 if (instr->hydrogen()->pass_argument_count()) {
3908 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arity); 3908 __ li(a0, Operand(instr->arity()));
3909 __ li(a2, Operand(instr->name())); 3909 }
3910 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3910
3911 // Change context.
3912 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
3913
3914 // Load the code entry address
3915 __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
3916 __ Call(at);
3917
3918 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
3911 } 3919 }
3912 3920
3913 3921
3914 void LCodeGen::DoCallFunction(LCallFunction* instr) { 3922 void LCodeGen::DoCallFunction(LCallFunction* instr) {
3915 ASSERT(ToRegister(instr->context()).is(cp)); 3923 ASSERT(ToRegister(instr->context()).is(cp));
3916 ASSERT(ToRegister(instr->function()).is(a1)); 3924 ASSERT(ToRegister(instr->function()).is(a1));
3917 ASSERT(ToRegister(instr->result()).is(v0)); 3925 ASSERT(ToRegister(instr->result()).is(v0));
3918 3926
3919 int arity = instr->arity(); 3927 int arity = instr->arity();
3920 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); 3928 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
3921 if (instr->hydrogen()->IsTailCall()) { 3929 if (instr->hydrogen()->IsTailCall()) {
3922 if (NeedsEagerFrame()) __ mov(sp, fp); 3930 if (NeedsEagerFrame()) __ mov(sp, fp);
3923 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); 3931 __ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
3924 } else { 3932 } else {
3925 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 3933 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
3926 } 3934 }
3927 } 3935 }
3928 3936
3929 3937
3930 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
3931 ASSERT(ToRegister(instr->result()).is(v0));
3932 CallKnownFunction(instr->hydrogen()->target(),
3933 instr->hydrogen()->formal_parameter_count(),
3934 instr->arity(),
3935 instr,
3936 A1_UNINITIALIZED);
3937 }
3938
3939
3940 void LCodeGen::DoCallNew(LCallNew* instr) { 3938 void LCodeGen::DoCallNew(LCallNew* instr) {
3941 ASSERT(ToRegister(instr->context()).is(cp)); 3939 ASSERT(ToRegister(instr->context()).is(cp));
3942 ASSERT(ToRegister(instr->constructor()).is(a1)); 3940 ASSERT(ToRegister(instr->constructor()).is(a1));
3943 ASSERT(ToRegister(instr->result()).is(v0)); 3941 ASSERT(ToRegister(instr->result()).is(v0));
3944 3942
3945 __ li(a0, Operand(instr->arity())); 3943 __ li(a0, Operand(instr->arity()));
3946 // No cell in a2 for construct type feedback in optimized code 3944 // No cell in a2 for construct type feedback in optimized code
3947 Handle<Object> undefined_value(isolate()->factory()->undefined_value()); 3945 Handle<Object> undefined_value(isolate()->factory()->undefined_value());
3948 __ li(a2, Operand(undefined_value)); 3946 __ li(a2, Operand(undefined_value));
3949 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); 3947 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
5793 __ Subu(scratch, result, scratch); 5791 __ Subu(scratch, result, scratch);
5794 __ lw(result, FieldMemOperand(scratch, 5792 __ lw(result, FieldMemOperand(scratch,
5795 FixedArray::kHeaderSize - kPointerSize)); 5793 FixedArray::kHeaderSize - kPointerSize));
5796 __ bind(&done); 5794 __ bind(&done);
5797 } 5795 }
5798 5796
5799 5797
5800 #undef __ 5798 #undef __
5801 5799
5802 } } // namespace v8::internal 5800 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698