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

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

Issue 3152016: Remove experimental fast-codegen. We are no longer working on this (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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/arm/fast-codegen-arm.cc ('k') | src/compiler.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // 48 //
49 // The live registers are: 49 // The live registers are:
50 // o r1: the JS function object being called (ie, ourselves) 50 // o r1: the JS function object being called (ie, ourselves)
51 // o cp: our context 51 // o cp: our context
52 // o fp: our caller's frame pointer 52 // o fp: our caller's frame pointer
53 // o sp: stack pointer 53 // o sp: stack pointer
54 // o lr: return address 54 // o lr: return address
55 // 55 //
56 // The function builds a JS frame. Please see JavaScriptFrameConstants in 56 // The function builds a JS frame. Please see JavaScriptFrameConstants in
57 // frames-arm.h for its layout. 57 // frames-arm.h for its layout.
58 void FullCodeGenerator::Generate(CompilationInfo* info, Mode mode) { 58 void FullCodeGenerator::Generate(CompilationInfo* info) {
59 ASSERT(info_ == NULL); 59 ASSERT(info_ == NULL);
60 info_ = info; 60 info_ = info;
61 SetFunctionPosition(function()); 61 SetFunctionPosition(function());
62 Comment cmnt(masm_, "[ function compiled by full code generator"); 62 Comment cmnt(masm_, "[ function compiled by full code generator");
63 63
64 if (mode == PRIMARY) { 64 int locals_count = scope()->num_stack_slots();
65 int locals_count = scope()->num_stack_slots();
66 65
67 __ Push(lr, fp, cp, r1); 66 __ Push(lr, fp, cp, r1);
68 if (locals_count > 0) { 67 if (locals_count > 0) {
69 // Load undefined value here, so the value is ready for the loop 68 // Load undefined value here, so the value is ready for the loop
70 // below. 69 // below.
71 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 70 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
72 } 71 }
73 // Adjust fp to point to caller's fp. 72 // Adjust fp to point to caller's fp.
74 __ add(fp, sp, Operand(2 * kPointerSize)); 73 __ add(fp, sp, Operand(2 * kPointerSize));
75 74
76 { Comment cmnt(masm_, "[ Allocate locals"); 75 { Comment cmnt(masm_, "[ Allocate locals");
77 for (int i = 0; i < locals_count; i++) { 76 for (int i = 0; i < locals_count; i++) {
78 __ push(ip); 77 __ push(ip);
79 }
80 }
81
82 bool function_in_register = true;
83
84 // Possibly allocate a local context.
85 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
86 if (heap_slots > 0) {
87 Comment cmnt(masm_, "[ Allocate local context");
88 // Argument to NewContext is the function, which is in r1.
89 __ push(r1);
90 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
91 FastNewContextStub stub(heap_slots);
92 __ CallStub(&stub);
93 } else {
94 __ CallRuntime(Runtime::kNewContext, 1);
95 }
96 function_in_register = false;
97 // Context is returned in both r0 and cp. It replaces the context
98 // passed to us. It's saved in the stack and kept live in cp.
99 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
100 // Copy any necessary parameters into the context.
101 int num_parameters = scope()->num_parameters();
102 for (int i = 0; i < num_parameters; i++) {
103 Slot* slot = scope()->parameter(i)->slot();
104 if (slot != NULL && slot->type() == Slot::CONTEXT) {
105 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
106 (num_parameters - 1 - i) * kPointerSize;
107 // Load parameter from stack.
108 __ ldr(r0, MemOperand(fp, parameter_offset));
109 // Store it in the context.
110 __ mov(r1, Operand(Context::SlotOffset(slot->index())));
111 __ str(r0, MemOperand(cp, r1));
112 // Update the write barrier. This clobbers all involved
113 // registers, so we have to use two more registers to avoid
114 // clobbering cp.
115 __ mov(r2, Operand(cp));
116 __ RecordWrite(r2, Operand(r1), r3, r0);
117 }
118 }
119 }
120
121 Variable* arguments = scope()->arguments()->AsVariable();
122 if (arguments != NULL) {
123 // Function uses arguments object.
124 Comment cmnt(masm_, "[ Allocate arguments object");
125 if (!function_in_register) {
126 // Load this again, if it's used by the local context below.
127 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
128 } else {
129 __ mov(r3, r1);
130 }
131 // Receiver is just before the parameters on the caller's stack.
132 int offset = scope()->num_parameters() * kPointerSize;
133 __ add(r2, fp,
134 Operand(StandardFrameConstants::kCallerSPOffset + offset));
135 __ mov(r1, Operand(Smi::FromInt(scope()->num_parameters())));
136 __ Push(r3, r2, r1);
137
138 // Arguments to ArgumentsAccessStub:
139 // function, receiver address, parameter count.
140 // The stub will rewrite receiever and parameter count if the previous
141 // stack frame was an arguments adapter frame.
142 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
143 __ CallStub(&stub);
144 // Duplicate the value; move-to-slot operation might clobber registers.
145 __ mov(r3, r0);
146 Move(arguments->slot(), r0, r1, r2);
147 Slot* dot_arguments_slot =
148 scope()->arguments_shadow()->AsVariable()->slot();
149 Move(dot_arguments_slot, r3, r1, r2);
150 } 78 }
151 } 79 }
152 80
81 bool function_in_register = true;
82
83 // Possibly allocate a local context.
84 int heap_slots = scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
85 if (heap_slots > 0) {
86 Comment cmnt(masm_, "[ Allocate local context");
87 // Argument to NewContext is the function, which is in r1.
88 __ push(r1);
89 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
90 FastNewContextStub stub(heap_slots);
91 __ CallStub(&stub);
92 } else {
93 __ CallRuntime(Runtime::kNewContext, 1);
94 }
95 function_in_register = false;
96 // Context is returned in both r0 and cp. It replaces the context
97 // passed to us. It's saved in the stack and kept live in cp.
98 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
99 // Copy any necessary parameters into the context.
100 int num_parameters = scope()->num_parameters();
101 for (int i = 0; i < num_parameters; i++) {
102 Slot* slot = scope()->parameter(i)->slot();
103 if (slot != NULL && slot->type() == Slot::CONTEXT) {
104 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
105 (num_parameters - 1 - i) * kPointerSize;
106 // Load parameter from stack.
107 __ ldr(r0, MemOperand(fp, parameter_offset));
108 // Store it in the context.
109 __ mov(r1, Operand(Context::SlotOffset(slot->index())));
110 __ str(r0, MemOperand(cp, r1));
111 // Update the write barrier. This clobbers all involved
112 // registers, so we have to use two more registers to avoid
113 // clobbering cp.
114 __ mov(r2, Operand(cp));
115 __ RecordWrite(r2, Operand(r1), r3, r0);
116 }
117 }
118 }
119
120 Variable* arguments = scope()->arguments()->AsVariable();
121 if (arguments != NULL) {
122 // Function uses arguments object.
123 Comment cmnt(masm_, "[ Allocate arguments object");
124 if (!function_in_register) {
125 // Load this again, if it's used by the local context below.
126 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
127 } else {
128 __ mov(r3, r1);
129 }
130 // Receiver is just before the parameters on the caller's stack.
131 int offset = scope()->num_parameters() * kPointerSize;
132 __ add(r2, fp,
133 Operand(StandardFrameConstants::kCallerSPOffset + offset));
134 __ mov(r1, Operand(Smi::FromInt(scope()->num_parameters())));
135 __ Push(r3, r2, r1);
136
137 // Arguments to ArgumentsAccessStub:
138 // function, receiver address, parameter count.
139 // The stub will rewrite receiever and parameter count if the previous
140 // stack frame was an arguments adapter frame.
141 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
142 __ CallStub(&stub);
143 // Duplicate the value; move-to-slot operation might clobber registers.
144 __ mov(r3, r0);
145 Move(arguments->slot(), r0, r1, r2);
146 Slot* dot_arguments_slot =
147 scope()->arguments_shadow()->AsVariable()->slot();
148 Move(dot_arguments_slot, r3, r1, r2);
149 }
150
153 { Comment cmnt(masm_, "[ Declarations"); 151 { Comment cmnt(masm_, "[ Declarations");
154 // For named function expressions, declare the function name as a 152 // For named function expressions, declare the function name as a
155 // constant. 153 // constant.
156 if (scope()->is_function_scope() && scope()->function() != NULL) { 154 if (scope()->is_function_scope() && scope()->function() != NULL) {
157 EmitDeclaration(scope()->function(), Variable::CONST, NULL); 155 EmitDeclaration(scope()->function(), Variable::CONST, NULL);
158 } 156 }
159 // Visit all the explicit declarations unless there is an illegal 157 // Visit all the explicit declarations unless there is an illegal
160 // redeclaration. 158 // redeclaration.
161 if (scope()->HasIllegalRedeclaration()) { 159 if (scope()->HasIllegalRedeclaration()) {
162 scope()->VisitIllegalRedeclaration(this); 160 scope()->VisitIllegalRedeclaration(this);
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3237 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3240 __ add(pc, r1, Operand(masm_->CodeObject())); 3238 __ add(pc, r1, Operand(masm_->CodeObject()));
3241 } 3239 }
3242 3240
3243 3241
3244 #undef __ 3242 #undef __
3245 3243
3246 } } // namespace v8::internal 3244 } } // namespace v8::internal
3247 3245
3248 #endif // V8_TARGET_ARCH_ARM 3246 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698