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

Side by Side Diff: src/full-codegen/ppc/full-codegen-ppc.cc

Issue 1735623002: PPC: [fullcodegen] Implement control flow across do-expressions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 948 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
949 } 949 }
950 950
951 951
952 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { 952 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
953 Comment cmnt(masm_, "[ ForInStatement"); 953 Comment cmnt(masm_, "[ ForInStatement");
954 SetStatementPosition(stmt, SKIP_BREAK); 954 SetStatementPosition(stmt, SKIP_BREAK);
955 955
956 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); 956 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
957 957
958 Label loop, exit;
959 ForIn loop_statement(this, stmt);
960 increment_loop_depth();
961
962 // Get the object to enumerate over. 958 // Get the object to enumerate over.
963 SetExpressionAsStatementPosition(stmt->enumerable()); 959 SetExpressionAsStatementPosition(stmt->enumerable());
964 VisitForAccumulatorValue(stmt->enumerable()); 960 VisitForAccumulatorValue(stmt->enumerable());
965 OperandStackDepthIncrement(ForIn::kElementCount); 961 OperandStackDepthIncrement(5);
962
963 Label loop, exit;
964 Iteration loop_statement(this, stmt);
965 increment_loop_depth();
966 966
967 // If the object is null or undefined, skip over the loop, otherwise convert 967 // If the object is null or undefined, skip over the loop, otherwise convert
968 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. 968 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4.
969 Label convert, done_convert; 969 Label convert, done_convert;
970 __ JumpIfSmi(r3, &convert); 970 __ JumpIfSmi(r3, &convert);
971 __ CompareObjectType(r3, r4, r4, FIRST_JS_RECEIVER_TYPE); 971 __ CompareObjectType(r3, r4, r4, FIRST_JS_RECEIVER_TYPE);
972 __ bge(&done_convert); 972 __ bge(&done_convert);
973 __ CompareRoot(r3, Heap::kNullValueRootIndex); 973 __ CompareRoot(r3, Heap::kNullValueRootIndex);
974 __ beq(&exit); 974 __ beq(&exit);
975 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); 975 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex);
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 SetExpressionPosition(expr); 1840 SetExpressionPosition(expr);
1841 1841
1842 // Evaluate yielded value first; the initial iterator definition depends on 1842 // Evaluate yielded value first; the initial iterator definition depends on
1843 // this. It stays on the stack while we update the iterator. 1843 // this. It stays on the stack while we update the iterator.
1844 VisitForStackValue(expr->expression()); 1844 VisitForStackValue(expr->expression());
1845 1845
1846 switch (expr->yield_kind()) { 1846 switch (expr->yield_kind()) {
1847 case Yield::kSuspend: 1847 case Yield::kSuspend:
1848 // Pop value from top-of-stack slot; box result into result register. 1848 // Pop value from top-of-stack slot; box result into result register.
1849 EmitCreateIteratorResult(false); 1849 EmitCreateIteratorResult(false);
1850 __ push(result_register()); 1850 PushOperand(result_register());
1851 // Fall through. 1851 // Fall through.
1852 case Yield::kInitial: { 1852 case Yield::kInitial: {
1853 Label suspend, continuation, post_runtime, resume; 1853 Label suspend, continuation, post_runtime, resume;
1854 1854
1855 __ b(&suspend); 1855 __ b(&suspend);
1856 __ bind(&continuation); 1856 __ bind(&continuation);
1857 // When we arrive here, the stack top is the resume mode and 1857 // When we arrive here, the stack top is the resume mode and
1858 // result_register() holds the input value (the argument given to the 1858 // result_register() holds the input value (the argument given to the
1859 // respective resume operation). 1859 // respective resume operation).
1860 __ RecordGeneratorContinuation(); 1860 __ RecordGeneratorContinuation();
1861 __ pop(r4); 1861 __ pop(r4);
1862 __ CmpSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::RETURN), r0); 1862 __ CmpSmiLiteral(r4, Smi::FromInt(JSGeneratorObject::RETURN), r0);
1863 __ bne(&resume); 1863 __ bne(&resume);
1864 __ push(result_register()); 1864 __ push(result_register());
1865 EmitCreateIteratorResult(true); 1865 EmitCreateIteratorResult(true);
1866 EmitUnwindAndReturn(); 1866 EmitUnwindAndReturn();
1867 1867
1868 __ bind(&suspend); 1868 __ bind(&suspend);
1869 OperandStackDepthIncrement(1); // Not popped on this path.
1869 VisitForAccumulatorValue(expr->generator_object()); 1870 VisitForAccumulatorValue(expr->generator_object());
1870 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos())); 1871 DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
1871 __ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos())); 1872 __ LoadSmiLiteral(r4, Smi::FromInt(continuation.pos()));
1872 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), 1873 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset),
1873 r0); 1874 r0);
1874 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); 1875 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0);
1875 __ mr(r4, cp); 1876 __ mr(r4, cp);
1876 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, 1877 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5,
1877 kLRHasBeenSaved, kDontSaveFPRegs); 1878 kLRHasBeenSaved, kDontSaveFPRegs);
1878 __ addi(r4, fp, Operand(StandardFrameConstants::kExpressionsOffset)); 1879 __ addi(r4, fp, Operand(StandardFrameConstants::kExpressionsOffset));
1879 __ cmp(sp, r4); 1880 __ cmp(sp, r4);
1880 __ beq(&post_runtime); 1881 __ beq(&post_runtime);
1881 __ push(r3); // generator object 1882 __ push(r3); // generator object
1882 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); 1883 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
1883 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1884 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1884 __ bind(&post_runtime); 1885 __ bind(&post_runtime);
1885 PopOperand(result_register()); 1886 PopOperand(result_register());
1886 EmitReturnSequence(); 1887 EmitReturnSequence();
1887 1888
1888 __ bind(&resume); 1889 __ bind(&resume);
1889 context()->Plug(result_register()); 1890 context()->Plug(result_register());
1890 break; 1891 break;
1891 } 1892 }
1892 1893
1893 case Yield::kFinal: { 1894 case Yield::kFinal: {
1894 // Pop value from top-of-stack slot, box result into result register. 1895 // Pop value from top-of-stack slot, box result into result register.
1895 OperandStackDepthDecrement(1);
1896 EmitCreateIteratorResult(true); 1896 EmitCreateIteratorResult(true);
1897 EmitUnwindAndReturn(); 1897 EmitUnwindAndReturn();
1898 break; 1898 break;
1899 } 1899 }
1900 1900
1901 case Yield::kDelegating: 1901 case Yield::kDelegating:
1902 UNREACHABLE(); 1902 UNREACHABLE();
1903 } 1903 }
1904 } 1904 }
1905 1905
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 2053
2054 __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate, TAG_OBJECT); 2054 __ Allocate(JSIteratorResult::kSize, r3, r5, r6, &allocate, TAG_OBJECT);
2055 __ b(&done_allocate); 2055 __ b(&done_allocate);
2056 2056
2057 __ bind(&allocate); 2057 __ bind(&allocate);
2058 __ Push(Smi::FromInt(JSIteratorResult::kSize)); 2058 __ Push(Smi::FromInt(JSIteratorResult::kSize));
2059 __ CallRuntime(Runtime::kAllocateInNewSpace); 2059 __ CallRuntime(Runtime::kAllocateInNewSpace);
2060 2060
2061 __ bind(&done_allocate); 2061 __ bind(&done_allocate);
2062 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r4); 2062 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, r4);
2063 __ pop(r5); 2063 PopOperand(r5);
2064 __ LoadRoot(r6, 2064 __ LoadRoot(r6,
2065 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); 2065 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
2066 __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex); 2066 __ LoadRoot(r7, Heap::kEmptyFixedArrayRootIndex);
2067 __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0); 2067 __ StoreP(r4, FieldMemOperand(r3, HeapObject::kMapOffset), r0);
2068 __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); 2068 __ StoreP(r7, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0);
2069 __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0); 2069 __ StoreP(r7, FieldMemOperand(r3, JSObject::kElementsOffset), r0);
2070 __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0); 2070 __ StoreP(r5, FieldMemOperand(r3, JSIteratorResult::kValueOffset), r0);
2071 __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0); 2071 __ StoreP(r6, FieldMemOperand(r3, JSIteratorResult::kDoneOffset), r0);
2072 } 2072 }
2073 2073
(...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4222 return ON_STACK_REPLACEMENT; 4222 return ON_STACK_REPLACEMENT;
4223 } 4223 }
4224 4224
4225 DCHECK(interrupt_address == 4225 DCHECK(interrupt_address ==
4226 isolate->builtins()->OsrAfterStackCheck()->entry()); 4226 isolate->builtins()->OsrAfterStackCheck()->entry());
4227 return OSR_AFTER_STACK_CHECK; 4227 return OSR_AFTER_STACK_CHECK;
4228 } 4228 }
4229 } // namespace internal 4229 } // namespace internal
4230 } // namespace v8 4230 } // namespace v8
4231 #endif // V8_TARGET_ARCH_PPC 4231 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698