OLD | NEW |
---|---|
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 #ifdef DEBUG | 139 #ifdef DEBUG |
140 if (strlen(FLAG_stop_at) > 0 && | 140 if (strlen(FLAG_stop_at) > 0 && |
141 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 141 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
142 __ stop("stop_at"); | 142 __ stop("stop_at"); |
143 } | 143 } |
144 #endif | 144 #endif |
145 | 145 |
146 // r1: Callee's JS function. | 146 // r1: Callee's JS function. |
147 // cp: Callee's context. | 147 // cp: Callee's context. |
148 // pp: Callee's constant pool pointer (if FLAG_enable_ool_constant_pool) | |
148 // fp: Caller's frame pointer. | 149 // fp: Caller's frame pointer. |
149 // lr: Caller's pc. | 150 // lr: Caller's pc. |
150 | 151 |
151 // Strict mode functions and builtins need to replace the receiver | 152 // Strict mode functions and builtins need to replace the receiver |
152 // with undefined when called as functions (without an explicit | 153 // with undefined when called as functions (without an explicit |
153 // receiver object). r5 is zero for method calls and non-zero for | 154 // receiver object). r5 is zero for method calls and non-zero for |
154 // function calls. | 155 // function calls. |
155 if (!info_->is_classic_mode() || info_->is_native()) { | 156 if (!info_->is_classic_mode() || info_->is_native()) { |
156 __ cmp(r5, Operand::Zero()); | 157 __ cmp(r5, Operand::Zero()); |
157 int receiver_offset = scope()->num_parameters() * kPointerSize; | 158 int receiver_offset = scope()->num_parameters() * kPointerSize; |
158 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 159 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
159 __ str(r2, MemOperand(sp, receiver_offset), ne); | 160 __ str(r2, MemOperand(sp, receiver_offset), ne); |
160 } | 161 } |
161 } | 162 } |
162 | 163 |
163 info()->set_prologue_offset(masm_->pc_offset()); | 164 info()->set_prologue_offset(masm_->pc_offset()); |
164 if (NeedsEagerFrame()) { | 165 if (NeedsEagerFrame()) { |
ulan
2013/12/18 15:06:56
If there is no eager frame, then we load constant
rmcilroy
2013/12/19 11:08:25
We aren't going to have an inline constant pool an
ulan
2013/12/19 12:54:41
Let's see how this will affect performance. Maybe
rmcilroy
2013/12/19 13:31:59
SGTM
| |
165 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); | 166 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); |
166 frame_is_built_ = true; | 167 frame_is_built_ = true; |
167 info_->AddNoFrameRange(0, masm_->pc_offset()); | 168 info_->AddNoFrameRange(0, masm_->pc_offset()); |
169 __ LoadConstantPoolPointerRegister(); | |
ulan
2013/12/18 15:06:56
Ensure that there are no constant pool accesses be
rmcilroy
2013/12/19 11:08:25
Ditto.
| |
168 } | 170 } |
169 | 171 |
170 // Reserve space for the stack slots needed by the code. | 172 // Reserve space for the stack slots needed by the code. |
171 int slots = GetStackSlotCount(); | 173 int slots = GetStackSlotCount(); |
172 if (slots > 0) { | 174 if (slots > 0) { |
173 if (FLAG_debug_code) { | 175 if (FLAG_debug_code) { |
174 __ sub(sp, sp, Operand(slots * kPointerSize)); | 176 __ sub(sp, sp, Operand(slots * kPointerSize)); |
175 __ push(r0); | 177 __ push(r0); |
176 __ push(r1); | 178 __ push(r1); |
177 __ add(r0, sp, Operand(slots * kPointerSize)); | 179 __ add(r0, sp, Operand(slots * kPointerSize)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 "-------------------- Deferred %s --------------------", | 275 "-------------------- Deferred %s --------------------", |
274 code->instruction_index(), | 276 code->instruction_index(), |
275 code->instr()->hydrogen_value()->id(), | 277 code->instr()->hydrogen_value()->id(), |
276 code->instr()->Mnemonic()); | 278 code->instr()->Mnemonic()); |
277 __ bind(code->entry()); | 279 __ bind(code->entry()); |
278 if (NeedsDeferredFrame()) { | 280 if (NeedsDeferredFrame()) { |
279 Comment(";;; Build frame"); | 281 Comment(";;; Build frame"); |
280 ASSERT(!frame_is_built_); | 282 ASSERT(!frame_is_built_); |
281 ASSERT(info()->IsStub()); | 283 ASSERT(info()->IsStub()); |
282 frame_is_built_ = true; | 284 frame_is_built_ = true; |
283 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 285 __ PushFixedFrame(); |
284 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 286 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
285 __ push(scratch0()); | 287 __ push(scratch0()); |
286 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 288 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
287 Comment(";;; Deferred code"); | 289 Comment(";;; Deferred code"); |
288 } | 290 } |
289 code->Generate(); | 291 code->Generate(); |
290 if (NeedsDeferredFrame()) { | 292 if (NeedsDeferredFrame()) { |
291 Comment(";;; Destroy frame"); | 293 Comment(";;; Destroy frame"); |
292 ASSERT(frame_is_built_); | 294 ASSERT(frame_is_built_); |
293 __ pop(ip); | 295 __ pop(ip); |
294 __ ldm(ia_w, sp, cp.bit() | fp.bit() | lr.bit()); | 296 __ PopFixedFrame(); |
295 frame_is_built_ = false; | 297 frame_is_built_ = false; |
296 } | 298 } |
297 __ jmp(code->exit()); | 299 __ jmp(code->exit()); |
298 } | 300 } |
299 } | 301 } |
300 | 302 |
301 // Force constant pool emission at the end of the deferred code to make | 303 // Force constant pool emission at the end of the deferred code to make |
302 // sure that no constant pools are emitted after. | 304 // sure that no constant pools are emitted after. |
303 masm()->CheckConstPool(true, false); | 305 masm()->CheckConstPool(true, false); |
304 | 306 |
(...skipping 30 matching lines...) Expand all Loading... | |
335 } else { | 337 } else { |
336 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | 338 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
337 } | 339 } |
338 if (deopt_jump_table_[i].needs_frame) { | 340 if (deopt_jump_table_[i].needs_frame) { |
339 ASSERT(!info()->saves_caller_doubles()); | 341 ASSERT(!info()->saves_caller_doubles()); |
340 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); | 342 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); |
341 if (needs_frame.is_bound()) { | 343 if (needs_frame.is_bound()) { |
342 __ b(&needs_frame); | 344 __ b(&needs_frame); |
343 } else { | 345 } else { |
344 __ bind(&needs_frame); | 346 __ bind(&needs_frame); |
345 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 347 __ PushFixedFrame(); |
346 // This variant of deopt can only be used with stubs. Since we don't | 348 // This variant of deopt can only be used with stubs. Since we don't |
347 // have a function pointer to install in the stack frame that we're | 349 // have a function pointer to install in the stack frame that we're |
348 // building, install a special marker there instead. | 350 // building, install a special marker there instead. |
349 ASSERT(info()->IsStub()); | 351 ASSERT(info()->IsStub()); |
350 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 352 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
351 __ push(scratch0()); | 353 __ push(scratch0()); |
352 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 354 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
353 __ mov(lr, Operand(pc), LeaveCC, al); | 355 __ mov(lr, Operand(pc), LeaveCC, al); |
354 __ mov(pc, ip); | 356 __ mov(pc, ip); |
355 } | 357 } |
(...skipping 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2951 // safe to write to the context register. | 2953 // safe to write to the context register. |
2952 __ push(r0); | 2954 __ push(r0); |
2953 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2955 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2954 __ CallRuntime(Runtime::kTraceExit, 1); | 2956 __ CallRuntime(Runtime::kTraceExit, 1); |
2955 } | 2957 } |
2956 if (info()->saves_caller_doubles()) { | 2958 if (info()->saves_caller_doubles()) { |
2957 RestoreCallerDoubles(); | 2959 RestoreCallerDoubles(); |
2958 } | 2960 } |
2959 int no_frame_start = -1; | 2961 int no_frame_start = -1; |
2960 if (NeedsEagerFrame()) { | 2962 if (NeedsEagerFrame()) { |
2961 __ mov(sp, fp); | 2963 no_frame_start = masm_->LeaveFrame(StackFrame::JAVA_SCRIPT); |
2962 no_frame_start = masm_->pc_offset(); | |
2963 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | |
2964 } | 2964 } |
2965 if (instr->has_constant_parameter_count()) { | 2965 if (instr->has_constant_parameter_count()) { |
2966 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2966 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
2967 int32_t sp_delta = (parameter_count + 1) * kPointerSize; | 2967 int32_t sp_delta = (parameter_count + 1) * kPointerSize; |
2968 if (sp_delta != 0) { | 2968 if (sp_delta != 0) { |
2969 __ add(sp, sp, Operand(sp_delta)); | 2969 __ add(sp, sp, Operand(sp_delta)); |
2970 } | 2970 } |
2971 } else { | 2971 } else { |
2972 Register reg = ToRegister(instr->parameter_count()); | 2972 Register reg = ToRegister(instr->parameter_count()); |
2973 // The argument count parameter is a smi | 2973 // The argument count parameter is a smi |
(...skipping 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5876 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5876 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5877 __ ldr(result, FieldMemOperand(scratch, | 5877 __ ldr(result, FieldMemOperand(scratch, |
5878 FixedArray::kHeaderSize - kPointerSize)); | 5878 FixedArray::kHeaderSize - kPointerSize)); |
5879 __ bind(&done); | 5879 __ bind(&done); |
5880 } | 5880 } |
5881 | 5881 |
5882 | 5882 |
5883 #undef __ | 5883 #undef __ |
5884 | 5884 |
5885 } } // namespace v8::internal | 5885 } } // namespace v8::internal |
OLD | NEW |