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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 #ifdef DEBUG | 137 #ifdef DEBUG |
138 if (strlen(FLAG_stop_at) > 0 && | 138 if (strlen(FLAG_stop_at) > 0 && |
139 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 139 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
140 __ stop("stop_at"); | 140 __ stop("stop_at"); |
141 } | 141 } |
142 #endif | 142 #endif |
143 | 143 |
144 // r1: Callee's JS function. | 144 // r1: Callee's JS function. |
145 // cp: Callee's context. | 145 // cp: Callee's context. |
| 146 // pp: Callee's constant pool pointer (if FLAG_enable_ool_constant_pool) |
146 // fp: Caller's frame pointer. | 147 // fp: Caller's frame pointer. |
147 // lr: Caller's pc. | 148 // lr: Caller's pc. |
148 | 149 |
149 // Strict mode functions and builtins need to replace the receiver | 150 // Strict mode functions and builtins need to replace the receiver |
150 // with undefined when called as functions (without an explicit | 151 // with undefined when called as functions (without an explicit |
151 // receiver object). r5 is zero for method calls and non-zero for | 152 // receiver object). r5 is zero for method calls and non-zero for |
152 // function calls. | 153 // function calls. |
153 if (!info_->is_classic_mode() || info_->is_native()) { | 154 if (!info_->is_classic_mode() || info_->is_native()) { |
154 __ cmp(r5, Operand::Zero()); | 155 __ cmp(r5, Operand::Zero()); |
155 int receiver_offset = scope()->num_parameters() * kPointerSize; | 156 int receiver_offset = scope()->num_parameters() * kPointerSize; |
156 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 157 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
157 __ str(r2, MemOperand(sp, receiver_offset), ne); | 158 __ str(r2, MemOperand(sp, receiver_offset), ne); |
158 } | 159 } |
159 } | 160 } |
160 | 161 |
161 info()->set_prologue_offset(masm_->pc_offset()); | 162 info()->set_prologue_offset(masm_->pc_offset()); |
162 if (NeedsEagerFrame()) { | 163 if (NeedsEagerFrame()) { |
163 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); | 164 __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME : BUILD_FUNCTION_FRAME); |
164 frame_is_built_ = true; | 165 frame_is_built_ = true; |
165 info_->AddNoFrameRange(0, masm_->pc_offset()); | 166 info_->AddNoFrameRange(0, masm_->pc_offset()); |
| 167 __ LoadConstantPoolPointerRegister(); |
166 } | 168 } |
167 | 169 |
168 // Reserve space for the stack slots needed by the code. | 170 // Reserve space for the stack slots needed by the code. |
169 int slots = GetStackSlotCount(); | 171 int slots = GetStackSlotCount(); |
170 if (slots > 0) { | 172 if (slots > 0) { |
171 if (FLAG_debug_code) { | 173 if (FLAG_debug_code) { |
172 __ sub(sp, sp, Operand(slots * kPointerSize)); | 174 __ sub(sp, sp, Operand(slots * kPointerSize)); |
173 __ push(r0); | 175 __ push(r0); |
174 __ push(r1); | 176 __ push(r1); |
175 __ add(r0, sp, Operand(slots * kPointerSize)); | 177 __ add(r0, sp, Operand(slots * kPointerSize)); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 "-------------------- Deferred %s --------------------", | 273 "-------------------- Deferred %s --------------------", |
272 code->instruction_index(), | 274 code->instruction_index(), |
273 code->instr()->hydrogen_value()->id(), | 275 code->instr()->hydrogen_value()->id(), |
274 code->instr()->Mnemonic()); | 276 code->instr()->Mnemonic()); |
275 __ bind(code->entry()); | 277 __ bind(code->entry()); |
276 if (NeedsDeferredFrame()) { | 278 if (NeedsDeferredFrame()) { |
277 Comment(";;; Build frame"); | 279 Comment(";;; Build frame"); |
278 ASSERT(!frame_is_built_); | 280 ASSERT(!frame_is_built_); |
279 ASSERT(info()->IsStub()); | 281 ASSERT(info()->IsStub()); |
280 frame_is_built_ = true; | 282 frame_is_built_ = true; |
281 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 283 __ PushFixedFrame(); |
282 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 284 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
283 __ push(scratch0()); | 285 __ push(scratch0()); |
284 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 286 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
285 Comment(";;; Deferred code"); | 287 Comment(";;; Deferred code"); |
286 } | 288 } |
287 code->Generate(); | 289 code->Generate(); |
288 if (NeedsDeferredFrame()) { | 290 if (NeedsDeferredFrame()) { |
289 Comment(";;; Destroy frame"); | 291 Comment(";;; Destroy frame"); |
290 ASSERT(frame_is_built_); | 292 ASSERT(frame_is_built_); |
291 __ pop(ip); | 293 __ pop(ip); |
292 __ ldm(ia_w, sp, cp.bit() | fp.bit() | lr.bit()); | 294 __ PopFixedFrame(); |
293 frame_is_built_ = false; | 295 frame_is_built_ = false; |
294 } | 296 } |
295 __ jmp(code->exit()); | 297 __ jmp(code->exit()); |
296 } | 298 } |
297 } | 299 } |
298 | 300 |
299 // Force constant pool emission at the end of the deferred code to make | 301 // Force constant pool emission at the end of the deferred code to make |
300 // sure that no constant pools are emitted after. | 302 // sure that no constant pools are emitted after. |
301 masm()->CheckConstPool(true, false); | 303 masm()->CheckConstPool(true, false); |
302 | 304 |
(...skipping 30 matching lines...) Expand all Loading... |
333 } else { | 335 } else { |
334 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | 336 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
335 } | 337 } |
336 if (deopt_jump_table_[i].needs_frame) { | 338 if (deopt_jump_table_[i].needs_frame) { |
337 ASSERT(!info()->saves_caller_doubles()); | 339 ASSERT(!info()->saves_caller_doubles()); |
338 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); | 340 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry))); |
339 if (needs_frame.is_bound()) { | 341 if (needs_frame.is_bound()) { |
340 __ b(&needs_frame); | 342 __ b(&needs_frame); |
341 } else { | 343 } else { |
342 __ bind(&needs_frame); | 344 __ bind(&needs_frame); |
343 __ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit()); | 345 __ PushFixedFrame(); |
344 // This variant of deopt can only be used with stubs. Since we don't | 346 // This variant of deopt can only be used with stubs. Since we don't |
345 // have a function pointer to install in the stack frame that we're | 347 // have a function pointer to install in the stack frame that we're |
346 // building, install a special marker there instead. | 348 // building, install a special marker there instead. |
347 ASSERT(info()->IsStub()); | 349 ASSERT(info()->IsStub()); |
348 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); | 350 __ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); |
349 __ push(scratch0()); | 351 __ push(scratch0()); |
350 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 352 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
351 __ mov(lr, Operand(pc), LeaveCC, al); | 353 __ mov(lr, Operand(pc), LeaveCC, al); |
352 __ mov(pc, ip); | 354 __ mov(pc, ip); |
353 } | 355 } |
(...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 // safe to write to the context register. | 2913 // safe to write to the context register. |
2912 __ push(r0); | 2914 __ push(r0); |
2913 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2915 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2914 __ CallRuntime(Runtime::kTraceExit, 1); | 2916 __ CallRuntime(Runtime::kTraceExit, 1); |
2915 } | 2917 } |
2916 if (info()->saves_caller_doubles()) { | 2918 if (info()->saves_caller_doubles()) { |
2917 RestoreCallerDoubles(); | 2919 RestoreCallerDoubles(); |
2918 } | 2920 } |
2919 int no_frame_start = -1; | 2921 int no_frame_start = -1; |
2920 if (NeedsEagerFrame()) { | 2922 if (NeedsEagerFrame()) { |
2921 __ mov(sp, fp); | 2923 no_frame_start = masm_->LeaveFrame(StackFrame::JAVA_SCRIPT); |
2922 no_frame_start = masm_->pc_offset(); | |
2923 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | |
2924 } | 2924 } |
2925 if (instr->has_constant_parameter_count()) { | 2925 if (instr->has_constant_parameter_count()) { |
2926 int parameter_count = ToInteger32(instr->constant_parameter_count()); | 2926 int parameter_count = ToInteger32(instr->constant_parameter_count()); |
2927 int32_t sp_delta = (parameter_count + 1) * kPointerSize; | 2927 int32_t sp_delta = (parameter_count + 1) * kPointerSize; |
2928 if (sp_delta != 0) { | 2928 if (sp_delta != 0) { |
2929 __ add(sp, sp, Operand(sp_delta)); | 2929 __ add(sp, sp, Operand(sp_delta)); |
2930 } | 2930 } |
2931 } else { | 2931 } else { |
2932 Register reg = ToRegister(instr->parameter_count()); | 2932 Register reg = ToRegister(instr->parameter_count()); |
2933 // The argument count parameter is a smi | 2933 // The argument count parameter is a smi |
(...skipping 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5817 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5817 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5818 __ ldr(result, FieldMemOperand(scratch, | 5818 __ ldr(result, FieldMemOperand(scratch, |
5819 FixedArray::kHeaderSize - kPointerSize)); | 5819 FixedArray::kHeaderSize - kPointerSize)); |
5820 __ bind(&done); | 5820 __ bind(&done); |
5821 } | 5821 } |
5822 | 5822 |
5823 | 5823 |
5824 #undef __ | 5824 #undef __ |
5825 | 5825 |
5826 } } // namespace v8::internal | 5826 } } // namespace v8::internal |
OLD | NEW |