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

Side by Side Diff: src/codegen-arm.cc

Issue 3186: Refactor the enum RelocMode changing the naming scheme from lower case to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 3 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/codegen.cc ('k') | src/codegen-ia32.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void ArmCodeGenerator::LoadTypeofExpression(Expression* x) { 819 void ArmCodeGenerator::LoadTypeofExpression(Expression* x) {
820 Variable* variable = x->AsVariableProxy()->AsVariable(); 820 Variable* variable = x->AsVariableProxy()->AsVariable();
821 if (variable != NULL && !variable->is_this() && variable->is_global()) { 821 if (variable != NULL && !variable->is_this() && variable->is_global()) {
822 // NOTE: This is somewhat nasty. We force the compiler to load 822 // NOTE: This is somewhat nasty. We force the compiler to load
823 // the variable as if through '<global>.<variable>' to make sure we 823 // the variable as if through '<global>.<variable>' to make sure we
824 // do not get reference errors. 824 // do not get reference errors.
825 Slot global(variable, Slot::CONTEXT, Context::GLOBAL_INDEX); 825 Slot global(variable, Slot::CONTEXT, Context::GLOBAL_INDEX);
826 Literal key(variable->name()); 826 Literal key(variable->name());
827 // TODO(1241834): Fetch the position from the variable instead of using 827 // TODO(1241834): Fetch the position from the variable instead of using
828 // no position. 828 // no position.
829 Property property(&global, &key, kNoPosition); 829 Property property(&global, &key, RelocInfo::kNoPosition);
830 Load(&property); 830 Load(&property);
831 } else { 831 } else {
832 Load(x, CodeGenState::LOAD_TYPEOF_EXPR); 832 Load(x, CodeGenState::LOAD_TYPEOF_EXPR);
833 } 833 }
834 } 834 }
835 835
836 836
837 Reference::Reference(ArmCodeGenerator* cgen, Expression* expression) 837 Reference::Reference(ArmCodeGenerator* cgen, Expression* expression)
838 : cgen_(cgen), expression_(expression), type_(ILLEGAL) { 838 : cgen_(cgen), expression_(expression), type_(ILLEGAL) {
839 cgen->LoadReference(this); 839 cgen->LoadReference(this);
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 void CEntryStub::GenerateCore(MacroAssembler* masm, 1629 void CEntryStub::GenerateCore(MacroAssembler* masm,
1630 Label* throw_normal_exception, 1630 Label* throw_normal_exception,
1631 Label* throw_out_of_memory_exception, 1631 Label* throw_out_of_memory_exception,
1632 bool do_gc, 1632 bool do_gc,
1633 bool do_restore) { 1633 bool do_restore) {
1634 // r0: result parameter for PerformGC, if any 1634 // r0: result parameter for PerformGC, if any
1635 // r4: number of arguments including receiver (C callee-saved) 1635 // r4: number of arguments including receiver (C callee-saved)
1636 // r5: pointer to builtin function (C callee-saved) 1636 // r5: pointer to builtin function (C callee-saved)
1637 1637
1638 if (do_gc) { 1638 if (do_gc) {
1639 __ Call(FUNCTION_ADDR(Runtime::PerformGC), runtime_entry); // passing r0 1639 // Passing r0.
1640 __ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY);
1640 } 1641 }
1641 1642
1642 // Call C built-in. 1643 // Call C built-in.
1643 // r0 = argc. 1644 // r0 = argc.
1644 __ mov(r0, Operand(r4)); 1645 __ mov(r0, Operand(r4));
1645 // r1 = argv. 1646 // r1 = argv.
1646 __ add(r1, fp, Operand(r4, LSL, kPointerSizeLog2)); 1647 __ add(r1, fp, Operand(r4, LSL, kPointerSizeLog2));
1647 __ add(r1, r1, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize)); 1648 __ add(r1, r1, Operand(ExitFrameConstants::kPPDisplacement - kPointerSize));
1648 1649
1649 // TODO(1242173): To let the GC traverse the return address of the exit 1650 // TODO(1242173): To let the GC traverse the return address of the exit
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 Literal* literal = key->AsLiteral(); 2060 Literal* literal = key->AsLiteral();
2060 Handle<String> name(String::cast(*literal->handle())); 2061 Handle<String> name(String::cast(*literal->handle()));
2061 2062
2062 // Call the appropriate IC code. 2063 // Call the appropriate IC code.
2063 // Setup the name register. 2064 // Setup the name register.
2064 __ mov(r2, Operand(name)); 2065 __ mov(r2, Operand(name));
2065 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 2066 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
2066 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable(); 2067 Variable* var = ref()->expression()->AsVariableProxy()->AsVariable();
2067 if (var != NULL) { 2068 if (var != NULL) {
2068 ASSERT(var->is_global()); 2069 ASSERT(var->is_global());
2069 __ Call(ic, code_target_context); 2070 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
2070 } else { 2071 } else {
2071 __ Call(ic, code_target); 2072 __ Call(ic, RelocInfo::CODE_TARGET);
2072 } 2073 }
2073 2074
2074 } else { 2075 } else {
2075 // Access keyed property. 2076 // Access keyed property.
2076 ASSERT(type == Reference::KEYED); 2077 ASSERT(type == Reference::KEYED);
2077 2078
2078 // TODO(1224671): Implement inline caching for keyed loads as on ia32. 2079 // TODO(1224671): Implement inline caching for keyed loads as on ia32.
2079 GetPropertyStub stub; 2080 GetPropertyStub stub;
2080 __ CallStub(&stub); 2081 __ CallStub(&stub);
2081 } 2082 }
(...skipping 10 matching lines...) Expand all
2092 if (type == Reference::NAMED) { 2093 if (type == Reference::NAMED) {
2093 // Compute the name of the property. 2094 // Compute the name of the property.
2094 Literal* literal = key->AsLiteral(); 2095 Literal* literal = key->AsLiteral();
2095 Handle<String> name(String::cast(*literal->handle())); 2096 Handle<String> name(String::cast(*literal->handle()));
2096 2097
2097 // Call the appropriate IC code. 2098 // Call the appropriate IC code.
2098 masm->pop(r0); // value 2099 masm->pop(r0); // value
2099 // Setup the name register. 2100 // Setup the name register.
2100 masm->mov(r2, Operand(name)); 2101 masm->mov(r2, Operand(name));
2101 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 2102 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
2102 masm->Call(ic, code_target); 2103 masm->Call(ic, RelocInfo::CODE_TARGET);
2103 2104
2104 } else { 2105 } else {
2105 // Access keyed property. 2106 // Access keyed property.
2106 ASSERT(type == Reference::KEYED); 2107 ASSERT(type == Reference::KEYED);
2107 2108
2108 masm->pop(r0); // value 2109 masm->pop(r0); // value
2109 SetPropertyStub stub; 2110 SetPropertyStub stub;
2110 masm->CallStub(&stub); 2111 masm->CallStub(&stub);
2111 } 2112 }
2112 masm->push(r0); 2113 masm->push(r0);
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3698 __ mov(r0, Operand(var->name())); 3699 __ mov(r0, Operand(var->name()));
3699 __ push(r0); 3700 __ push(r0);
3700 LoadGlobal(); 3701 LoadGlobal();
3701 3702
3702 // Load the arguments. 3703 // Load the arguments.
3703 for (int i = 0; i < args->length(); i++) Load(args->at(i)); 3704 for (int i = 0; i < args->length(); i++) Load(args->at(i));
3704 3705
3705 // Setup the receiver register and call the IC initialization code. 3706 // Setup the receiver register and call the IC initialization code.
3706 Handle<Code> stub = ComputeCallInitialize(args->length()); 3707 Handle<Code> stub = ComputeCallInitialize(args->length());
3707 __ RecordPosition(node->position()); 3708 __ RecordPosition(node->position());
3708 __ Call(stub, code_target_context); 3709 __ Call(stub, RelocInfo::CODE_TARGET_CONTEXT);
3709 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3710 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3710 // Remove the function from the stack. 3711 // Remove the function from the stack.
3711 __ pop(); 3712 __ pop();
3712 __ push(r0); 3713 __ push(r0);
3713 3714
3714 } else if (var != NULL && var->slot() != NULL && 3715 } else if (var != NULL && var->slot() != NULL &&
3715 var->slot()->type() == Slot::LOOKUP) { 3716 var->slot()->type() == Slot::LOOKUP) {
3716 // ---------------------------------- 3717 // ----------------------------------
3717 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj 3718 // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj
3718 // ---------------------------------- 3719 // ----------------------------------
(...skipping 26 matching lines...) Expand all
3745 __ mov(r0, Operand(literal->handle())); 3746 __ mov(r0, Operand(literal->handle()));
3746 __ push(r0); 3747 __ push(r0);
3747 Load(property->obj()); 3748 Load(property->obj());
3748 3749
3749 // Load the arguments. 3750 // Load the arguments.
3750 for (int i = 0; i < args->length(); i++) Load(args->at(i)); 3751 for (int i = 0; i < args->length(); i++) Load(args->at(i));
3751 3752
3752 // Set the receiver register and call the IC initialization code. 3753 // Set the receiver register and call the IC initialization code.
3753 Handle<Code> stub = ComputeCallInitialize(args->length()); 3754 Handle<Code> stub = ComputeCallInitialize(args->length());
3754 __ RecordPosition(node->position()); 3755 __ RecordPosition(node->position());
3755 __ Call(stub, code_target); 3756 __ Call(stub, RelocInfo::CODE_TARGET);
3756 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3757 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3757 3758
3758 // Remove the function from the stack. 3759 // Remove the function from the stack.
3759 __ pop(); 3760 __ pop();
3760 3761
3761 __ push(r0); // push after get rid of function from the stack 3762 __ push(r0); // push after get rid of function from the stack
3762 3763
3763 } else { 3764 } else {
3764 // ------------------------------------------- 3765 // -------------------------------------------
3765 // JavaScript example: 'array[index](1, 2, 3)' 3766 // JavaScript example: 'array[index](1, 2, 3)'
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3812 for (int i = 0; i < args->length(); i++) Load(args->at(i)); 3813 for (int i = 0; i < args->length(); i++) Load(args->at(i));
3813 3814
3814 // r0: the number of arguments. 3815 // r0: the number of arguments.
3815 __ mov(r0, Operand(args->length())); 3816 __ mov(r0, Operand(args->length()));
3816 3817
3817 // Load the function into r1 as per calling convention. 3818 // Load the function into r1 as per calling convention.
3818 __ ldr(r1, MemOperand(sp, (args->length() + 1) * kPointerSize)); 3819 __ ldr(r1, MemOperand(sp, (args->length() + 1) * kPointerSize));
3819 3820
3820 // Call the construct call builtin that handles allocation and 3821 // Call the construct call builtin that handles allocation and
3821 // constructor invocation. 3822 // constructor invocation.
3822 __ RecordPosition(position); 3823 __ RecordPosition(RelocInfo::POSITION);
3823 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), 3824 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)),
3824 js_construct_call); 3825 RelocInfo::CONSTRUCT_CALL);
3825 3826
3826 // Discard old TOS value and push r0 on the stack (same as Pop(), push(r0)). 3827 // Discard old TOS value and push r0 on the stack (same as Pop(), push(r0)).
3827 __ str(r0, MemOperand(sp, 0 * kPointerSize)); 3828 __ str(r0, MemOperand(sp, 0 * kPointerSize));
3828 } 3829 }
3829 3830
3830 3831
3831 void ArmCodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) { 3832 void ArmCodeGenerator::GenerateValueOf(ZoneList<Expression*>* args) {
3832 ASSERT(args->length() == 1); 3833 ASSERT(args->length() == 1);
3833 Label leave; 3834 Label leave;
3834 Load(args->at(0)); 3835 Load(args->at(0));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3989 __ push(r0); 3990 __ push(r0);
3990 // Push the builtins object found in the current global object. 3991 // Push the builtins object found in the current global object.
3991 __ ldr(r1, GlobalObject()); 3992 __ ldr(r1, GlobalObject());
3992 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset)); 3993 __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
3993 __ push(r0); 3994 __ push(r0);
3994 3995
3995 for (int i = 0; i < args->length(); i++) Load(args->at(i)); 3996 for (int i = 0; i < args->length(); i++) Load(args->at(i));
3996 3997
3997 // Call the JS runtime function. 3998 // Call the JS runtime function.
3998 Handle<Code> stub = ComputeCallInitialize(args->length()); 3999 Handle<Code> stub = ComputeCallInitialize(args->length());
3999 __ Call(stub, code_target); 4000 __ Call(stub, RelocInfo::CODE_TARGET);
4000 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4001 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4001 __ pop(); 4002 __ pop();
4002 __ push(r0); 4003 __ push(r0);
4003 } 4004 }
4004 } 4005 }
4005 4006
4006 4007
4007 void ArmCodeGenerator::VisitUnaryOperation(UnaryOperation* node) { 4008 void ArmCodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
4008 Comment cmnt(masm_, "[ UnaryOperation"); 4009 Comment cmnt(masm_, "[ UnaryOperation");
4009 4010
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
4527 4528
4528 default: 4529 default:
4529 UNREACHABLE(); 4530 UNREACHABLE();
4530 } 4531 }
4531 } 4532 }
4532 4533
4533 4534
4534 void ArmCodeGenerator::RecordStatementPosition(Node* node) { 4535 void ArmCodeGenerator::RecordStatementPosition(Node* node) {
4535 if (FLAG_debug_info) { 4536 if (FLAG_debug_info) {
4536 int statement_pos = node->statement_pos(); 4537 int statement_pos = node->statement_pos();
4537 if (statement_pos == kNoPosition) return; 4538 if (statement_pos == RelocInfo::kNoPosition) return;
4538 __ RecordStatementPosition(statement_pos); 4539 __ RecordStatementPosition(statement_pos);
4539 } 4540 }
4540 } 4541 }
4541 4542
4542 4543
4543 void ArmCodeGenerator::EnterJSFrame() { 4544 void ArmCodeGenerator::EnterJSFrame() {
4544 #if defined(DEBUG) 4545 #if defined(DEBUG)
4545 { Label done, fail; 4546 { Label done, fail;
4546 __ tst(r1, Operand(kSmiTagMask)); 4547 __ tst(r1, Operand(kSmiTagMask));
4547 __ b(eq, &fail); 4548 __ b(eq, &fail);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4582 bool is_eval) { 4583 bool is_eval) {
4583 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval); 4584 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval);
4584 if (!code.is_null()) { 4585 if (!code.is_null()) {
4585 Counters::total_compiled_code_size.Increment(code->instruction_size()); 4586 Counters::total_compiled_code_size.Increment(code->instruction_size());
4586 } 4587 }
4587 return code; 4588 return code;
4588 } 4589 }
4589 4590
4590 4591
4591 } } // namespace v8::internal 4592 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698