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

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

Issue 6838018: Support %_CallFunction in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Include regression test. Created 9 years, 8 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 CpuFeatures::Scope scope2(ARMv7); 84 CpuFeatures::Scope scope2(ARMv7);
85 return GeneratePrologue() && 85 return GeneratePrologue() &&
86 GenerateBody() && 86 GenerateBody() &&
87 GenerateDeferredCode() && 87 GenerateDeferredCode() &&
88 GenerateSafepointTable(); 88 GenerateSafepointTable();
89 } 89 }
90 90
91 91
92 void LCodeGen::FinishCode(Handle<Code> code) { 92 void LCodeGen::FinishCode(Handle<Code> code) {
93 ASSERT(is_done()); 93 ASSERT(is_done());
94 code->set_stack_slots(StackSlotCount()); 94 code->set_stack_slots(GetStackSlotCount());
95 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 95 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
96 PopulateDeoptimizationData(code); 96 PopulateDeoptimizationData(code);
97 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); 97 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code);
98 } 98 }
99 99
100 100
101 void LCodeGen::Abort(const char* format, ...) { 101 void LCodeGen::Abort(const char* format, ...) {
102 if (FLAG_trace_bailout) { 102 if (FLAG_trace_bailout) {
103 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString()); 103 SmartPointer<char> name(info()->shared_info()->DebugName()->ToCString());
104 PrintF("Aborting LCodeGen in @\"%s\": ", *name); 104 PrintF("Aborting LCodeGen in @\"%s\": ", *name);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // r1: Callee's JS function. 143 // r1: Callee's JS function.
144 // cp: Callee's context. 144 // cp: Callee's context.
145 // fp: Caller's frame pointer. 145 // fp: Caller's frame pointer.
146 // lr: Caller's pc. 146 // lr: Caller's pc.
147 147
148 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); 148 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
149 __ add(fp, sp, Operand(2 * kPointerSize)); // Adjust FP to point to saved FP. 149 __ add(fp, sp, Operand(2 * kPointerSize)); // Adjust FP to point to saved FP.
150 150
151 // Reserve space for the stack slots needed by the code. 151 // Reserve space for the stack slots needed by the code.
152 int slots = StackSlotCount(); 152 int slots = GetStackSlotCount();
153 if (slots > 0) { 153 if (slots > 0) {
154 if (FLAG_debug_code) { 154 if (FLAG_debug_code) {
155 __ mov(r0, Operand(slots)); 155 __ mov(r0, Operand(slots));
156 __ mov(r2, Operand(kSlotsZapValue)); 156 __ mov(r2, Operand(kSlotsZapValue));
157 Label loop; 157 Label loop;
158 __ bind(&loop); 158 __ bind(&loop);
159 __ push(r2); 159 __ push(r2);
160 __ sub(r0, r0, Operand(1), SetCC); 160 __ sub(r0, r0, Operand(1), SetCC);
161 __ b(ne, &loop); 161 __ b(ne, &loop);
162 } else { 162 } else {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 // Deferred code is the last part of the instruction sequence. Mark 257 // Deferred code is the last part of the instruction sequence. Mark
258 // the generated code as done unless we bailed out. 258 // the generated code as done unless we bailed out.
259 if (!is_aborted()) status_ = DONE; 259 if (!is_aborted()) status_ = DONE;
260 return !is_aborted(); 260 return !is_aborted();
261 } 261 }
262 262
263 263
264 bool LCodeGen::GenerateSafepointTable() { 264 bool LCodeGen::GenerateSafepointTable() {
265 ASSERT(is_done()); 265 ASSERT(is_done());
266 safepoints_.Emit(masm(), StackSlotCount()); 266 safepoints_.Emit(masm(), GetStackSlotCount());
267 return !is_aborted(); 267 return !is_aborted();
268 } 268 }
269 269
270 270
271 Register LCodeGen::ToRegister(int index) const { 271 Register LCodeGen::ToRegister(int index) const {
272 return Register::FromAllocationIndex(index); 272 return Register::FromAllocationIndex(index);
273 } 273 }
274 274
275 275
276 DoubleRegister LCodeGen::ToDoubleRegister(int index) const { 276 DoubleRegister LCodeGen::ToDoubleRegister(int index) const {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } else if (op->IsStackSlot()) { 452 } else if (op->IsStackSlot()) {
453 if (is_tagged) { 453 if (is_tagged) {
454 translation->StoreStackSlot(op->index()); 454 translation->StoreStackSlot(op->index());
455 } else { 455 } else {
456 translation->StoreInt32StackSlot(op->index()); 456 translation->StoreInt32StackSlot(op->index());
457 } 457 }
458 } else if (op->IsDoubleStackSlot()) { 458 } else if (op->IsDoubleStackSlot()) {
459 translation->StoreDoubleStackSlot(op->index()); 459 translation->StoreDoubleStackSlot(op->index());
460 } else if (op->IsArgument()) { 460 } else if (op->IsArgument()) {
461 ASSERT(is_tagged); 461 ASSERT(is_tagged);
462 int src_index = StackSlotCount() + op->index(); 462 int src_index = GetStackSlotCount() + op->index();
463 translation->StoreStackSlot(src_index); 463 translation->StoreStackSlot(src_index);
464 } else if (op->IsRegister()) { 464 } else if (op->IsRegister()) {
465 Register reg = ToRegister(op); 465 Register reg = ToRegister(op);
466 if (is_tagged) { 466 if (is_tagged) {
467 translation->StoreRegister(reg); 467 translation->StoreRegister(reg);
468 } else { 468 } else {
469 translation->StoreInt32Register(reg); 469 translation->StoreInt32Register(reg);
470 } 470 }
471 } else if (op->IsDoubleRegister()) { 471 } else if (op->IsDoubleRegister()) {
472 DoubleRegister reg = ToDoubleRegister(op); 472 DoubleRegister reg = ToDoubleRegister(op);
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 } 2173 }
2174 2174
2175 2175
2176 void LCodeGen::DoReturn(LReturn* instr) { 2176 void LCodeGen::DoReturn(LReturn* instr) {
2177 if (FLAG_trace) { 2177 if (FLAG_trace) {
2178 // Push the return value on the stack as the parameter. 2178 // Push the return value on the stack as the parameter.
2179 // Runtime::TraceExit returns its parameter in r0. 2179 // Runtime::TraceExit returns its parameter in r0.
2180 __ push(r0); 2180 __ push(r0);
2181 __ CallRuntime(Runtime::kTraceExit, 1); 2181 __ CallRuntime(Runtime::kTraceExit, 1);
2182 } 2182 }
2183 int32_t sp_delta = (ParameterCount() + 1) * kPointerSize; 2183 int32_t sp_delta = (GetParameterCount() + 1) * kPointerSize;
2184 __ mov(sp, fp); 2184 __ mov(sp, fp);
2185 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 2185 __ ldm(ia_w, sp, fp.bit() | lr.bit());
2186 __ add(sp, sp, Operand(sp_delta)); 2186 __ add(sp, sp, Operand(sp_delta));
2187 __ Jump(lr); 2187 __ Jump(lr);
2188 } 2188 }
2189 2189
2190 2190
2191 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { 2191 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
2192 Register result = ToRegister(instr->result()); 2192 Register result = ToRegister(instr->result());
2193 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell()))); 2193 __ mov(ip, Operand(Handle<Object>(instr->hydrogen()->cell())));
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 case kMathLog: 3018 case kMathLog:
3019 DoMathLog(instr); 3019 DoMathLog(instr);
3020 break; 3020 break;
3021 default: 3021 default:
3022 Abort("Unimplemented type of LUnaryMathOperation."); 3022 Abort("Unimplemented type of LUnaryMathOperation.");
3023 UNREACHABLE(); 3023 UNREACHABLE();
3024 } 3024 }
3025 } 3025 }
3026 3026
3027 3027
3028 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
3029 ASSERT(ToRegister(instr->function()).is(r1));
3030 ASSERT(instr->HasPointerMap());
3031 ASSERT(instr->HasDeoptimizationEnvironment());
3032 LPointerMap* pointers = instr->pointer_map();
3033 LEnvironment* env = instr->deoptimization_environment();
3034 RecordPosition(pointers->position());
3035 RegisterEnvironmentForDeoptimization(env);
3036 SafepointGenerator generator(this, pointers, env->deoptimization_index());
3037 ParameterCount count(instr->arity());
3038 __ InvokeFunction(r1, count, CALL_FUNCTION, &generator);
3039 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3040 }
3041
3042
3028 void LCodeGen::DoCallKeyed(LCallKeyed* instr) { 3043 void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
3029 ASSERT(ToRegister(instr->result()).is(r0)); 3044 ASSERT(ToRegister(instr->result()).is(r0));
3030 3045
3031 int arity = instr->arity(); 3046 int arity = instr->arity();
3032 Handle<Code> ic = 3047 Handle<Code> ic =
3033 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP); 3048 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity, NOT_IN_LOOP);
3034 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3049 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3035 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3050 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3036 } 3051 }
3037 3052
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 ASSERT(!environment->HasBeenRegistered()); 4213 ASSERT(!environment->HasBeenRegistered());
4199 RegisterEnvironmentForDeoptimization(environment); 4214 RegisterEnvironmentForDeoptimization(environment);
4200 ASSERT(osr_pc_offset_ == -1); 4215 ASSERT(osr_pc_offset_ == -1);
4201 osr_pc_offset_ = masm()->pc_offset(); 4216 osr_pc_offset_ = masm()->pc_offset();
4202 } 4217 }
4203 4218
4204 4219
4205 #undef __ 4220 #undef __
4206 4221
4207 } } // namespace v8::internal 4222 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698