| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| 11 #include "src/debug/debug.h" | 11 #include "src/debug/debug.h" |
| 12 #include "src/full-codegen/full-codegen.h" | 12 #include "src/full-codegen/full-codegen.h" |
| 13 #include "src/ic/ic.h" | 13 #include "src/ic/ic.h" |
| 14 #include "src/parsing/parser.h" | 14 #include "src/parsing/parser.h" |
| 15 | 15 |
| 16 #include "src/ppc/code-stubs-ppc.h" | 16 #include "src/ppc/code-stubs-ppc.h" |
| 17 #include "src/ppc/macro-assembler-ppc.h" | 17 #include "src/ppc/macro-assembler-ppc.h" |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 #define __ ACCESS_MASM(masm_) | 22 #define __ ACCESS_MASM(masm()) |
| 23 | 23 |
| 24 // A patch site is a location in the code which it is possible to patch. This | 24 // A patch site is a location in the code which it is possible to patch. This |
| 25 // class has a number of methods to emit the code which is patchable and the | 25 // class has a number of methods to emit the code which is patchable and the |
| 26 // method EmitPatchInfo to record a marker back to the patchable code. This | 26 // method EmitPatchInfo to record a marker back to the patchable code. This |
| 27 // marker is a cmpi rx, #yyy instruction, and x * 0x0000ffff + yyy (raw 16 bit | 27 // marker is a cmpi rx, #yyy instruction, and x * 0x0000ffff + yyy (raw 16 bit |
| 28 // immediate value is used) is the delta from the pc to the first instruction of | 28 // immediate value is used) is the delta from the pc to the first instruction of |
| 29 // the patchable code. | 29 // the patchable code. |
| 30 // See PatchInlinedSmiCode in ic-ppc.cc for the code that patches it | 30 // See PatchInlinedSmiCode in ic-ppc.cc for the code that patches it |
| 31 class JumpPatchSite BASE_EMBEDDED { | 31 class JumpPatchSite BASE_EMBEDDED { |
| 32 public: | 32 public: |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 __ cmpi(reg, Operand(delta_to_patch_site % kOff16Mask)); | 67 __ cmpi(reg, Operand(delta_to_patch_site % kOff16Mask)); |
| 68 #ifdef DEBUG | 68 #ifdef DEBUG |
| 69 info_emitted_ = true; | 69 info_emitted_ = true; |
| 70 #endif | 70 #endif |
| 71 } else { | 71 } else { |
| 72 __ nop(); // Signals no inlined code. | 72 __ nop(); // Signals no inlined code. |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 MacroAssembler* masm() { return masm_; } |
| 77 MacroAssembler* masm_; | 78 MacroAssembler* masm_; |
| 78 Label patch_site_; | 79 Label patch_site_; |
| 79 #ifdef DEBUG | 80 #ifdef DEBUG |
| 80 bool info_emitted_; | 81 bool info_emitted_; |
| 81 #endif | 82 #endif |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 | 85 |
| 85 // Generate code for a JS function. On entry to the function the receiver | 86 // Generate code for a JS function. On entry to the function the receiver |
| 86 // and arguments have been pushed on the stack left to right. The actual | 87 // and arguments have been pushed on the stack left to right. The actual |
| (...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 __ bind(&continuation); | 1896 __ bind(&continuation); |
| 1896 // When we arrive here, the stack top is the resume mode and | 1897 // When we arrive here, the stack top is the resume mode and |
| 1897 // result_register() holds the input value (the argument given to the | 1898 // result_register() holds the input value (the argument given to the |
| 1898 // respective resume operation). | 1899 // respective resume operation). |
| 1899 __ RecordGeneratorContinuation(); | 1900 __ RecordGeneratorContinuation(); |
| 1900 __ pop(r4); | 1901 __ pop(r4); |
| 1901 __ CmpSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::RETURN), r0); | 1902 __ CmpSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::RETURN), r0); |
| 1902 __ bne(&resume); | 1903 __ bne(&resume); |
| 1903 __ push(result_register()); | 1904 __ push(result_register()); |
| 1904 EmitCreateIteratorResult(true); | 1905 EmitCreateIteratorResult(true); |
| 1905 EmitUnwindBeforeReturn(); | 1906 EmitUnwindAndReturn(); |
| 1906 EmitReturnSequence(); | |
| 1907 | 1907 |
| 1908 __ bind(&suspend); | 1908 __ bind(&suspend); |
| 1909 VisitForAccumulatorValue(expr->generator_object()); | 1909 VisitForAccumulatorValue(expr->generator_object()); |
| 1910 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); | 1910 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); |
| 1911 __ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos())); | 1911 __ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos())); |
| 1912 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), | 1912 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), |
| 1913 r0); | 1913 r0); |
| 1914 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); | 1914 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); |
| 1915 __ mr(r4, cp); | 1915 __ mr(r4, cp); |
| 1916 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, | 1916 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, |
| 1917 kLRHasBeenSaved, kDontSaveFPRegs); | 1917 kLRHasBeenSaved, kDontSaveFPRegs); |
| 1918 __ addi(r4, fp, Operand(StandardFrameConstants::kExpressionsOffset)); | 1918 __ addi(r4, fp, Operand(StandardFrameConstants::kExpressionsOffset)); |
| 1919 __ cmp(sp, r4); | 1919 __ cmp(sp, r4); |
| 1920 __ beq(&post_runtime); | 1920 __ beq(&post_runtime); |
| 1921 __ push(r3); // generator object | 1921 __ push(r3); // generator object |
| 1922 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); | 1922 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
| 1923 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 1923 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1924 __ bind(&post_runtime); | 1924 __ bind(&post_runtime); |
| 1925 __ pop(result_register()); | 1925 __ pop(result_register()); |
| 1926 EmitReturnSequence(); | 1926 EmitReturnSequence(); |
| 1927 | 1927 |
| 1928 __ bind(&resume); | 1928 __ bind(&resume); |
| 1929 context()->Plug(result_register()); | 1929 context()->Plug(result_register()); |
| 1930 break; | 1930 break; |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 case Yield::kFinal: { | 1933 case Yield::kFinal: { |
| 1934 // Pop value from top-of-stack slot, box result into result register. | 1934 // Pop value from top-of-stack slot, box result into result register. |
| 1935 EmitCreateIteratorResult(true); | 1935 EmitCreateIteratorResult(true); |
| 1936 EmitUnwindBeforeReturn(); | 1936 EmitUnwindAndReturn(); |
| 1937 EmitReturnSequence(); | |
| 1938 break; | 1937 break; |
| 1939 } | 1938 } |
| 1940 | 1939 |
| 1941 case Yield::kDelegating: { | 1940 case Yield::kDelegating: { |
| 1942 VisitForStackValue(expr->generator_object()); | 1941 VisitForStackValue(expr->generator_object()); |
| 1943 | 1942 |
| 1944 // Initial stack layout is as follows: | 1943 // Initial stack layout is as follows: |
| 1945 // [sp + 1 * kPointerSize] iter | 1944 // [sp + 1 * kPointerSize] iter |
| 1946 // [sp + 0 * kPointerSize] g | 1945 // [sp + 0 * kPointerSize] g |
| 1947 | 1946 |
| (...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4776 return ON_STACK_REPLACEMENT; | 4775 return ON_STACK_REPLACEMENT; |
| 4777 } | 4776 } |
| 4778 | 4777 |
| 4779 DCHECK(interrupt_address == | 4778 DCHECK(interrupt_address == |
| 4780 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4779 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 4781 return OSR_AFTER_STACK_CHECK; | 4780 return OSR_AFTER_STACK_CHECK; |
| 4782 } | 4781 } |
| 4783 } // namespace internal | 4782 } // namespace internal |
| 4784 } // namespace v8 | 4783 } // namespace v8 |
| 4785 #endif // V8_TARGET_ARCH_PPC | 4784 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |