OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 { | 262 { |
263 // Drop all arguments including the receiver. | 263 // Drop all arguments including the receiver. |
264 __ Drop(r5); | 264 __ Drop(r5); |
265 __ Ret(1); | 265 __ Ret(1); |
266 } | 266 } |
267 | 267 |
268 // 2b. No arguments, return +0. | 268 // 2b. No arguments, return +0. |
269 __ bind(&no_arguments); | 269 __ bind(&no_arguments); |
270 __ LoadSmiLiteral(r3, Smi::kZero); | 270 __ LoadSmiLiteral(r3, Smi::FromInt(0)); |
271 __ Ret(1); | 271 __ Ret(1); |
272 } | 272 } |
273 | 273 |
274 // static | 274 // static |
275 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { | 275 void Builtins::Generate_NumberConstructor_ConstructStub(MacroAssembler* masm) { |
276 // ----------- S t a t e ------------- | 276 // ----------- S t a t e ------------- |
277 // -- r3 : number of arguments | 277 // -- r3 : number of arguments |
278 // -- r4 : constructor function | 278 // -- r4 : constructor function |
279 // -- r6 : new target | 279 // -- r6 : new target |
280 // -- cp : context | 280 // -- cp : context |
281 // -- lr : return address | 281 // -- lr : return address |
282 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 282 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
283 // -- sp[argc * 4] : receiver | 283 // -- sp[argc * 4] : receiver |
284 // ----------------------------------- | 284 // ----------------------------------- |
285 | 285 |
286 // 1. Make sure we operate in the context of the called function. | 286 // 1. Make sure we operate in the context of the called function. |
287 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); | 287 __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); |
288 | 288 |
289 // 2. Load the first argument into r5. | 289 // 2. Load the first argument into r5. |
290 { | 290 { |
291 Label no_arguments, done; | 291 Label no_arguments, done; |
292 __ mr(r9, r3); // Store argc in r9. | 292 __ mr(r9, r3); // Store argc in r9. |
293 __ cmpi(r3, Operand::Zero()); | 293 __ cmpi(r3, Operand::Zero()); |
294 __ beq(&no_arguments); | 294 __ beq(&no_arguments); |
295 __ subi(r3, r3, Operand(1)); | 295 __ subi(r3, r3, Operand(1)); |
296 __ ShiftLeftImm(r5, r3, Operand(kPointerSizeLog2)); | 296 __ ShiftLeftImm(r5, r3, Operand(kPointerSizeLog2)); |
297 __ LoadPX(r5, MemOperand(sp, r5)); | 297 __ LoadPX(r5, MemOperand(sp, r5)); |
298 __ b(&done); | 298 __ b(&done); |
299 __ bind(&no_arguments); | 299 __ bind(&no_arguments); |
300 __ LoadSmiLiteral(r5, Smi::kZero); | 300 __ LoadSmiLiteral(r5, Smi::FromInt(0)); |
301 __ bind(&done); | 301 __ bind(&done); |
302 } | 302 } |
303 | 303 |
304 // 3. Make sure r5 is a number. | 304 // 3. Make sure r5 is a number. |
305 { | 305 { |
306 Label done_convert; | 306 Label done_convert; |
307 __ JumpIfSmi(r5, &done_convert); | 307 __ JumpIfSmi(r5, &done_convert); |
308 __ CompareObjectType(r5, r7, r7, HEAP_NUMBER_TYPE); | 308 __ CompareObjectType(r5, r7, r7, HEAP_NUMBER_TYPE); |
309 __ beq(&done_convert); | 309 __ beq(&done_convert); |
310 { | 310 { |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 // Unreachable code. | 1346 // Unreachable code. |
1347 __ bkpt(0); | 1347 __ bkpt(0); |
1348 } | 1348 } |
1349 } | 1349 } |
1350 | 1350 |
1351 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1351 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1352 // Set the return address to the correct point in the interpreter entry | 1352 // Set the return address to the correct point in the interpreter entry |
1353 // trampoline. | 1353 // trampoline. |
1354 Smi* interpreter_entry_return_pc_offset( | 1354 Smi* interpreter_entry_return_pc_offset( |
1355 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1355 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1356 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); | 1356 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1357 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1357 __ Move(r5, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1358 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() + | 1358 __ addi(r0, r5, Operand(interpreter_entry_return_pc_offset->value() + |
1359 Code::kHeaderSize - kHeapObjectTag)); | 1359 Code::kHeaderSize - kHeapObjectTag)); |
1360 __ mtlr(r0); | 1360 __ mtlr(r0); |
1361 | 1361 |
1362 // Initialize the dispatch table register. | 1362 // Initialize the dispatch table register. |
1363 __ mov(kInterpreterDispatchTableRegister, | 1363 __ mov(kInterpreterDispatchTableRegister, |
1364 Operand(ExternalReference::interpreter_dispatch_table_address( | 1364 Operand(ExternalReference::interpreter_dispatch_table_address( |
1365 masm->isolate()))); | 1365 masm->isolate()))); |
1366 | 1366 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1881 |
1882 { | 1882 { |
1883 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1883 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1884 // Pass function as argument. | 1884 // Pass function as argument. |
1885 __ push(r3); | 1885 __ push(r3); |
1886 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1886 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1887 } | 1887 } |
1888 | 1888 |
1889 // If the code object is null, just return to the caller. | 1889 // If the code object is null, just return to the caller. |
1890 Label skip; | 1890 Label skip; |
1891 __ CmpSmiLiteral(r3, Smi::kZero, r0); | 1891 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); |
1892 __ bne(&skip); | 1892 __ bne(&skip); |
1893 __ Ret(); | 1893 __ Ret(); |
1894 | 1894 |
1895 __ bind(&skip); | 1895 __ bind(&skip); |
1896 | 1896 |
1897 // Drop any potential handler frame that is be sitting on top of the actual | 1897 // Drop any potential handler frame that is be sitting on top of the actual |
1898 // JavaScript frame. This is the case then OSR is triggered from bytecode. | 1898 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
1899 if (has_handler_frame) { | 1899 if (has_handler_frame) { |
1900 __ LeaveFrame(StackFrame::STUB); | 1900 __ LeaveFrame(StackFrame::STUB); |
1901 } | 1901 } |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2847 } | 2847 } |
2848 | 2848 |
2849 // static | 2849 // static |
2850 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2850 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2851 // ----------- S t a t e ------------- | 2851 // ----------- S t a t e ------------- |
2852 // -- r4 : requested object size (untagged) | 2852 // -- r4 : requested object size (untagged) |
2853 // -- lr : return address | 2853 // -- lr : return address |
2854 // ----------------------------------- | 2854 // ----------------------------------- |
2855 __ SmiTag(r4); | 2855 __ SmiTag(r4); |
2856 __ Push(r4); | 2856 __ Push(r4); |
2857 __ LoadSmiLiteral(cp, Smi::kZero); | 2857 __ LoadSmiLiteral(cp, Smi::FromInt(0)); |
2858 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2858 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2859 } | 2859 } |
2860 | 2860 |
2861 // static | 2861 // static |
2862 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2862 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
2863 // ----------- S t a t e ------------- | 2863 // ----------- S t a t e ------------- |
2864 // -- r4 : requested object size (untagged) | 2864 // -- r4 : requested object size (untagged) |
2865 // -- lr : return address | 2865 // -- lr : return address |
2866 // ----------------------------------- | 2866 // ----------------------------------- |
2867 __ SmiTag(r4); | 2867 __ SmiTag(r4); |
2868 __ LoadSmiLiteral(r5, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2868 __ LoadSmiLiteral(r5, Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2869 __ Push(r4, r5); | 2869 __ Push(r4, r5); |
2870 __ LoadSmiLiteral(cp, Smi::kZero); | 2870 __ LoadSmiLiteral(cp, Smi::FromInt(0)); |
2871 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2871 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2872 } | 2872 } |
2873 | 2873 |
2874 // static | 2874 // static |
2875 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2875 void Builtins::Generate_Abort(MacroAssembler* masm) { |
2876 // ----------- S t a t e ------------- | 2876 // ----------- S t a t e ------------- |
2877 // -- r4 : message_id as Smi | 2877 // -- r4 : message_id as Smi |
2878 // -- lr : return address | 2878 // -- lr : return address |
2879 // ----------------------------------- | 2879 // ----------------------------------- |
2880 __ push(r4); | 2880 __ push(r4); |
2881 __ LoadSmiLiteral(cp, Smi::kZero); | 2881 __ LoadSmiLiteral(cp, Smi::FromInt(0)); |
2882 __ TailCallRuntime(Runtime::kAbort); | 2882 __ TailCallRuntime(Runtime::kAbort); |
2883 } | 2883 } |
2884 | 2884 |
2885 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2885 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2886 // ----------- S t a t e ------------- | 2886 // ----------- S t a t e ------------- |
2887 // -- r3 : actual number of arguments | 2887 // -- r3 : actual number of arguments |
2888 // -- r4 : function (passed through to callee) | 2888 // -- r4 : function (passed through to callee) |
2889 // -- r5 : expected number of arguments | 2889 // -- r5 : expected number of arguments |
2890 // -- r6 : new target (passed through to callee) | 2890 // -- r6 : new target (passed through to callee) |
2891 // ----------------------------------- | 2891 // ----------------------------------- |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 __ CallRuntime(Runtime::kThrowStackOverflow); | 3012 __ CallRuntime(Runtime::kThrowStackOverflow); |
3013 __ bkpt(0); | 3013 __ bkpt(0); |
3014 } | 3014 } |
3015 } | 3015 } |
3016 | 3016 |
3017 #undef __ | 3017 #undef __ |
3018 } // namespace internal | 3018 } // namespace internal |
3019 } // namespace v8 | 3019 } // namespace v8 |
3020 | 3020 |
3021 #endif // V8_TARGET_ARCH_PPC | 3021 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |